Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade ruby to 3.1.3 #5555

Merged
merged 32 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ec5b507
chore: upgrade ruby to 3.1.2
vishnu-narayanan Oct 5, 2022
59786f2
chore: upgrade circleci and gh action to use ruby 3.1.2
vishnu-narayanan Oct 5, 2022
547b3fa
chore: add net-smtp gem
vishnu-narayanan Oct 5, 2022
d84a47f
chore: update docker base image to 3.1.2-alpine
vishnu-narayanan Oct 5, 2022
d87aeab
Merge branch 'develop' into feat/upgrade_ruby
sojan-official Dec 8, 2022
f8dc226
chore: revert gem updates
sojan-official Dec 8, 2022
ba3b70e
fix: rubocop
sojan-official Dec 8, 2022
5cd472b
chore: fix rubocop
sojan-official Dec 8, 2022
d26c56d
fix: webpush error
sojan-official Dec 8, 2022
c4eb0a4
chore: remove change in yarnlock
sojan-official Dec 8, 2022
fcdb4c7
chore: remove space
sojan-official Dec 8, 2022
4e2d842
Merge branch 'develop' into feat/upgrade_ruby
sojan-official Dec 19, 2022
cf2ddc4
Merge branch 'develop' into feat/upgrade_ruby
sojan-official Jan 5, 2023
4d33d51
chore: fix gem file
sojan-official Jan 5, 2023
ccf8558
Merge branch 'develop' into feat/upgrade_ruby
vishnu-narayanan Jan 6, 2023
74af701
chore: update to ruby 3.1.3
vishnu-narayanan Jan 10, 2023
e67623e
Merge branch 'develop' into feat/upgrade_ruby
vishnu-narayanan Jan 10, 2023
5927697
Merge branch 'develop' into feat/upgrade_ruby
vishnu-narayanan Jan 11, 2023
fc91168
Merge branch 'develop' into feat/upgrade_ruby
vishnu-narayanan Jan 12, 2023
f31a0c6
chore: ping docker version to alpine3.16 for nodev16.x
vishnu-narayanan Jan 12, 2023
2f4078a
chore: update webmock
sojan-official Jan 12, 2023
538195a
Merge branch 'develop' into feat/upgrade_ruby
sojan-official Jan 12, 2023
b6adb1c
chore: fix ruby gem path in dockerfile
vishnu-narayanan Jan 13, 2023
156d6a4
chore: switch to node16 in circleci
vishnu-narayanan Jan 23, 2023
ca4bcde
chore: update ruby version in linux installer script
vishnu-narayanan Jan 23, 2023
5a79c25
Merge branch 'develop' into feat/upgrade_ruby
vishnu-narayanan Jan 23, 2023
5fdc3b3
Merge branch 'develop' into feat/upgrade_ruby
vishnu-narayanan Jan 23, 2023
e9728d1
chore: update ruby version in linux installer script
vishnu-narayanan Jan 23, 2023
72b23cd
chore: fix circleci
vishnu-narayanan Jan 23, 2023
b3a865e
chore: fix circleci
vishnu-narayanan Jan 23, 2023
311721b
feat: upgrade node version to 16.x in linux installer
vishnu-narayanan Jan 23, 2023
6783826
chore: update systemd files
vishnu-narayanan Jan 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defaults: &defaults
working_directory: ~/build
docker:
# specify the version you desire here
- image: cimg/ruby:3.0.4-browsers
- image: cimg/ruby:3.1.2-browsers

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/run_foss_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:

- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.4 # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: yarn
Expand Down
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ Style/ClassAndModuleChildren:
- 'config/application.rb'
Style/MapToHash:
Enabled: false
Style/HashSyntax:
Enabled: true
EnforcedStyle: no_mixed_keys
EnforcedShorthandSyntax: never
RSpec/NestedGroups:
Enabled: true
Max: 4
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.4
3.1.2
14 changes: 12 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

ruby '3.0.4'
ruby '3.1.2'

##-- base gems for rails --##
gem 'rack-cors', require: 'rack/cors'
Expand Down Expand Up @@ -105,7 +105,12 @@ gem 'sidekiq-cron', '~> 1.3'

##-- Push notification service --##
gem 'fcm'
gem 'webpush'

# Ref: https://github.com/mastodon/mastodon/pull/18449
# ref: https://github.com/zaru/webpush/pull/106
# lets switch to web-push gem once the above PR is merged
# https://github.com/zaru/webpush/pull/106#issuecomment-1342925261
gem 'webpush', git: 'https://github.com/ClearlyClaire/webpush.git', ref: 'f14a4d52e201128b1b00245d11b6de80d6cfdcd9'

##-- geocoding / parse location from ip --##
# http://www.rubygeocoder.com/
Expand Down Expand Up @@ -135,6 +140,11 @@ gem 'stripe'
## to populate db with sample data
gem 'faker'

# Can remove this in rails 7
gem 'net-imap', require: false
gem 'net-pop', require: false
gem 'net-smtp', require: false

group :production, :staging do
# we dont want request timing out in development while using byebug
gem 'rack-timeout'
Expand Down
32 changes: 25 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
GIT
remote: https://github.com/ClearlyClaire/webpush.git
revision: f14a4d52e201128b1b00245d11b6de80d6cfdcd9
ref: f14a4d52e201128b1b00245d11b6de80d6cfdcd9
specs:
webpush (0.3.8)
hkdf (~> 0.2)
jwt (~> 2.0)

GIT
remote: https://github.com/chatwoot/devise-secure_password
revision: d777b04f12652d576b1272b8f39857e3e0b3fc26
Expand Down Expand Up @@ -358,7 +367,7 @@ GEM
hana (~> 1.3)
regexp_parser (~> 2.0)
uri_template (~> 0.7)
jwt (2.4.1)
jwt (2.5.0)
kaminari (1.2.2)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.2)
Expand Down Expand Up @@ -424,6 +433,14 @@ GEM
multipart-post (2.2.3)
net-http-persistent (4.0.1)
connection_pool (~> 2.2)
net-imap (0.3.1)
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
timeout
net-smtp (0.3.3)
net-protocol
netrc (0.11.0)
newrelic_rpm (8.9.0)
nio4r (2.5.8)
Expand Down Expand Up @@ -640,6 +657,7 @@ GEM
time_diff (0.3.0)
activesupport
i18n
timeout (0.3.1)
trailblazer-option (0.1.2)
twilio-ruby (5.68.0)
faraday (>= 0.9, < 3.0)
Expand Down Expand Up @@ -679,9 +697,6 @@ GEM
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
webpush (1.1.0)
hkdf (~> 0.2)
jwt (~> 2.0)
webrick (1.7.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
Expand Down Expand Up @@ -755,6 +770,9 @@ DEPENDENCIES
listen
maxminddb
mock_redis
net-imap
net-pop
net-smtp
newrelic_rpm
pg
pg_search
Expand Down Expand Up @@ -800,12 +818,12 @@ DEPENDENCIES
web-console
webmock
webpacker (~> 5.x)
webpush
webpush!
wisper (= 2.0.0)
working_hours

RUBY VERSION
ruby 3.0.4p208
ruby 3.1.2p20

BUNDLED WITH
2.3.16
2.3.26
12 changes: 6 additions & 6 deletions app/controllers/concerns/switch_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ module SwitchLocale

private

def switch_locale(&action)
def switch_locale(&)
# priority is for locale set in query string (mostly for widget/from js sdk)
locale ||= locale_from_params
# if locale is not set in account, let's use DEFAULT_LOCALE env variable
locale ||= locale_from_env_variable
set_locale(locale, &action)
set_locale(locale, &)
end

def switch_locale_using_account_locale(&action)
def switch_locale_using_account_locale(&)
locale = locale_from_account(@current_account)
set_locale(locale, &action)
set_locale(locale, &)
end

def set_locale(locale, &action)
def set_locale(locale, &)
# if locale is empty, use default_locale
locale ||= I18n.default_locale
# Ensure locale won't bleed into other requests
# https://guides.rubyonrails.org/i18n.html#managing-the-locale-across-requests
I18n.with_locale(locale, &action)
I18n.with_locale(locale, &)
end

def locale_from_params
Expand Down
4 changes: 2 additions & 2 deletions app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ def ensure_current_account(account)
Current.account = account if account.present?
end

def switch_locale(&action)
def switch_locale(&)
locale ||= locale_from_account(Current.account)
locale ||= I18n.default_locale
# ensure locale won't bleed into other requests
# https://guides.rubyonrails.org/i18n.html#managing-the-locale-across-requests
I18n.with_locale(locale, &action)
I18n.with_locale(locale, &)
end
end
2 changes: 1 addition & 1 deletion app/models/dashboard_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def validate_content
'required' => %w[url type],
'properties' => {
'type' => { 'enum': ['frame'] },
'url' => { 'type': 'string', 'format' => 'uri' }
'url' => { :type => 'string', 'format' => 'uri' }
}
},
'additionalProperties' => false,
Expand Down
2 changes: 1 addition & 1 deletion app/services/whatsapp/providers/whatsapp_cloud_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def send_attachment_message(phone_number, message)
"#{phone_id_path}/messages",
headers: api_headers,
body: {
messaging_product: 'whatsapp',
:messaging_product => 'whatsapp',
'to' => phone_number,
'type' => type,
type.to_s => type_content
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pre-build stage
FROM ruby:3.0.4-alpine AS pre-builder
FROM ruby:3.1.2-alpine AS pre-builder

# ARG default to production settings
# For development docker-compose file overrides ARGS
Expand Down Expand Up @@ -65,7 +65,7 @@ RUN rm -rf /gems/ruby/3.0.0/cache/*.gem \
&& find /gems/ruby/3.0.0/gems/ \( -name "*.c" -o -name "*.o" \) -delete

# final build stage
FROM ruby:3.0.4-alpine
FROM ruby:3.1.2-alpine

ARG BUNDLE_WITHOUT="development:test"
ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT}
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/api/v1/accounts/macros_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
{ 'action_name' => 'snooze_conversation' },
{ 'action_name' => 'assign_agent', 'action_params' => [user_1.id] },
{ 'action_name' => 'send_message', 'action_params' => ['Send this message.'] },
{ 'action_name' => 'add_private_note', 'action_params': ['We are sending greeting message to customer.'] }
{ 'action_name' => 'add_private_note', :action_params => ['We are sending greeting message to customer.'] }
])
end

Expand Down
2 changes: 1 addition & 1 deletion spec/factories/twitter/twitter_message_create_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'type' => 'message_create',
'id' => '123',
'message_create' => {
target: { 'recipient_id' => '1' },
:target => { 'recipient_id' => '1' },
'sender_id' => '2',
'source_app_id' => '268278',
'message_data' => {
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/webhooks/line_events_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
subject(:job) { described_class.perform_later(params: params) }

let!(:line_channel) { create(:channel_line) }
let!(:params) { { line_channel_id: line_channel.line_channel_id, 'line' => { test: 'test' } } }
let!(:params) { { :line_channel_id => line_channel.line_channel_id, 'line' => { test: 'test' } } }
let(:post_body) { params.to_json }
let(:signature) { Base64.strict_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), line_channel.line_channel_secret, post_body)) }

Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/webhooks/telegram_events_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
subject(:job) { described_class.perform_later(params) }

let!(:telegram_channel) { create(:channel_telegram) }
let!(:params) { { bot_token: telegram_channel.bot_token, 'telegram' => { test: 'test' } } }
let!(:params) { { :bot_token => telegram_channel.bot_token, 'telegram' => { test: 'test' } } }

it 'enqueues the job' do
expect { job }.to have_enqueued_job(described_class)
Expand Down
16 changes: 8 additions & 8 deletions spec/services/whatsapp/incoming_message_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
'contacts' => [{ 'profile' => { 'name' => 'Sojan Jose' }, 'wa_id' => '2423423243' }],
'messages' => [{
'errors' => [{ 'code': 131_051, 'title': 'Message type is currently not supported.' }],
'from': '2423423243', 'id': 'wamid.SDFADSf23sfasdafasdfa',
'timestamp': '1667047370', 'type': 'unsupported'
:from => '2423423243', :id => 'wamid.SDFADSf23sfasdafasdfa',
:timestamp => '1667047370', :type => 'unsupported'
}]
}.with_indifferent_access

Expand Down Expand Up @@ -115,7 +115,7 @@
params = {
'contacts' => [{ 'profile' => { 'name' => 'Sojan Jose' }, 'wa_id' => '2423423243' }],
'messages' => [{ 'from' => '2423423243', 'id' => 'SDFADSf23sfasdafasdfa',
'interactive': {
:interactive => {
'button_reply': {
'id': '1',
'title': 'First Button'
Expand Down Expand Up @@ -179,11 +179,11 @@
'contacts' => [{ 'profile' => { 'name' => 'Sojan Jose' }, 'wa_id' => '2423423243' }],
'messages' => [{ 'from' => '2423423243', 'id' => 'SDFADSf23sfasdafasdfa',
'location' => { 'id' => 'b1c68f38-8734-4ad3-b4a1-ef0c10d683',
'address': 'San Francisco, CA, USA',
'latitude': 37.7893768,
'longitude': -122.3895553,
'name': 'Bay Bridge',
'url': 'http://location_url.test' },
:address => 'San Francisco, CA, USA',
:latitude => 37.7893768,
:longitude => -122.3895553,
:name => 'Bay Bridge',
:url => 'http://location_url.test' },
'timestamp' => '1633034394', 'type' => 'location' }]
}.with_indifferent_access
described_class.new(inbox: whatsapp_channel.inbox, params: params).perform
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

config.shared_context_metadata_behavior = :apply_to_host_groups

def with_modified_env(options, &block)
ClimateControl.modify(options, &block)
def with_modified_env(options, &)
ClimateControl.modify(options, &)
end
end
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16431,3 +16431,4 @@ zwitch@^1.0.0:
version "1.0.5"
resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-1.0.5.tgz#d11d7381ffed16b742f6af7b3f223d5cd9fe9920"
integrity sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==