From ee85b6cb4bbfd010c1fdb427646981432b76c72b Mon Sep 17 00:00:00 2001 From: Thierry Joyal Date: Mon, 2 May 2022 09:00:58 -0400 Subject: [PATCH 1/5] Update Rails 7.0 --- Gemfile | 14 +----- Gemfile.lock | 135 +++++++++++++++++++++++++-------------------------- 2 files changed, 68 insertions(+), 81 deletions(-) diff --git a/Gemfile b/Gemfile index 86cdc43..34a1d22 100644 --- a/Gemfile +++ b/Gemfile @@ -3,22 +3,10 @@ ruby "3.1.0" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main' -gem 'rails', '~> 6.1' +gem 'rails', '~> 7.0' gem 'puma', '~> 5' gem 'webpacker', '~> 5' gem 'turbolinks', '~> 5' -# Use SCSS for stylesheets -# gem 'sass-rails', '>= 6' -# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -# gem 'jbuilder', '~> 2.7' -# Use Redis adapter to run Action Cable in production -# gem 'redis', '~> 4.0' -# Use Active Model has_secure_password -# gem 'bcrypt', '~> 3.1.7' - -# Use Active Storage variant -# gem 'image_processing', '~> 1.2' # Reduces boot times through caching; required in config/boot.rb gem 'net-imap', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 4cffbc0..a1822fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,73 +1,79 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.1.4.6) - actionpack (= 6.1.4.6) - activesupport (= 6.1.4.6) + actioncable (7.0.2.4) + actionpack (= 7.0.2.4) + activesupport (= 7.0.2.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.4.6) - actionpack (= 6.1.4.6) - activejob (= 6.1.4.6) - activerecord (= 6.1.4.6) - activestorage (= 6.1.4.6) - activesupport (= 6.1.4.6) + actionmailbox (7.0.2.4) + actionpack (= 7.0.2.4) + activejob (= 7.0.2.4) + activerecord (= 7.0.2.4) + activestorage (= 7.0.2.4) + activesupport (= 7.0.2.4) mail (>= 2.7.1) - actionmailer (6.1.4.6) - actionpack (= 6.1.4.6) - actionview (= 6.1.4.6) - activejob (= 6.1.4.6) - activesupport (= 6.1.4.6) + net-imap + net-pop + net-smtp + actionmailer (7.0.2.4) + actionpack (= 7.0.2.4) + actionview (= 7.0.2.4) + activejob (= 7.0.2.4) + activesupport (= 7.0.2.4) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (6.1.4.6) - actionview (= 6.1.4.6) - activesupport (= 6.1.4.6) - rack (~> 2.0, >= 2.0.9) + actionpack (7.0.2.4) + actionview (= 7.0.2.4) + activesupport (= 7.0.2.4) + rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.4.6) - actionpack (= 6.1.4.6) - activerecord (= 6.1.4.6) - activestorage (= 6.1.4.6) - activesupport (= 6.1.4.6) + actiontext (7.0.2.4) + actionpack (= 7.0.2.4) + activerecord (= 7.0.2.4) + activestorage (= 7.0.2.4) + activesupport (= 7.0.2.4) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.4.6) - activesupport (= 6.1.4.6) + actionview (7.0.2.4) + activesupport (= 7.0.2.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.4.6) - activesupport (= 6.1.4.6) + activejob (7.0.2.4) + activesupport (= 7.0.2.4) globalid (>= 0.3.6) - activemodel (6.1.4.6) - activesupport (= 6.1.4.6) + activemodel (7.0.2.4) + activesupport (= 7.0.2.4) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (6.1.4.6) - activemodel (= 6.1.4.6) - activesupport (= 6.1.4.6) + activerecord (7.0.2.4) + activemodel (= 7.0.2.4) + activesupport (= 7.0.2.4) activeresource (6.0.0) activemodel (>= 6.0) activemodel-serializers-xml (~> 1.0) activesupport (>= 6.0) - activestorage (6.1.4.6) - actionpack (= 6.1.4.6) - activejob (= 6.1.4.6) - activerecord (= 6.1.4.6) - activesupport (= 6.1.4.6) - marcel (~> 1.0.0) + activestorage (7.0.2.4) + actionpack (= 7.0.2.4) + activejob (= 7.0.2.4) + activerecord (= 7.0.2.4) + activesupport (= 7.0.2.4) + marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.4.6) + activesupport (7.0.2.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) babel-source (5.8.35) @@ -93,7 +99,7 @@ GEM regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) childprocess (4.1.0) - concurrent-ruby (1.1.9) + concurrent-ruby (1.1.10) connection_pool (2.2.5) crass (1.0.6) digest (3.1.0) @@ -159,7 +165,7 @@ GEM listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.14.0) + loofah (2.17.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -228,21 +234,20 @@ GEM rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.1.4.6) - actioncable (= 6.1.4.6) - actionmailbox (= 6.1.4.6) - actionmailer (= 6.1.4.6) - actionpack (= 6.1.4.6) - actiontext (= 6.1.4.6) - actionview (= 6.1.4.6) - activejob (= 6.1.4.6) - activemodel (= 6.1.4.6) - activerecord (= 6.1.4.6) - activestorage (= 6.1.4.6) - activesupport (= 6.1.4.6) + rails (7.0.2.4) + actioncable (= 7.0.2.4) + actionmailbox (= 7.0.2.4) + actionmailer (= 7.0.2.4) + actionpack (= 7.0.2.4) + actiontext (= 7.0.2.4) + actionview (= 7.0.2.4) + activejob (= 7.0.2.4) + activemodel (= 7.0.2.4) + activerecord (= 7.0.2.4) + activestorage (= 7.0.2.4) + activesupport (= 7.0.2.4) bundler (>= 1.15.0) - railties (= 6.1.4.6) - sprockets-rails (>= 2.0.0) + railties (= 7.0.2.4) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) @@ -253,12 +258,13 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (6.1.4.6) - actionpack (= 6.1.4.6) - activesupport (= 6.1.4.6) + railties (7.0.2.4) + actionpack (= 7.0.2.4) + activesupport (= 7.0.2.4) method_source - rake (>= 0.13) + rake (>= 12.2) thor (~> 1.0) + zeitwerk (~> 2.5) rake (13.0.6) rb-fsevent (0.11.1) rb-inotify (0.10.1) @@ -308,13 +314,6 @@ GEM spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (4.0.2) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - sprockets (>= 3.0.0) strscan (3.0.1) thor (1.2.1) thread_safe (0.3.6) @@ -380,7 +379,7 @@ DEPENDENCIES net-smtp pg puma (~> 5) - rails (~> 6.1) + rails (~> 7.0) rails_12factor react-rails selenium-webdriver From d9edbd88cd141d9579451accb6da303a6aa29221 Mon Sep 17 00:00:00 2001 From: Thierry Joyal Date: Tue, 3 May 2022 09:14:12 -0400 Subject: [PATCH 2/5] Re-add sproket-rails --- Gemfile | 1 + Gemfile.lock | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/Gemfile b/Gemfile index 34a1d22..bd729ad 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ gem 'rails', '~> 7.0' gem 'puma', '~> 5' gem 'webpacker', '~> 5' gem 'turbolinks', '~> 5' +gem 'sprockets-rails', :require => 'sprockets/railtie' # Reduces boot times through caching; required in config/boot.rb gem 'net-imap', require: false diff --git a/Gemfile.lock b/Gemfile.lock index a1822fb..7063e3b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -314,6 +314,13 @@ GEM spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) + sprockets (4.0.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) strscan (3.0.1) thor (1.2.1) thread_safe (0.3.6) @@ -389,6 +396,7 @@ DEPENDENCIES slack-ruby-client spring spring-watcher-listen (~> 2.0.0) + sprockets-rails turbolinks (~> 5) twilio-ruby twitter From 365afdb73132834cb5188766b8e353503ece8aad Mon Sep 17 00:00:00 2001 From: Thierry Joyal Date: Tue, 3 May 2022 09:14:42 -0400 Subject: [PATCH 3/5] Do not override rails form_for default behaviour --- app/views/rules/_handler.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/rules/_handler.html.erb b/app/views/rules/_handler.html.erb index 7884468..da3b86f 100644 --- a/app/views/rules/_handler.html.erb +++ b/app/views/rules/_handler.html.erb @@ -23,7 +23,7 @@
<%= f.polaris_select(:service_name, available_handlers.map { |handler| [handler.label, handler.to_s] }, { prompt: "Select an action" }, { data: { handler: true } }) %> - <%= f.fields_for :settings, f.object.settings do |ff| %> + <%= f.fields_for :settings do |ff| %> <% available_handlers.each do |handler| %>
<% if handler.description.present? %> From aa67169ba10b87ee35c867ccd6232282d2df94ba Mon Sep 17 00:00:00 2001 From: Thierry Joyal Date: Tue, 3 May 2022 09:26:49 -0400 Subject: [PATCH 4/5] Update spring to v4.0 --- Gemfile | 3 +-- Gemfile.lock | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index bd729ad..e6e12cc 100644 --- a/Gemfile +++ b/Gemfile @@ -40,8 +40,7 @@ group :development do gem 'web-console', '>= 3.3.0' gem 'listen', '~> 3.2' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring - gem 'spring' - gem 'spring-watcher-listen', '~> 2.0.0' + gem 'spring', '~> 4.0' end gem "bugsnag", "~> 6.13" diff --git a/Gemfile.lock b/Gemfile.lock index 7063e3b..71b4f92 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -310,10 +310,7 @@ GEM gli hashie websocket-driver - spring (2.1.1) - spring-watcher-listen (2.0.1) - listen (>= 2.7, < 4.0) - spring (>= 1.2, < 3.0) + spring (4.0.0) sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -394,8 +391,7 @@ DEPENDENCIES shopify_app (~> 18) skylight slack-ruby-client - spring - spring-watcher-listen (~> 2.0.0) + spring (~> 4.0) sprockets-rails turbolinks (~> 5) twilio-ruby From 7c8bf880ef65677bcd0b2a4a1645c70a301aa556 Mon Sep 17 00:00:00 2001 From: Thierry Joyal Date: Tue, 3 May 2022 09:29:09 -0400 Subject: [PATCH 5/5] DEPRECATION WARNING: Time#to_s(:db) is deprecated. Please use Time#to_fs(:db) instead. --- app/models/rule_event.rb | 2 +- app/models/rule_event_detail.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/rule_event.rb b/app/models/rule_event.rb index b3f5357..65acd4b 100644 --- a/app/models/rule_event.rb +++ b/app/models/rule_event.rb @@ -37,7 +37,7 @@ def as_json dump.merge({ shopify_identifier: @shopify_identifier, hooklys_identifier: @hooklys_identifier, - timestamp: @details.first.timestamp.to_s(:db), + timestamp: @details.first.timestamp.to_fs(:db), error: @details.any? { _1.level == :error }, }) end diff --git a/app/models/rule_event_detail.rb b/app/models/rule_event_detail.rb index d74ed5b..62f72a6 100644 --- a/app/models/rule_event_detail.rb +++ b/app/models/rule_event_detail.rb @@ -17,7 +17,7 @@ def initialize(level:, message:) def dump { - "timestamp" => @timestamp.to_s(:db), + "timestamp" => @timestamp.to_fs(:db), "level" => @level.to_s, "message" => @message, }