# HG changeset patch # User nanaya # Date 1642181993 -32400 # Node ID ad6264cca788a9cd00f926126f6bb2cc86646129 # Parent fefe9b0a603d85eebb25d50f18d6c7151e580474 Update to rails 7 diff -r fefe9b0a603d -r ad6264cca788 Gemfile --- a/Gemfile Sat Aug 21 20:46:52 2021 +0900 +++ b/Gemfile Sat Jan 15 02:39:53 2022 +0900 @@ -1,11 +1,17 @@ source "https://rubygems.org" -rails_ver = "~> 6.1.0" +rails_ver = "~> 7.0.1" + gem "actionview", rails_ver gem "railties", rails_ver gem "actionpack", rails_ver -gem "redis-rails" +# TODO: back to release version after they released version which support Rails 7 +# "redis-actionpack" and "redis-activesupport" are only here because otherwise "redis-rails" +# will try to download outdated version of those. +gem "redis-actionpack", github: "redis-store/redis-actionpack", branch: "master" +gem "redis-activesupport", github: "redis-store/redis-activesupport", branch: "master" +gem "redis-rails", github: "redis-store/redis-rails", branch: "master" gem "redis" gem "redis-store" @@ -15,4 +21,3 @@ gem "newrelic_rpm" gem "puma", :require => false -gem "falcon", :require => false, :platforms => :ruby diff -r fefe9b0a603d -r ad6264cca788 Gemfile.lock --- a/Gemfile.lock Sat Aug 21 20:46:52 2021 +0900 +++ b/Gemfile.lock Sat Jan 15 02:39:53 2022 +0900 @@ -1,77 +1,68 @@ +GIT + remote: https://github.com/redis-store/redis-actionpack.git + revision: daf349101adfb395654be687d46c0f5c0c734e99 + branch: master + specs: + redis-actionpack (5.2.0) + actionpack (>= 5, < 8) + redis-rack (>= 2.1.0, < 3) + redis-store (>= 1.1.0, < 2) + +GIT + remote: https://github.com/redis-store/redis-activesupport.git + revision: 355f947fd335c1ae7bff10daf813574adc07857d + branch: master + specs: + redis-activesupport (5.2.1) + activesupport (>= 3, < 8) + redis-store (>= 1.3, < 2) + +GIT + remote: https://github.com/redis-store/redis-rails.git + revision: 0c12c0e09ebe04da85ecd233a2488d618ab36c9a + branch: master + specs: + redis-rails (5.0.2) + redis-actionpack (>= 3.0, < 6) + redis-activesupport (>= 3.0, < 6) + GEM remote: https://rubygems.org/ specs: - actionpack (6.1.4.1) - actionview (= 6.1.4.1) - activesupport (= 6.1.4.1) - rack (~> 2.0, >= 2.0.9) + actionpack (7.0.1) + actionview (= 7.0.1) + activesupport (= 7.0.1) + rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actionview (6.1.4.1) - activesupport (= 6.1.4.1) + actionview (7.0.1) + activesupport (= 7.0.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activesupport (6.1.4.1) + activesupport (7.0.1) 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) - async (1.30.1) - console (~> 1.10) - nio4r (~> 2.3) - timers (~> 4.1) - async-container (0.16.12) - async - async-io - async-http (0.56.5) - async (>= 1.25) - async-io (>= 1.28) - async-pool (>= 0.2) - protocol-http (~> 0.22.0) - protocol-http1 (~> 0.14.0) - protocol-http2 (~> 0.14.0) - async-http-cache (0.4.2) - async-http (~> 0.56) - async-io (1.32.2) - async - async-pool (0.3.8) - async (>= 1.25) buftok (0.2.0) - build-environment (1.13.0) builder (3.2.4) concurrent-ruby (1.1.9) - console (1.13.1) - fiber-local crass (1.0.6) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) equalizer (0.0.11) erubi (1.10.0) - falcon (0.39.2) - async - async-container (~> 0.16.0) - async-http (~> 0.56.0) - async-http-cache (~> 0.4.0) - async-io (~> 1.22) - build-environment (~> 1.13) - bundler - localhost (~> 1.1) - process-metrics (~> 0.2.0) - rack (>= 1.0) - samovar (~> 2.1) - ffi (1.15.3) - ffi (1.15.3-java) - ffi (1.15.3-x86-mingw32) + ffi (1.15.5) + ffi (1.15.5-java) + ffi (1.15.5-x86-mingw32) ffi-compiler (1.0.1) ffi (>= 1.0.0) rake - fiber-local (1.0.0) http (4.4.1) addressable (~> 2.3) http-cookie (~> 1.0) @@ -84,88 +75,62 @@ ffi-compiler (>= 1.0, < 2.0) http_parser.rb (0.6.0) http_parser.rb (0.6.0-java) - i18n (1.8.10) + i18n (1.8.11) concurrent-ruby (~> 1.0) - idn-ruby (0.1.2) - localhost (1.1.8) - loofah (2.12.0) + idn-ruby (0.1.4) + loofah (2.13.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mapping (1.1.1) memoizable (0.4.2) thread_safe (~> 0.3, >= 0.3.1) method_source (1.0.0) - mini_portile2 (2.6.1) - minitest (5.14.4) + mini_portile2 (2.7.1) + minitest (5.15.0) multipart-post (2.1.1) naught (1.1.0) - newrelic_rpm (7.2.0) + newrelic_rpm (8.3.0) nio4r (2.5.8) nio4r (2.5.8-java) - nokogiri (1.12.3) - mini_portile2 (~> 2.6.1) + nokogiri (1.13.1) + mini_portile2 (~> 2.7.0) racc (~> 1.4) - nokogiri (1.12.3-java) + nokogiri (1.13.1-java) racc (~> 1.4) - nokogiri (1.12.3-x86-mingw32) + nokogiri (1.13.1-x86-mingw32) racc (~> 1.4) - process-metrics (0.2.1) - console (~> 1.8) - samovar (~> 2.1) - protocol-hpack (1.4.2) - protocol-http (0.22.5) - protocol-http1 (0.14.1) - protocol-http (~> 0.22) - protocol-http2 (0.14.2) - protocol-hpack (~> 1.4) - protocol-http (~> 0.18) public_suffix (4.0.6) - puma (5.4.0) + puma (5.5.2) nio4r (~> 2.0) - puma (5.4.0-java) + puma (5.5.2-java) nio4r (~> 2.0) - racc (1.5.2) - racc (1.5.2-java) + racc (1.6.0) + racc (1.6.0-java) rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.1) + rails-html-sanitizer (1.4.2) loofah (~> 2.3) - railties (6.1.4.1) - actionpack (= 6.1.4.1) - activesupport (= 6.1.4.1) + railties (7.0.1) + actionpack (= 7.0.1) + activesupport (= 7.0.1) method_source - rake (>= 0.13) + rake (>= 12.2) thor (~> 1.0) + zeitwerk (~> 2.5) rake (13.0.6) - redis (4.4.0) - redis-actionpack (5.2.0) - actionpack (>= 5, < 7) - redis-rack (>= 2.1.0, < 3) - redis-store (>= 1.1.0, < 2) - redis-activesupport (5.2.1) - activesupport (>= 3, < 7) - redis-store (>= 1.3, < 2) + redis (4.5.1) redis-rack (2.1.3) rack (>= 2.0.8, < 3) redis-store (>= 1.2, < 2) - redis-rails (5.0.2) - redis-actionpack (>= 5.0, < 6) - redis-activesupport (>= 5.0, < 6) - redis-store (>= 1.2, < 2) redis-store (1.9.0) redis (>= 4, < 5) - samovar (2.1.4) - console (~> 1.0) - mapping (~> 1.0) simple_oauth (0.3.1) - thor (1.1.0) + thor (1.2.1) thread_safe (0.3.6) thread_safe (0.3.6-java) - timers (4.3.3) twitter (7.0.0) addressable (~> 2.3) buftok (~> 0.2.0) @@ -185,9 +150,8 @@ unf (0.1.4) unf_ext unf (0.1.4-java) - unf_ext (0.0.7.7) - unf_ext (0.0.7.7-x86-mingw32) - zeitwerk (2.4.2) + unf_ext (0.0.8) + zeitwerk (2.5.3) PLATFORMS java @@ -195,17 +159,18 @@ x86-mingw32 DEPENDENCIES - actionpack (~> 6.1.0) - actionview (~> 6.1.0) - falcon + actionpack (~> 7.0.1) + actionview (~> 7.0.1) newrelic_rpm puma - railties (~> 6.1.0) + railties (~> 7.0.1) redis - redis-rails + redis-actionpack! + redis-activesupport! + redis-rails! redis-store twitter twitter-text BUNDLED WITH - 2.1.4 + 2.3.3 diff -r fefe9b0a603d -r ad6264cca788 app/views/tweets/_tweet.html.erb --- a/app/views/tweets/_tweet.html.erb Sat Aug 21 20:46:52 2021 +0900 +++ b/app/views/tweets/_tweet.html.erb Sat Jan 15 02:39:53 2022 +0900 @@ -9,7 +9,7 @@ <% else%> <% if defined?(with_time) && with_time %>

- Originally tweeted at <%= tweet.created_at.to_s :rfc822 %> + Originally tweeted at <%= tweet.created_at.rfc822 %>

<% end %> diff -r fefe9b0a603d -r ad6264cca788 bin/rails --- a/bin/rails Sat Aug 21 20:46:52 2021 +0900 +++ b/bin/rails Sat Jan 15 02:39:53 2022 +0900 @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../config/application', __dir__) +APP_PATH = File.expand_path("../config/application", __dir__) require_relative "../config/boot" require "rails/commands" diff -r fefe9b0a603d -r ad6264cca788 bin/setup --- a/bin/setup Sat Aug 21 20:46:52 2021 +0900 +++ b/bin/setup Sat Jan 15 02:39:53 2022 +0900 @@ -2,7 +2,7 @@ require "fileutils" # path to your application root. -APP_ROOT = File.expand_path('..', __dir__) +APP_ROOT = File.expand_path("..", __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") @@ -13,13 +13,13 @@ # This script is idempotent, so that you can run it at any time and get an expectable outcome. # Add necessary setup steps to this file. - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' + system! "bin/rails log:clear tmp:clear" puts "\n== Restarting application server ==" - system! 'bin/rails restart' + system! "bin/rails restart" end diff -r fefe9b0a603d -r ad6264cca788 config/application.rb --- a/config/application.rb Sat Aug 21 20:46:52 2021 +0900 +++ b/config/application.rb Sat Jan 15 02:39:53 2022 +0900 @@ -25,7 +25,7 @@ module Rsstweet class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.1 + config.load_defaults 7.0 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading diff -r fefe9b0a603d -r ad6264cca788 config/boot.rb --- a/config/boot.rb Sat Aug 21 20:46:52 2021 +0900 +++ b/config/boot.rb Sat Jan 15 02:39:53 2022 +0900 @@ -1,3 +1,3 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. diff -r fefe9b0a603d -r ad6264cca788 config/environments/development.rb --- a/config/environments/development.rb Sat Aug 21 20:46:52 2021 +0900 +++ b/config/environments/development.rb Sat Jan 15 02:39:53 2022 +0900 @@ -14,15 +14,18 @@ # Show full error reports. config.consider_all_requests_local = true + # Enable server timing + config.server_timing = 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? + if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true config.cache_store = :memory_store config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{2.days.to_i}" + "Cache-Control" => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false @@ -46,10 +49,6 @@ # Annotate rendered view with file names. # config.action_view.annotate_rendered_view_with_filenames = true - # Use an evented file watcher to asynchronously detect changes in source code, - # routes, locales, etc. This feature depends on the listen gem. - # config.file_watcher = ActiveSupport::EventedFileUpdateChecker - # Uncomment if you wish to allow Action Cable access from any origin. # config.action_cable.disable_request_forgery_protection = true end diff -r fefe9b0a603d -r ad6264cca788 config/environments/production.rb --- a/config/environments/production.rb Sat Aug 21 20:46:52 2021 +0900 +++ b/config/environments/production.rb Sat Jan 15 02:39:53 2022 +0900 @@ -22,14 +22,14 @@ # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.asset_host = 'http://assets.example.com' + # config.asset_host = "http://assets.example.com" # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true @@ -52,46 +52,19 @@ # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Log disallowed deprecations. - config.active_support.disallowed_deprecation = :log - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] + # Don't log any deprecations. + config.active_support.report_deprecations = false # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new # Use a different logger for distributed setups. # require "syslog/logger" - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end - - # Inserts middleware to perform automatic connection switching. - # The `database_selector` hash is used to pass options to the DatabaseSelector - # middleware. The `delay` is used to determine how long to wait after a write - # to send a subsequent read to the primary. - # - # The `database_resolver` class is used by the middleware to determine which - # database is appropriate to use based on the time delay. - # - # The `database_resolver_context` class is used by the middleware to set - # timestamps for the last write to the primary. The resolver uses the context - # class timestamps to determine how long to wait before reading from the - # replica. - # - # By default Rails will store a last write timestamp in the session. The - # DatabaseSelector middleware is designed as such you can define your own - # strategy for connection switching and pass that into the middleware through - # these configuration options. - # config.active_record.database_selector = { delay: 2.seconds } - # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver - # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session end diff -r fefe9b0a603d -r ad6264cca788 config/environments/test.rb --- a/config/environments/test.rb Sat Aug 21 20:46:52 2021 +0900 +++ b/config/environments/test.rb Sat Jan 15 02:39:53 2022 +0900 @@ -8,17 +8,18 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. + # Turn false under Spring and add config.action_view.cache_template_loading = true. config.cache_classes = true - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = false + # Eager loading loads your whole application. When running a single test locally, + # this probably isn't necessary. It's a good idea to do in a continuous integration + # system, or in some way before deploying your code. + config.eager_load = ENV["CI"].present? # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{1.hour.to_i}" + "Cache-Control" => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. diff -r fefe9b0a603d -r ad6264cca788 config/initializers/assets.rb --- a/config/initializers/assets.rb Sat Aug 21 20:46:52 2021 +0900 +++ b/config/initializers/assets.rb Sat Jan 15 02:39:53 2022 +0900 @@ -1,7 +1,7 @@ # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. -# Rails.application.config.assets.version = '1.0' +# Rails.application.config.assets.version = "1.0" # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path diff -r fefe9b0a603d -r ad6264cca788 config/initializers/content_security_policy.rb --- a/config/initializers/content_security_policy.rb Sat Aug 21 20:46:52 2021 +0900 +++ b/config/initializers/content_security_policy.rb Sat Jan 15 02:39:53 2022 +0900 @@ -4,25 +4,23 @@ # For further information see the following documentation # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy -# Rails.application.config.content_security_policy do |policy| -# policy.default_src :self, :https -# policy.font_src :self, :https, :data -# policy.img_src :self, :https, :data -# policy.object_src :none -# policy.script_src :self, :https -# policy.style_src :self, :https - -# # Specify URI for violation reports -# # policy.report_uri "/csp-violation-report-endpoint" +# Rails.application.configure do +# config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end +# +# # Generate session nonces for permitted importmap and inline scripts +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src) +# +# # Report CSP violations to a specified URI. See: +# # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only +# # config.content_security_policy_report_only = true # end - -# If you are using UJS then enable automatic nonce generation -# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } - -# Set the nonce only to specific directives -# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) - -# Report CSP violations to a specified URI -# For further information see the following documentation: -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only -# Rails.application.config.content_security_policy_report_only = true diff -r fefe9b0a603d -r ad6264cca788 config/initializers/inflections.rb --- a/config/initializers/inflections.rb Sat Aug 21 20:46:52 2021 +0900 +++ b/config/initializers/inflections.rb Sat Jan 15 02:39:53 2022 +0900 @@ -4,13 +4,13 @@ # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' +# inflect.acronym "RESTful" # end