Skip to content

Commit 77bfb0d

Browse files
committed
rails app:update
1 parent bb64c8b commit 77bfb0d

17 files changed

+271
-41
lines changed

bin/brakeman

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env ruby
2+
require "rubygems"
3+
require "bundler/setup"
4+
5+
ARGV.unshift("--ensure-latest")
6+
7+
load Gem.bin_path("brakeman", "brakeman")

bin/rubocop

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env ruby
2+
require "rubygems"
3+
require "bundler/setup"
4+
5+
# explicit rubocop config increases performance slightly while avoiding config confusion.
6+
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
7+
8+
load Gem.bin_path("rubocop", "rubocop")

bin/setup

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env ruby
22
require "fileutils"
33

4-
# path to your application root.
54
APP_ROOT = File.expand_path("..", __dir__)
5+
APP_NAME = "blade-ruby-lang-org"
66

77
def system!(*args)
88
system(*args, exception: true)
@@ -30,4 +30,8 @@ FileUtils.chdir APP_ROOT do
3030

3131
puts "\n== Restarting application server =="
3232
system! "bin/rails restart"
33+
34+
# puts "\n== Configuring puma-dev =="
35+
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
36+
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
3337
end

config/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Application < Rails::Application
1414
# Please, add to the `ignore` list any other `lib` subdirectories that do
1515
# not contain `.rb` files, or that should not be reloaded or eager loaded.
1616
# Common ones are `templates`, `generators`, or `middleware`, for example.
17-
config.autoload_lib(ignore: %w(assets tasks))
17+
config.autoload_lib(ignore: %w[assets tasks])
1818

1919
# Configuration for the application, engines, and railties goes here.
2020
#

config/environments/development.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Show full error reports.
1515
config.consider_all_requests_local = true
1616

17-
# Enable server timing
17+
# Enable server timing.
1818
config.server_timing = true
1919

2020
# Enable/disable caching. By default caching is disabled.
@@ -24,9 +24,7 @@
2424
config.action_controller.enable_fragment_cache_logging = true
2525

2626
config.cache_store = :memory_store
27-
config.public_file_server.headers = {
28-
"Cache-Control" => "public, max-age=#{2.days.to_i}"
29-
}
27+
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
3028
else
3129
config.action_controller.perform_caching = false
3230

@@ -39,8 +37,12 @@
3937
# Don't care if the mailer can't send.
4038
config.action_mailer.raise_delivery_errors = false
4139

40+
# Disable caching for Action Mailer templates even if Action Controller
41+
# caching is enabled.
4242
config.action_mailer.perform_caching = false
4343

44+
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
45+
4446
# Print deprecation notices to the Rails logger.
4547
config.active_support.deprecation = :log
4648

@@ -66,11 +68,14 @@
6668
# config.i18n.raise_on_missing_translations = true
6769

6870
# Annotate rendered view with file names.
69-
# config.action_view.annotate_rendered_view_with_filenames = true
71+
config.action_view.annotate_rendered_view_with_filenames = true
7072

7173
# Uncomment if you wish to allow Action Cable access from any origin.
7274
# config.action_cable.disable_request_forgery_protection = true
7375

74-
# Raise error when a before_action's only/except options reference missing actions
76+
# Raise error when a before_action's only/except options reference missing actions.
7577
config.action_controller.raise_on_missing_callback_actions = true
78+
79+
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
80+
# config.generators.apply_rubocop_autocorrect_after_generate!
7681
end

config/environments/production.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
5252
config.force_ssl = true
5353

54+
# Skip http-to-https redirect for the default health check endpoint.
55+
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
56+
5457
# Log to STDOUT by default
5558
config.logger = ActiveSupport::Logger.new(STDOUT)
5659
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
@@ -71,6 +74,8 @@
7174
# config.active_job.queue_adapter = :resque
7275
# config.active_job.queue_name_prefix = "blade_ruby_lang_org_production"
7376

77+
# Disable caching for Action Mailer templates even if Action Controller
78+
# caching is enabled.
7479
config.action_mailer.perform_caching = false
7580

7681
# Ignore bad email addresses and do not raise email delivery errors.
@@ -87,6 +92,9 @@
8792
# Do not dump schema after migrations.
8893
config.active_record.dump_schema_after_migration = false
8994

95+
# Only use :id for inspections in production.
96+
config.active_record.attributes_for_inspect = [ :id ]
97+
9098
# Enable DNS rebinding protection and other `Host` header attacks.
9199
# config.hosts = [
92100
# "example.com", # Allow requests from example.com

config/environments/test.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
config.eager_load = ENV["CI"].present?
1919

2020
# Configure public file server for tests with Cache-Control for performance.
21-
config.public_file_server.enabled = true
22-
config.public_file_server.headers = {
23-
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
24-
}
21+
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" }
2522

2623
# Show full error reports and disable caching.
2724
config.consider_all_requests_local = true
@@ -37,13 +34,19 @@
3734
# Store uploaded files on the local file system in a temporary directory.
3835
config.active_storage.service = :test
3936

37+
# Disable caching for Action Mailer templates even if Action Controller
38+
# caching is enabled.
4039
config.action_mailer.perform_caching = false
4140

4241
# Tell Action Mailer not to deliver emails to the real world.
4342
# The :test delivery method accumulates sent emails in the
4443
# ActionMailer::Base.deliveries array.
4544
config.action_mailer.delivery_method = :test
4645

46+
# Unlike controllers, the mailer instance doesn't have any context about the
47+
# incoming request so you'll need to provide the :host parameter yourself.
48+
config.action_mailer.default_url_options = { host: "www.example.com" }
49+
4750
# Print deprecation notices to the stderr.
4851
config.active_support.deprecation = :stderr
4952

@@ -59,6 +62,6 @@
5962
# Annotate rendered view with file names.
6063
# config.action_view.annotate_rendered_view_with_filenames = true
6164

62-
# Raise error when a before_action's only/except options reference missing actions
65+
# Raise error when a before_action's only/except options reference missing actions.
6366
config.action_controller.raise_on_missing_callback_actions = true
6467
end

config/initializers/assets.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
# Precompile additional assets.
1010
# application.js, application.css, and all non-JS/CSS in the app/assets
1111
# folder are already added.
12-
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
12+
# Rails.application.config.assets.precompile += %w[ admin.js admin.css ]

config/initializers/filter_parameter_logging.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# Use this to limit dissemination of sensitive information.
55
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
66
Rails.application.config.filter_parameters += [
7-
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
7+
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
88
]
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Be sure to restart your server when you modify this file.
2+
#
3+
# This file eases your Rails 7.2 framework defaults upgrade.
4+
#
5+
# Uncomment each configuration one by one to switch to the new default.
6+
# Once your application is ready to run with all new defaults, you can remove
7+
# this file and set the `config.load_defaults` to `7.2`.
8+
#
9+
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
10+
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
11+
12+
###
13+
# Controls whether Active Job's `#perform_later` and similar methods automatically defer
14+
# the job queuing to after the current Active Record transaction is committed.
15+
#
16+
# Example:
17+
# Topic.transaction do
18+
# topic = Topic.create(...)
19+
# NewTopicNotificationJob.perform_later(topic)
20+
# end
21+
#
22+
# In this example, if the configuration is set to `:never`, the job will
23+
# be enqueued immediately, even though the `Topic` hasn't been committed yet.
24+
# Because of this, if the job is picked up almost immediately, or if the
25+
# transaction doesn't succeed for some reason, the job will fail to find this
26+
# topic in the database.
27+
#
28+
# If `enqueue_after_transaction_commit` is set to `:default`, the queue adapter
29+
# will define the behaviour.
30+
#
31+
# Note: Active Job backends can disable this feature. This is generally done by
32+
# backends that use the same database as Active Record as a queue, hence they
33+
# don't need this feature.
34+
#++
35+
# Rails.application.config.active_job.enqueue_after_transaction_commit = :default
36+
37+
###
38+
# Adds image/webp to the list of content types Active Storage considers as an image
39+
# Prevents automatic conversion to a fallback PNG, and assumes clients support WebP, as they support gif, jpeg, and png.
40+
# This is possible due to broad browser support for WebP, but older browsers and email clients may still not support
41+
# WebP. Requires imagemagick/libvips built with WebP support.
42+
#++
43+
# Rails.application.config.active_storage.web_image_content_types = %w[image/png image/jpeg image/gif image/webp]
44+
45+
###
46+
# Enable validation of migration timestamps. When set, an ActiveRecord::InvalidMigrationTimestampError
47+
# will be raised if the timestamp prefix for a migration is more than a day ahead of the timestamp
48+
# associated with the current time. This is done to prevent forward-dating of migration files, which can
49+
# impact migration generation and other migration commands.
50+
#
51+
# Applications with existing timestamped migrations that do not adhere to the
52+
# expected format can disable validation by setting this config to `false`.
53+
#++
54+
# Rails.application.config.active_record.validate_migration_timestamps = true
55+
56+
###
57+
# Controls whether the PostgresqlAdapter should decode dates automatically with manual queries.
58+
#
59+
# Example:
60+
# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date") #=> Date
61+
#
62+
# This query used to return a `String`.
63+
#++
64+
# Rails.application.config.active_record.postgresql_adapter_decode_dates = true
65+
66+
###
67+
# Enables YJIT as of Ruby 3.3, to bring sizeable performance improvements. If you are
68+
# deploying to a memory constrained environment you may want to set this to `false`.
69+
#++
70+
# Rails.application.config.yjit = true

0 commit comments

Comments
 (0)