Skip to content

Commit

Permalink
rails app:update, framework defaults = 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
martinemde committed Dec 10, 2024
1 parent db70bce commit 86b4889
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 106 deletions.
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 7.2

# 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.
Expand Down
7 changes: 5 additions & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
30 changes: 13 additions & 17 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
require "active_support/core_ext/integer/time"
require_relative "../../lib/gemcutter/middleware/redirector"

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# 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
Expand Down Expand Up @@ -66,7 +66,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).
Expand All @@ -90,18 +93,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
Expand All @@ -119,6 +116,5 @@
value_max_bytes: 2_097_152 # 2MB
}

require_relative "../../lib/gemcutter/middleware/redirector"
config.middleware.use Gemcutter::Middleware::Redirector
end
36 changes: 24 additions & 12 deletions config/environments/staging.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require Rails.root.join("config", "secret") if Rails.root.join("config", "secret.rb").file?
require "active_support/core_ext/integer/time"
require_relative "../../lib/gemcutter/middleware/redirector"

Rails.application.configure do
Expand All @@ -7,14 +8,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

# Attempt to read encrypted secrets from `config/secrets.yml.enc`.
Expand Down Expand Up @@ -58,21 +58,32 @@

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = ENV['RAILS_LOG_LEVEL'].present? ? ENV['RAILS_LOG_LEVEL'].to_sym : :info
$stdout.sync = true
config.rails_semantic_logger.format = :json
config.rails_semantic_logger.semantic = true
config.rails_semantic_logger.add_file_appender = false
SemanticLogger.add_appender(io: $stdout, formatter: :json)
config.semantic_logger.add_appender(io: $stdout, formatter: config.rails_semantic_logger.format)

# Prepend all log lines with the following tags.
# config.log_tags = [ :request_id ]

# "info" includes generic and useful information about system operation, but avoids logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
# want to log everything, set the level to "debug".
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")

# Don't log any deprecations.
config.active_support.report_deprecations = false

# Use a different cache store in production.
# config.cache_store = :mem_cache_store

# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "gemcutter_#{Rails.env}"

# Disable caching for Action Mailer templates even if Action Controller
# caching is enabled.
config.action_mailer.perform_caching = false

# Ignore bad email addresses and do not raise email delivery errors.
Expand All @@ -83,16 +94,17 @@

# roadie-rails recommends not setting action_mailer.asset_host and use its own configuration for URL options
config.roadie.url_options = { host: Gemcutter::HOST, scheme: Gemcutter::PROTOCOL }

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = [:en]

# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
config.i18n.fallbacks = true

# 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]

config.cache_store = :mem_cache_store, ENV['MEMCACHED_ENDPOINT'], {
failover: true,
socket_timeout: 1.5,
Expand Down
8 changes: 5 additions & 3 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
70 changes: 0 additions & 70 deletions config/initializers/new_framework_defaults_7_2.rb

This file was deleted.

30 changes: 30 additions & 0 deletions config/initializers/new_framework_defaults_8_0.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 8.0 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 `8.0`.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html

###
# Specifies whether `to_time` methods preserve the UTC offset of their receivers or preserves the timezone.
# If set to `:zone`, `to_time` methods will use the timezone of their receivers.
# If set to `:offset`, `to_time` methods will use the UTC offset.
# If `false`, `to_time` methods will convert to the local system UTC offset instead.
#++
# Rails.application.config.active_support.to_time_preserves_timezone = :zone

###
# When both `If-Modified-Since` and `If-None-Match` are provided by the client
# only consider `If-None-Match` as specified by RFC 7232 Section 6.
# If set to `false` both conditions need to be satisfied.
#++
# Rails.application.config.action_dispatch.strict_freshness = true

###
# Set `Regexp.timeout` to `1`s by default to improve security over Regexp Denial-of-Service attacks.
#++
# Regexp.timeout = 1
21 changes: 21 additions & 0 deletions public/400.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link href="/stylesheets/static.css" rel='stylesheet' type='text/css'>
<title>Client Error | RubyGems.org</title>
</head>
<body>
<div class="wrapper">
<div class="image__wrapper">
<img height="530" alt="400 error" src="/images/sea_level.svg">
</div>
<div class="content">
<h1>Client Error</h1>
<p>Please check the request and try again.</p>
<a href="/">Back to RubyGems.org →</a>
</div>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion public/403.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<body>
<div class="wrapper">
<div class="image__wrapper">
<img height="530" alt="422 error" src="/images/sea_level.svg">
<img height="530" alt="403 error" src="/images/sea_level.svg">
</div>
<div class="content">
<h1>Forbidden.</h1>
Expand Down
21 changes: 21 additions & 0 deletions public/406-unsupported-browser.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link href="/stylesheets/static.css" rel='stylesheet' type='text/css'>
<title>Browser Not Supported | RubyGems.org</title>
</head>
<body>
<div class="wrapper">
<div class="image__wrapper">
<img height="530" alt="403 error" src="/images/sea_level.svg">
</div>
<div class="content">
<h1>Browser Not Supported</h1>
<p>Please upgrade your browser to continue.</p>
<a href="/">Back to RubyGems.org →</a>
</div>
</div>
</body>
</html>

0 comments on commit 86b4889

Please sign in to comment.