From bfb335942af99624b1af327e7fc92f5c4d82a6a4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Jun 2021 14:35:53 +0000 Subject: [PATCH 1/3] Bump rails from 6.0.3.6 to 6.1.3.2 Bumps [rails](https://github.com/rails/rails) from 6.0.3.6 to 6.1.3.2. - [Release notes](https://github.com/rails/rails/releases) - [Commits](https://github.com/rails/rails/compare/v6.0.3.6...v6.1.3.2) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 127 ++++++++++++++++++++++++++------------------------- 2 files changed, 66 insertions(+), 63 deletions(-) diff --git a/Gemfile b/Gemfile index 9fda4dba3..610feafae 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -gem "rails", "6.0.3.7" +gem "rails", "6.1.3.2" gem "dalli" gem "gds-api-adapters" diff --git a/Gemfile.lock b/Gemfile.lock index cbbbe2eb1..139b30227 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,61 +1,65 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.0.3.7) - actionpack (= 6.0.3.7) + actioncable (6.1.3.2) + actionpack (= 6.1.3.2) + activesupport (= 6.1.3.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.3.7) - actionpack (= 6.0.3.7) - activejob (= 6.0.3.7) - activerecord (= 6.0.3.7) - activestorage (= 6.0.3.7) - activesupport (= 6.0.3.7) + actionmailbox (6.1.3.2) + actionpack (= 6.1.3.2) + activejob (= 6.1.3.2) + activerecord (= 6.1.3.2) + activestorage (= 6.1.3.2) + activesupport (= 6.1.3.2) mail (>= 2.7.1) - actionmailer (6.0.3.7) - actionpack (= 6.0.3.7) - actionview (= 6.0.3.7) - activejob (= 6.0.3.7) + actionmailer (6.1.3.2) + actionpack (= 6.1.3.2) + actionview (= 6.1.3.2) + activejob (= 6.1.3.2) + activesupport (= 6.1.3.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.3.7) - actionview (= 6.0.3.7) - activesupport (= 6.0.3.7) - rack (~> 2.0, >= 2.0.8) + actionpack (6.1.3.2) + actionview (= 6.1.3.2) + activesupport (= 6.1.3.2) + rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.3.7) - actionpack (= 6.0.3.7) - activerecord (= 6.0.3.7) - activestorage (= 6.0.3.7) - activesupport (= 6.0.3.7) + actiontext (6.1.3.2) + actionpack (= 6.1.3.2) + activerecord (= 6.1.3.2) + activestorage (= 6.1.3.2) + activesupport (= 6.1.3.2) nokogiri (>= 1.8.5) - actionview (6.0.3.7) - activesupport (= 6.0.3.7) + actionview (6.1.3.2) + activesupport (= 6.1.3.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.3.7) - activesupport (= 6.0.3.7) + activejob (6.1.3.2) + activesupport (= 6.1.3.2) globalid (>= 0.3.6) - activemodel (6.0.3.7) - activesupport (= 6.0.3.7) - activerecord (6.0.3.7) - activemodel (= 6.0.3.7) - activesupport (= 6.0.3.7) - activestorage (6.0.3.7) - actionpack (= 6.0.3.7) - activejob (= 6.0.3.7) - activerecord (= 6.0.3.7) + activemodel (6.1.3.2) + activesupport (= 6.1.3.2) + activerecord (6.1.3.2) + activemodel (= 6.1.3.2) + activesupport (= 6.1.3.2) + activestorage (6.1.3.2) + actionpack (= 6.1.3.2) + activejob (= 6.1.3.2) + activerecord (= 6.1.3.2) + activesupport (= 6.1.3.2) marcel (~> 1.0.0) - activesupport (6.0.3.7) + mini_mime (~> 1.0.2) + activesupport (6.1.3.2) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.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) anemone (0.7.2) @@ -200,7 +204,7 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2021.0704) mini_magick (4.10.1) - mini_mime (1.1.0) + mini_mime (1.0.3) mini_portile2 (2.5.3) minitest (5.14.4) minitest-reporters (1.4.2) @@ -232,20 +236,20 @@ GEM rack-test (1.1.0) rack (>= 1.0, < 3) rack_strip_client_ip (0.0.2) - rails (6.0.3.7) - actioncable (= 6.0.3.7) - actionmailbox (= 6.0.3.7) - actionmailer (= 6.0.3.7) - actionpack (= 6.0.3.7) - actiontext (= 6.0.3.7) - actionview (= 6.0.3.7) - activejob (= 6.0.3.7) - activemodel (= 6.0.3.7) - activerecord (= 6.0.3.7) - activestorage (= 6.0.3.7) - activesupport (= 6.0.3.7) - bundler (>= 1.3.0) - railties (= 6.0.3.7) + rails (6.1.3.2) + actioncable (= 6.1.3.2) + actionmailbox (= 6.1.3.2) + actionmailer (= 6.1.3.2) + actionpack (= 6.1.3.2) + actiontext (= 6.1.3.2) + actionview (= 6.1.3.2) + activejob (= 6.1.3.2) + activemodel (= 6.1.3.2) + activerecord (= 6.1.3.2) + activestorage (= 6.1.3.2) + activesupport (= 6.1.3.2) + bundler (>= 1.15.0) + railties (= 6.1.3.2) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -262,12 +266,12 @@ GEM rails_translation_manager (0.1.0) activesupport rails-i18n - railties (6.0.3.7) - actionpack (= 6.0.3.7) - activesupport (= 6.0.3.7) + railties (6.1.3.2) + actionpack (= 6.1.3.2) + activesupport (= 6.1.3.2) method_source rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) + thor (~> 1.0) rainbow (3.0.0) raindrops (0.19.2) rake (13.0.6) @@ -348,11 +352,10 @@ GEM terminal-table (3.0.1) unicode-display_width (>= 1.1.1, < 3) thor (1.1.0) - thread_safe (0.3.6) tilt (2.0.10) timecop (0.9.4) - tzinfo (1.2.9) - thread_safe (~> 0.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) @@ -414,7 +417,7 @@ DEPENDENCIES plek pry rack_strip_client_ip - rails (= 6.0.3.7) + rails (= 6.1.3.2) rails-controller-testing rails-i18n rails_translation_manager From 28a9e9232850bfa99ad7353ac8445edce1ce7b63 Mon Sep 17 00:00:00 2001 From: Benjamin Eskola Date: Thu, 24 Jun 2021 17:10:29 +0100 Subject: [PATCH 2/3] Apply rails app:update changes --- config/application.rb | 12 ++++- config/environments/development.rb | 3 +- config/environments/test.rb | 2 +- config/initializers/assets.rb | 2 +- .../new_framework_defaults_6_0.rb | 45 +++++++++++++++++++ config/routes.rb | 1 + 6 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 config/initializers/new_framework_defaults_6_0.rb diff --git a/config/application.rb b/config/application.rb index c86a1ddc8..bcd420dd1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,11 +4,19 @@ # Pick the frameworks you want: require "active_model/railtie" # require "active_job/railtie" +# require "active_record/railtie" +# require "active_storage/engine" require "action_controller/railtie" +# require "action_mailer/railtie" +# require "action_mailbox/engine" +# require "action_text/engine" require "action_view/railtie" +# require "action_cable/engine" require "sprockets/railtie" require "rails/test_unit/railtie" +require "active_support/core_ext/integer/time" + # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) @@ -16,10 +24,10 @@ module GovernmentFrontend class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.0 + config.load_defaults 6.1 # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers + # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. diff --git a/config/environments/development.rb b/config/environments/development.rb index 74d78c922..18c0b2c69 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -13,6 +13,7 @@ config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. + # Run rails dev:cache to toggle caching. if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true @@ -39,7 +40,7 @@ config.assets.quiet = true # Raises error for missing translations. - config.action_view.raise_on_missing_translations = true + config.i18n.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. diff --git a/config/environments/test.rb b/config/environments/test.rb index 7ae04a2d0..a159e90b3 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -34,7 +34,7 @@ config.active_support.deprecation = :stderr # Raises error for missing translations. - config.action_view.raise_on_missing_translations = true + config.i18n.raise_on_missing_translations = true # TODO: Re-enable tests to run against compiled assets with digests # Add a performant assets compilation step before tests run diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index d187a56e2..36635c51a 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -7,7 +7,7 @@ # Rails.application.config.assets.paths << Emoji.images_path # Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets +# application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. Rails.application.config.assets.precompile += %w[ print.css diff --git a/config/initializers/new_framework_defaults_6_0.rb b/config/initializers/new_framework_defaults_6_0.rb new file mode 100644 index 000000000..92240ef5f --- /dev/null +++ b/config/initializers/new_framework_defaults_6_0.rb @@ -0,0 +1,45 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 6.0 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Don't force requests from old versions of IE to be UTF-8 encoded. +# Rails.application.config.action_view.default_enforce_utf8 = false + +# Embed purpose and expiry metadata inside signed and encrypted +# cookies for increased security. +# +# This option is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 6.0. +# Rails.application.config.action_dispatch.use_cookies_with_metadata = true + +# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification. +# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false + +# Return false instead of self when enqueuing is aborted from a callback. +# Rails.application.config.active_job.return_false_on_aborted_enqueue = true + +# Send Active Storage analysis and purge jobs to dedicated queues. +# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis +# Rails.application.config.active_storage.queues.purge = :active_storage_purge + +# When assigning to a collection of attachments declared via `has_many_attached`, replace existing +# attachments instead of appending. Use #attach to add new attachments without replacing existing ones. +# Rails.application.config.active_storage.replace_on_assign_to_many = true + +# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail. +# +# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob), +# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions. +# If you send mail in the background, job workers need to have a copy of +# MailDeliveryJob to ensure all delivery jobs are processed properly. +# Make sure your entire app is migrated and stable on 6.0 before using this setting. +# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob" + +# Enable the same cache key to be reused when the object being cached of type +# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count) +# of the relation's cache key into the cache version to support recycling cache key. +# Rails.application.config.active_record.collection_cache_versioning = true diff --git a/config/routes.rb b/config/routes.rb index c8f0cdb0f..9ed2679e0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,5 @@ Rails.application.routes.draw do + # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html unless Rails.env.production? # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html get "random/:schema" => "randomly_generated_content_item#show" From eae817821b2aeae52233a097a26f0f6f5701d19a Mon Sep 17 00:00:00 2001 From: Benjamin Eskola Date: Thu, 29 Jul 2021 14:59:53 +0100 Subject: [PATCH 3/3] Switch from DalliStore to MemcacheStore This fixes an issue where the Dalli store is not supported in Rails 6.1: petergoldstein/dalli#771, cf. alphagov/local-links-manager#751 and alphagov/collections#2287 --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 525e36f7a..0704fc55f 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -54,7 +54,7 @@ # Use a different cache store in production. # config.cache_store = :mem_cache_store - config.cache_store = :dalli_store, nil, { namespace: :government_frontend, compress: true } + config.cache_store = :mem_cache_store, nil, { namespace: :government_frontend, compress: true } # Use a real queuing backend for Active Job (and separate queues per environment). # config.active_job.queue_adapter = :resque