From d02eb2c28ae585a7704ae86e43ab60965f6535de Mon Sep 17 00:00:00 2001 From: Martin Emde Date: Sun, 1 Dec 2024 13:32:59 -0800 Subject: [PATCH] rails app:update and reconcile differences manually --- config/application.rb | 2 +- config/environments/development.rb | 7 +- config/environments/production.rb | 28 ++++---- config/environments/test.rb | 8 ++- .../new_framework_defaults_7_2.rb | 70 ------------------- config/puma.rb | 3 + public/400.html | 21 ++++++ public/403.html | 2 +- public/406-unsupported-browser.html | 21 ++++++ 9 files changed, 69 insertions(+), 93 deletions(-) delete mode 100644 config/initializers/new_framework_defaults_7_2.rb create mode 100644 public/400.html create mode 100644 public/406-unsupported-browser.html diff --git a/config/application.rb b/config/application.rb index 1328ecd5bd4..19fd1133bfb 100644 --- a/config/application.rb +++ b/config/application.rb @@ -27,7 +27,7 @@ module Gemcutter class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 7.1 + config.load_defaults 8.0 # Please, add to the `ignore` list any other `lib` subdirectories that do # not contain `.rb` files, or that should not be reloaded or eager loaded. diff --git a/config/environments/development.rb b/config/environments/development.rb index 2384e1ee68d..b053a1c3781 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -17,8 +17,8 @@ # Enable server timing. config.server_timing = true - # Enable/disable caching. By default caching is disabled. - # Run rails dev:cache to toggle caching. + # Enable/disable Action Controller caching. By default Action Controller caching is disabled. + # Run rails dev:cache to toggle Action Controller caching. if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true @@ -60,6 +60,9 @@ # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true + # Append comments with runtime information tags to SQL queries in logs. + config.active_record.query_log_tags_enabled = true + # Highlight code that enqueued background job in logs. config.active_job.verbose_enqueue_logs = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 8d95758ee47..cc1793880ae 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -6,14 +6,13 @@ # Code is not reloaded between requests. config.enable_reloading = false - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. + # Eager load code on boot for better performance and memory savings (ignored by Rake tasks). config.eager_load = true - # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false + # Full error reports are disabled. + config.consider_all_requests_local = false + + # Turn on fragment caching in view templates. config.action_controller.perform_caching = true # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment @@ -66,7 +65,10 @@ # want to log everything, set the level to "debug". config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") - # Use a different cache store in production. + # Don't log any deprecations. + config.active_support.report_deprecations = false + + # Replace the default in-process memory cache store with a durable alternative. # config.cache_store = :mem_cache_store # Use a real queuing backend for Active Job (and separate queues per environment). @@ -90,18 +92,12 @@ # 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 = [] - # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + # Only use :id for inspections in production. + config.active_record.attributes_for_inspect = [:id] + # Enable DNS rebinding protection and other `Host` header attacks. # config.hosts = [ # "example.com", # Allow requests from example.com diff --git a/config/environments/test.rb b/config/environments/test.rb index a65ac8280f1..3339774d871 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -23,12 +23,14 @@ "Cache-Control" => "public, max-age=#{1.hour.to_i}" } - # Show full error reports and disable caching. - config.consider_all_requests_local = true + # Show full error reports. + config.consider_all_requests_local = true config.action_controller.perform_caching = false config.cache_store = :mem_cache_store - # Raise exceptions instead of rendering exception templates. + # Render exception templates for rescuable exceptions and raise for other exceptions. + # config.action_dispatch.show_exceptions = :rescuable + # Using this setting seems broken in rails 8.0, causing the debug template to render in system tests. config.action_dispatch.show_exceptions = :none # Disable request forgery protection in test environment. diff --git a/config/initializers/new_framework_defaults_7_2.rb b/config/initializers/new_framework_defaults_7_2.rb deleted file mode 100644 index b549c4a258a..00000000000 --- a/config/initializers/new_framework_defaults_7_2.rb +++ /dev/null @@ -1,70 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file eases your Rails 7.2 framework defaults upgrade. -# -# Uncomment each configuration one by one to switch to the new default. -# Once your application is ready to run with all new defaults, you can remove -# this file and set the `config.load_defaults` to `7.2`. -# -# Read the Guide for Upgrading Ruby on Rails for more info on each option. -# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html - -### -# Controls whether Active Job's `#perform_later` and similar methods automatically defer -# the job queuing to after the current Active Record transaction is committed. -# -# Example: -# Topic.transaction do -# topic = Topic.create(...) -# NewTopicNotificationJob.perform_later(topic) -# end -# -# In this example, if the configuration is set to `:never`, the job will -# be enqueued immediately, even though the `Topic` hasn't been committed yet. -# Because of this, if the job is picked up almost immediately, or if the -# transaction doesn't succeed for some reason, the job will fail to find this -# topic in the database. -# -# If `enqueue_after_transaction_commit` is set to `:default`, the queue adapter -# will define the behaviour. -# -# Note: Active Job backends can disable this feature. This is generally done by -# backends that use the same database as Active Record as a queue, hence they -# don't need this feature. -#++ -# Rails.application.config.active_job.enqueue_after_transaction_commit = :default - -### -# Adds image/webp to the list of content types Active Storage considers as an image -# Prevents automatic conversion to a fallback PNG, and assumes clients support WebP, as they support gif, jpeg, and png. -# This is possible due to broad browser support for WebP, but older browsers and email clients may still not support -# WebP. Requires imagemagick/libvips built with WebP support. -#++ -# Rails.application.config.active_storage.web_image_content_types = %w[image/png image/jpeg image/gif image/webp] - -### -# Enable validation of migration timestamps. When set, an ActiveRecord::InvalidMigrationTimestampError -# will be raised if the timestamp prefix for a migration is more than a day ahead of the timestamp -# associated with the current time. This is done to prevent forward-dating of migration files, which can -# impact migration generation and other migration commands. -# -# Applications with existing timestamped migrations that do not adhere to the -# expected format can disable validation by setting this config to `false`. -#++ -# Rails.application.config.active_record.validate_migration_timestamps = true - -### -# Controls whether the PostgresqlAdapter should decode dates automatically with manual queries. -# -# Example: -# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date") #=> Date -# -# This query used to return a `String`. -#++ -# Rails.application.config.active_record.postgresql_adapter_decode_dates = true - -### -# Enables YJIT as of Ruby 3.3, to bring sizeable performance improvements. If you are -# deploying to a memory constrained environment you may want to set this to `false`. -#++ -# Rails.application.config.yjit = true diff --git a/config/puma.rb b/config/puma.rb index 06bcbfdb6d8..d26a113096b 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -48,6 +48,9 @@ # Specifies the `port` that Puma will listen on to receive requests; default is 3000. port ENV.fetch("PORT", 3000) +# Allow puma to be restarted by `bin/rails restart` command. +plugin :tmp_restart + # Specifies the `environment` that Puma will run in. environment rails_env diff --git a/public/400.html b/public/400.html new file mode 100644 index 00000000000..c2429c9a983 --- /dev/null +++ b/public/400.html @@ -0,0 +1,21 @@ + + + + + + + Client Error | RubyGems.org + + +
+
+ 400 error +
+
+

Client Error

+

Please check the request and try again.

+ Back to RubyGems.org → +
+
+ + diff --git a/public/403.html b/public/403.html index 4c6bb6bc39b..880f163855a 100644 --- a/public/403.html +++ b/public/403.html @@ -9,7 +9,7 @@
- 422 error + 403 error

Forbidden.

diff --git a/public/406-unsupported-browser.html b/public/406-unsupported-browser.html new file mode 100644 index 00000000000..be957625ecb --- /dev/null +++ b/public/406-unsupported-browser.html @@ -0,0 +1,21 @@ + + + + + + + Browser Not Supported | RubyGems.org + + +
+
+ 403 error +
+
+

Browser Not Supported

+

Please upgrade your browser to continue.

+ Back to RubyGems.org → +
+
+ +