railties 7.0.10 → 7.1.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +565 -234
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.md +99 -0
- data/README.rdoc +4 -4
- data/lib/minitest/rails_plugin.rb +63 -0
- data/lib/rails/api/task.rb +35 -4
- data/lib/rails/app_updater.rb +1 -1
- data/lib/rails/application/bootstrap.rb +12 -3
- data/lib/rails/application/configuration.rb +179 -67
- data/lib/rails/application/default_middleware_stack.rb +8 -2
- data/lib/rails/application/dummy_config.rb +19 -0
- data/lib/rails/application/finisher.rb +40 -33
- data/lib/rails/application.rb +116 -31
- data/lib/rails/backtrace_cleaner.rb +1 -1
- data/lib/rails/cli.rb +5 -2
- data/lib/rails/command/actions.rb +10 -12
- data/lib/rails/command/base.rb +55 -53
- data/lib/rails/command/environment_argument.rb +32 -16
- data/lib/rails/command/helpers/editor.rb +17 -12
- data/lib/rails/command.rb +84 -33
- data/lib/rails/commands/about/about_command.rb +14 -0
- data/lib/rails/commands/application/application_command.rb +2 -0
- data/lib/rails/commands/console/console_command.rb +14 -14
- data/lib/rails/commands/credentials/USAGE +53 -55
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +5 -3
- data/lib/rails/commands/credentials/credentials_command.rb +64 -70
- data/lib/rails/commands/db/system/change/change_command.rb +2 -1
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +25 -115
- data/lib/rails/commands/destroy/destroy_command.rb +3 -2
- data/lib/rails/commands/dev/dev_command.rb +1 -6
- data/lib/rails/commands/encrypted/USAGE +15 -20
- data/lib/rails/commands/encrypted/encrypted_command.rb +46 -35
- data/lib/rails/commands/gem_help/USAGE +16 -0
- data/lib/rails/commands/gem_help/gem_help_command.rb +13 -0
- data/lib/rails/commands/generate/generate_command.rb +2 -2
- data/lib/rails/commands/help/USAGE +13 -13
- data/lib/rails/commands/help/help_command.rb +21 -2
- data/lib/rails/commands/initializers/initializers_command.rb +1 -4
- data/lib/rails/commands/middleware/middleware_command.rb +17 -0
- data/lib/rails/commands/new/new_command.rb +2 -0
- data/lib/rails/commands/notes/notes_command.rb +2 -1
- data/lib/rails/commands/plugin/plugin_command.rb +2 -0
- data/lib/rails/commands/rake/rake_command.rb +25 -22
- data/lib/rails/commands/restart/restart_command.rb +14 -0
- data/lib/rails/commands/routes/routes_command.rb +13 -1
- data/lib/rails/commands/runner/USAGE +14 -12
- data/lib/rails/commands/runner/runner_command.rb +32 -20
- data/lib/rails/commands/secret/secret_command.rb +13 -0
- data/lib/rails/commands/secrets/USAGE +44 -49
- data/lib/rails/commands/secrets/secrets_command.rb +19 -38
- data/lib/rails/commands/server/server_command.rb +32 -31
- data/lib/rails/commands/test/USAGE +14 -0
- data/lib/rails/commands/test/test_command.rb +56 -14
- data/lib/rails/commands/unused_routes/unused_routes_command.rb +75 -0
- data/lib/rails/commands/version/version_command.rb +1 -0
- data/lib/rails/configuration.rb +5 -5
- data/lib/rails/console/app.rb +1 -4
- data/lib/rails/deprecator.rb +7 -0
- data/lib/rails/engine/configuration.rb +5 -0
- data/lib/rails/engine.rb +36 -16
- data/lib/rails/gem_version.rb +4 -4
- data/lib/rails/generators/actions.rb +6 -15
- data/lib/rails/generators/active_model.rb +14 -28
- data/lib/rails/generators/app_base.rb +353 -82
- data/lib/rails/generators/app_name.rb +3 -14
- data/lib/rails/generators/base.rb +17 -9
- data/lib/rails/generators/database.rb +19 -1
- data/lib/rails/generators/erb/mailer/templates/layout.html.erb.tt +1 -1
- data/lib/rails/generators/generated_attribute.rb +2 -1
- data/lib/rails/generators/migration.rb +1 -2
- data/lib/rails/generators/model_helpers.rb +2 -1
- data/lib/rails/generators/rails/app/USAGE +15 -6
- data/lib/rails/generators/rails/app/app_generator.rb +84 -60
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +107 -0
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +9 -11
- data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +10 -1
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +4 -17
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +0 -2
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +59 -0
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +10 -2
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +28 -24
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +11 -7
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +2 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt +223 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +11 -9
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +11 -13
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +10 -19
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +4 -0
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +6 -4
- data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +10 -0
- data/lib/rails/generators/rails/app/templates/dockerignore.tt +43 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +1 -9
- data/lib/rails/generators/rails/app/templates/node-version.tt +1 -0
- data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +10 -8
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +9 -7
- data/lib/rails/generators/rails/application_record/application_record_generator.rb +4 -0
- data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +2 -1
- data/lib/rails/generators/rails/controller/USAGE +12 -4
- data/lib/rails/generators/rails/controller/controller_generator.rb +5 -0
- data/lib/rails/generators/rails/controller/templates/controller.rb.tt +1 -1
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +29 -24
- data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +8 -0
- data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -2
- data/lib/rails/generators/rails/migration/USAGE +21 -11
- data/lib/rails/generators/rails/model/model_generator.rb +4 -0
- data/lib/rails/generators/rails/plugin/USAGE +17 -6
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +5 -15
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +1 -17
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +0 -2
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +4 -4
- data/lib/rails/generators/rails/resource/resource_generator.rb +6 -0
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +2 -1
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +1 -1
- data/lib/rails/generators/test_case.rb +2 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +1 -1
- data/lib/rails/generators/testing/{behaviour.rb → behavior.rb} +4 -1
- data/lib/rails/generators.rb +6 -14
- data/lib/rails/health_controller.rb +55 -0
- data/lib/rails/info.rb +1 -1
- data/lib/rails/info_controller.rb +31 -11
- data/lib/rails/mailers_controller.rb +15 -5
- data/lib/rails/rack/logger.rb +15 -12
- data/lib/rails/rackup/server.rb +15 -0
- data/lib/rails/railtie/configuration.rb +14 -1
- data/lib/rails/railtie.rb +18 -18
- data/lib/rails/ruby_version_check.rb +2 -0
- data/lib/rails/source_annotation_extractor.rb +67 -18
- data/lib/rails/tasks/engine.rake +8 -8
- data/lib/rails/tasks/framework.rake +4 -10
- data/lib/rails/tasks/log.rake +1 -1
- data/lib/rails/tasks/misc.rake +3 -14
- data/lib/rails/tasks/statistics.rake +5 -4
- data/lib/rails/tasks/tmp.rake +5 -5
- data/lib/rails/tasks/zeitwerk.rake +1 -1
- data/lib/rails/tasks.rb +0 -2
- data/lib/rails/templates/rails/mailers/email.html.erb +25 -0
- data/lib/rails/templates/rails/mailers/index.html.erb +14 -7
- data/lib/rails/templates/rails/mailers/mailer.html.erb +11 -5
- data/lib/rails/templates/rails/welcome/index.html.erb +1 -0
- data/lib/rails/test_help.rb +7 -7
- data/lib/rails/test_unit/line_filtering.rb +1 -1
- data/lib/rails/test_unit/reporter.rb +6 -2
- data/lib/rails/test_unit/runner.rb +36 -18
- data/lib/rails/test_unit/test_parser.rb +88 -0
- data/lib/rails/test_unit/testing.rake +13 -33
- data/lib/rails/version.rb +1 -1
- data/lib/rails.rb +15 -15
- metadata +69 -31
- data/RDOC_MAIN.rdoc +0 -97
- data/lib/rails/application/dummy_erb_compiler.rb +0 -18
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt +0 -143
- data/lib/rails/generators/rails/model/USAGE +0 -113
- data/lib/rails/tasks/middleware.rake +0 -9
- data/lib/rails/tasks/restart.rake +0 -9
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
source "https://rubygems.org"
|
|
2
|
-
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
3
2
|
|
|
4
|
-
ruby <%= "\"#{
|
|
3
|
+
ruby <%= "\"#{gem_ruby_version}\"" -%>
|
|
5
4
|
|
|
6
5
|
<% gemfile_entries.each do |gemfile_entry| %>
|
|
7
6
|
<%= gemfile_entry %>
|
|
@@ -16,17 +15,12 @@ ruby <%= "\"#{RUBY_VERSION}\"" -%>
|
|
|
16
15
|
<% end -%>
|
|
17
16
|
|
|
18
17
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
|
19
|
-
gem "tzinfo-data", platforms: %i[
|
|
18
|
+
gem "tzinfo-data", platforms: %i[ <%= bundler_windows_platforms %> jruby ]
|
|
20
19
|
<% if depend_on_bootsnap? -%>
|
|
21
20
|
|
|
22
21
|
# Reduces boot times through caching; required in config/boot.rb
|
|
23
22
|
gem "bootsnap", require: false
|
|
24
23
|
<% end -%>
|
|
25
|
-
<% unless skip_sprockets? || options.minimal? -%>
|
|
26
|
-
|
|
27
|
-
# Use Sass to process CSS
|
|
28
|
-
# gem "sassc-rails"
|
|
29
|
-
<% end -%>
|
|
30
24
|
<% unless skip_active_storage? -%>
|
|
31
25
|
|
|
32
26
|
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
|
@@ -34,14 +28,14 @@ gem "bootsnap", require: false
|
|
|
34
28
|
<% end -%>
|
|
35
29
|
<%- if options.api? -%>
|
|
36
30
|
|
|
37
|
-
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin
|
|
31
|
+
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin Ajax possible
|
|
38
32
|
# gem "rack-cors"
|
|
39
33
|
<%- end -%>
|
|
40
34
|
<% if RUBY_ENGINE == "ruby" -%>
|
|
41
35
|
|
|
42
36
|
group :development, :test do
|
|
43
37
|
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
|
44
|
-
gem "debug", platforms: %i[ mri
|
|
38
|
+
gem "debug", platforms: %i[ mri <%= bundler_windows_platforms %> ]
|
|
45
39
|
end
|
|
46
40
|
<% end -%>
|
|
47
41
|
|
|
@@ -56,6 +50,10 @@ group :development do
|
|
|
56
50
|
<%- end -%>
|
|
57
51
|
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
|
|
58
52
|
# gem "spring"
|
|
53
|
+
|
|
54
|
+
<%- if RUBY_VERSION >= "3.1" -%>
|
|
55
|
+
gem "error_highlight", ">= 0.4.0", platforms: [:ruby]
|
|
56
|
+
<%- end -%>
|
|
59
57
|
end
|
|
60
58
|
|
|
61
59
|
<%- if depends_on_system_test? -%>
|
|
@@ -65,6 +63,6 @@ group :test do
|
|
|
65
63
|
gem "selenium-webdriver"
|
|
66
64
|
<%- if RUBY_VERSION < "3.0" -%>
|
|
67
65
|
gem "webdrivers"
|
|
68
|
-
|
|
66
|
+
<% end %>
|
|
69
67
|
end
|
|
70
68
|
<%- end -%>
|
|
@@ -4,7 +4,7 @@ require "fileutils"
|
|
|
4
4
|
APP_ROOT = File.expand_path("..", __dir__)
|
|
5
5
|
|
|
6
6
|
def system!(*args)
|
|
7
|
-
system(*args
|
|
7
|
+
system(*args, exception: true)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
FileUtils.chdir APP_ROOT do
|
|
@@ -15,6 +15,15 @@ FileUtils.chdir APP_ROOT do
|
|
|
15
15
|
puts "== Installing dependencies =="
|
|
16
16
|
system! "gem install bundler --conservative"
|
|
17
17
|
system("bundle check") || system!("bundle install")
|
|
18
|
+
<% if using_node? -%>
|
|
19
|
+
|
|
20
|
+
# Install JavaScript dependencies
|
|
21
|
+
system("yarn check --check-files") || system!("yarn install")
|
|
22
|
+
<% elsif using_bun? -%>
|
|
23
|
+
|
|
24
|
+
# Install JavaScript dependencies
|
|
25
|
+
system!("bun install")
|
|
26
|
+
<% end -%>
|
|
18
27
|
<% unless options.skip_active_record? -%>
|
|
19
28
|
|
|
20
29
|
# puts "\n== Copying sample files =="
|
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
require_relative "boot"
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
require "rails/all"
|
|
5
|
-
<% else -%>
|
|
6
|
-
require "rails"
|
|
7
|
-
# Pick the frameworks you want:
|
|
8
|
-
require "active_model/railtie"
|
|
9
|
-
<%= comment_if :skip_active_job %>require "active_job/railtie"
|
|
10
|
-
<%= comment_if :skip_active_record %>require "active_record/railtie"
|
|
11
|
-
<%= comment_if :skip_active_storage %>require "active_storage/engine"
|
|
12
|
-
require "action_controller/railtie"
|
|
13
|
-
<%= comment_if :skip_action_mailer %>require "action_mailer/railtie"
|
|
14
|
-
<%= comment_if :skip_action_mailbox %>require "action_mailbox/engine"
|
|
15
|
-
<%= comment_if :skip_action_text %>require "action_text/engine"
|
|
16
|
-
require "action_view/railtie"
|
|
17
|
-
<%= comment_if :skip_action_cable %>require "action_cable/engine"
|
|
18
|
-
<%= comment_if :skip_test %>require "rails/test_unit/railtie"
|
|
19
|
-
<% end -%>
|
|
3
|
+
<%= rails_require_statement %>
|
|
20
4
|
|
|
21
5
|
# Require the gems listed in Gemfile, including any gems
|
|
22
6
|
# you've limited to :test, :development, or :production.
|
|
@@ -31,6 +15,9 @@ module <%= app_const_base %>
|
|
|
31
15
|
config.load_defaults Rails::VERSION::STRING.to_f
|
|
32
16
|
<%- end -%>
|
|
33
17
|
|
|
18
|
+
# Please, see https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#config-autoload-lib-ignore.
|
|
19
|
+
config.autoload_lib(ignore: %w(assets tasks))
|
|
20
|
+
|
|
34
21
|
# Configuration for the application, engines, and railties goes here.
|
|
35
22
|
#
|
|
36
23
|
# These settings can be overridden in specific environments using the files
|
|
@@ -10,15 +10,15 @@ default: &default
|
|
|
10
10
|
|
|
11
11
|
development:
|
|
12
12
|
<<: *default
|
|
13
|
-
database:
|
|
13
|
+
database: storage/development.sqlite3
|
|
14
14
|
|
|
15
15
|
# Warning: The database defined as "test" will be erased and
|
|
16
16
|
# re-generated from your development database when you run "rake".
|
|
17
17
|
# Do not set this db to the same as development or production.
|
|
18
18
|
test:
|
|
19
19
|
<<: *default
|
|
20
|
-
database:
|
|
20
|
+
database: storage/test.sqlite3
|
|
21
21
|
|
|
22
22
|
production:
|
|
23
23
|
<<: *default
|
|
24
|
-
database:
|
|
24
|
+
database: storage/production.sqlite3
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
# gem install pg
|
|
5
5
|
# On macOS with Homebrew:
|
|
6
6
|
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
|
|
7
|
-
# On macOS with MacPorts:
|
|
8
|
-
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
|
9
7
|
# On Windows:
|
|
10
8
|
# gem install pg
|
|
11
9
|
# Choose the win32 build.
|
|
@@ -11,15 +11,15 @@ default: &default
|
|
|
11
11
|
|
|
12
12
|
development:
|
|
13
13
|
<<: *default
|
|
14
|
-
database:
|
|
14
|
+
database: storage/development.sqlite3
|
|
15
15
|
|
|
16
16
|
# Warning: The database defined as "test" will be erased and
|
|
17
17
|
# re-generated from your development database when you run "rake".
|
|
18
18
|
# Do not set this db to the same as development or production.
|
|
19
19
|
test:
|
|
20
20
|
<<: *default
|
|
21
|
-
database:
|
|
21
|
+
database: storage/test.sqlite3
|
|
22
22
|
|
|
23
23
|
production:
|
|
24
24
|
<<: *default
|
|
25
|
-
database:
|
|
25
|
+
database: storage/production.sqlite3
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# MySQL. Versions 5.5.8 and up are supported.
|
|
2
|
+
#
|
|
3
|
+
# Install the MySQL driver
|
|
4
|
+
# gem install trilogy
|
|
5
|
+
#
|
|
6
|
+
# Ensure the MySQL gem is defined in your Gemfile
|
|
7
|
+
# gem "trilogy"
|
|
8
|
+
#
|
|
9
|
+
# And be sure to use new-style password hashing:
|
|
10
|
+
# https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
|
|
11
|
+
#
|
|
12
|
+
default: &default
|
|
13
|
+
adapter: trilogy
|
|
14
|
+
encoding: utf8mb4
|
|
15
|
+
pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
|
16
|
+
username: root
|
|
17
|
+
password:
|
|
18
|
+
<% if mysql_socket -%>
|
|
19
|
+
socket: <%= mysql_socket %>
|
|
20
|
+
<% else -%>
|
|
21
|
+
host: localhost
|
|
22
|
+
<% end -%>
|
|
23
|
+
|
|
24
|
+
development:
|
|
25
|
+
<<: *default
|
|
26
|
+
database: <%= app_name %>_development
|
|
27
|
+
|
|
28
|
+
# Warning: The database defined as "test" will be erased and
|
|
29
|
+
# re-generated from your development database when you run "rake".
|
|
30
|
+
# Do not set this db to the same as development or production.
|
|
31
|
+
test:
|
|
32
|
+
<<: *default
|
|
33
|
+
database: <%= app_name %>_test
|
|
34
|
+
|
|
35
|
+
# As with config/credentials.yml, you never want to store sensitive information,
|
|
36
|
+
# like your database password, in your source code. If your source code is
|
|
37
|
+
# ever seen by anyone, they now have access to your database.
|
|
38
|
+
#
|
|
39
|
+
# Instead, provide the password or a full connection URL as an environment
|
|
40
|
+
# variable when you boot the app. For example:
|
|
41
|
+
#
|
|
42
|
+
# DATABASE_URL="trilogy://myuser:mypass@localhost/somedatabase"
|
|
43
|
+
#
|
|
44
|
+
# If the connection URL is provided in the special DATABASE_URL environment
|
|
45
|
+
# variable, Rails will automatically merge its configuration values on top of
|
|
46
|
+
# the values provided in this file. Alternatively, you can specify a connection
|
|
47
|
+
# URL environment variable explicitly:
|
|
48
|
+
#
|
|
49
|
+
# production:
|
|
50
|
+
# url: <%%= ENV["MY_APP_DATABASE_URL"] %>
|
|
51
|
+
#
|
|
52
|
+
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
|
53
|
+
# for a full overview on how database connection configuration can be specified.
|
|
54
|
+
#
|
|
55
|
+
production:
|
|
56
|
+
<<: *default
|
|
57
|
+
database: <%= app_name %>_production
|
|
58
|
+
username: <%= app_name %>
|
|
59
|
+
password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
|
|
@@ -6,7 +6,7 @@ Rails.application.configure do
|
|
|
6
6
|
# In the development environment your application's code is reloaded any time
|
|
7
7
|
# it changes. This slows down response time but is perfect for development
|
|
8
8
|
# since you don't have to restart the web server when you make code changes.
|
|
9
|
-
config.
|
|
9
|
+
config.enable_reloading = true
|
|
10
10
|
|
|
11
11
|
# Do not eager load code on boot.
|
|
12
12
|
config.eager_load = false
|
|
@@ -39,7 +39,7 @@ Rails.application.configure do
|
|
|
39
39
|
# Store uploaded files on the local file system (see config/storage.yml for options).
|
|
40
40
|
config.active_storage.service = :local
|
|
41
41
|
<%- end -%>
|
|
42
|
-
<%- unless skip_action_mailer? -%>
|
|
42
|
+
<%- unless options.skip_action_mailer? -%>
|
|
43
43
|
|
|
44
44
|
# Don't care if the mailer can't send.
|
|
45
45
|
config.action_mailer.raise_delivery_errors = false
|
|
@@ -63,6 +63,11 @@ Rails.application.configure do
|
|
|
63
63
|
# Highlight code that triggered database queries in logs.
|
|
64
64
|
config.active_record.verbose_query_logs = true
|
|
65
65
|
|
|
66
|
+
<%- end -%>
|
|
67
|
+
<%- unless options[:skip_active_job] -%>
|
|
68
|
+
# Highlight code that enqueued background job in logs.
|
|
69
|
+
config.active_job.verbose_enqueue_logs = true
|
|
70
|
+
|
|
66
71
|
<%- end -%>
|
|
67
72
|
<%- unless skip_sprockets? -%>
|
|
68
73
|
# Suppress logger output for asset requests.
|
|
@@ -77,4 +82,7 @@ Rails.application.configure do
|
|
|
77
82
|
|
|
78
83
|
# Uncomment if you wish to allow Action Cable access from any origin.
|
|
79
84
|
# config.action_cable.disable_request_forgery_protection = true
|
|
85
|
+
|
|
86
|
+
# Raise error when a before_action's only/except options reference missing actions
|
|
87
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
|
80
88
|
end
|
|
@@ -4,7 +4,7 @@ Rails.application.configure do
|
|
|
4
4
|
# Settings specified here will take precedence over those in config/application.rb.
|
|
5
5
|
|
|
6
6
|
# Code is not reloaded between requests.
|
|
7
|
-
config.
|
|
7
|
+
config.enable_reloading = false
|
|
8
8
|
|
|
9
9
|
# Eager load code on boot. This eager loads most of Rails and
|
|
10
10
|
# your application in memory, allowing both threaded web servers
|
|
@@ -18,13 +18,12 @@ Rails.application.configure do
|
|
|
18
18
|
config.action_controller.perform_caching = true
|
|
19
19
|
<%- end -%>
|
|
20
20
|
|
|
21
|
-
# Ensures that a master key has been made available in
|
|
22
|
-
#
|
|
21
|
+
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
|
|
22
|
+
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
|
|
23
23
|
# config.require_master_key = true
|
|
24
24
|
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
|
25
|
+
# Enable static file serving from the `/public` folder (turn off if using NGINX/Apache for it).
|
|
26
|
+
config.public_file_server.enabled = true
|
|
28
27
|
|
|
29
28
|
<%- unless skip_sprockets? -%>
|
|
30
29
|
# Compress CSS using a preprocessor.
|
|
@@ -53,16 +52,26 @@ Rails.application.configure do
|
|
|
53
52
|
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
|
|
54
53
|
|
|
55
54
|
<%- end -%>
|
|
55
|
+
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
|
56
|
+
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
|
|
57
|
+
# config.assume_ssl = true
|
|
58
|
+
|
|
56
59
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
57
|
-
|
|
60
|
+
config.force_ssl = true
|
|
58
61
|
|
|
59
|
-
#
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
# Log to STDOUT by default
|
|
63
|
+
config.logger = ActiveSupport::Logger.new(STDOUT)
|
|
64
|
+
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
|
65
|
+
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
|
62
66
|
|
|
63
67
|
# Prepend all log lines with the following tags.
|
|
64
68
|
config.log_tags = [ :request_id ]
|
|
65
69
|
|
|
70
|
+
# Info include generic and useful information about system operation, but avoids logging too much
|
|
71
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
|
72
|
+
# want to log everything, set the level to "debug".
|
|
73
|
+
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
|
74
|
+
|
|
66
75
|
# Use a different cache store in production.
|
|
67
76
|
# config.cache_store = :mem_cache_store
|
|
68
77
|
|
|
@@ -72,7 +81,7 @@ Rails.application.configure do
|
|
|
72
81
|
# config.active_job.queue_name_prefix = "<%= app_name %>_production"
|
|
73
82
|
|
|
74
83
|
<%- end -%>
|
|
75
|
-
<%- unless skip_action_mailer? -%>
|
|
84
|
+
<%- unless options.skip_action_mailer? -%>
|
|
76
85
|
config.action_mailer.perform_caching = false
|
|
77
86
|
|
|
78
87
|
# Ignore bad email addresses and do not raise email delivery errors.
|
|
@@ -86,22 +95,17 @@ Rails.application.configure do
|
|
|
86
95
|
|
|
87
96
|
# Don't log any deprecations.
|
|
88
97
|
config.active_support.report_deprecations = false
|
|
89
|
-
|
|
90
|
-
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
91
|
-
config.log_formatter = ::Logger::Formatter.new
|
|
92
|
-
|
|
93
|
-
# Use a different logger for distributed setups.
|
|
94
|
-
# require "syslog/logger"
|
|
95
|
-
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
|
|
96
|
-
|
|
97
|
-
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
|
98
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
|
99
|
-
logger.formatter = config.log_formatter
|
|
100
|
-
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
|
101
|
-
end
|
|
102
98
|
<%- unless options.skip_active_record? -%>
|
|
103
99
|
|
|
104
100
|
# Do not dump schema after migrations.
|
|
105
101
|
config.active_record.dump_schema_after_migration = false
|
|
106
102
|
<%- end -%>
|
|
103
|
+
|
|
104
|
+
# Enable DNS rebinding protection and other `Host` header attacks.
|
|
105
|
+
# config.hosts = [
|
|
106
|
+
# "example.com", # Allow requests from example.com
|
|
107
|
+
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
|
108
|
+
# ]
|
|
109
|
+
# Skip DNS rebinding protection for the default health check endpoint.
|
|
110
|
+
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
|
107
111
|
end
|
|
@@ -8,12 +8,13 @@ require "active_support/core_ext/integer/time"
|
|
|
8
8
|
Rails.application.configure do
|
|
9
9
|
# Settings specified here will take precedence over those in config/application.rb.
|
|
10
10
|
|
|
11
|
-
#
|
|
12
|
-
config.
|
|
11
|
+
# While tests run files are not watched, reloading is not necessary.
|
|
12
|
+
config.enable_reloading = false
|
|
13
13
|
|
|
14
|
-
# Eager loading loads your
|
|
15
|
-
# this
|
|
16
|
-
#
|
|
14
|
+
# Eager loading loads your entire application. When running a single test locally,
|
|
15
|
+
# this is usually not necessary, and can slow down your test suite. However, it's
|
|
16
|
+
# recommended that you enable it in continuous integration systems to ensure eager
|
|
17
|
+
# loading is working properly before deploying your code.
|
|
17
18
|
config.eager_load = ENV["CI"].present?
|
|
18
19
|
|
|
19
20
|
# Configure public file server for tests with Cache-Control for performance.
|
|
@@ -28,7 +29,7 @@ Rails.application.configure do
|
|
|
28
29
|
config.cache_store = :null_store
|
|
29
30
|
|
|
30
31
|
# Raise exceptions instead of rendering exception templates.
|
|
31
|
-
config.action_dispatch.show_exceptions =
|
|
32
|
+
config.action_dispatch.show_exceptions = :rescuable
|
|
32
33
|
|
|
33
34
|
# Disable request forgery protection in test environment.
|
|
34
35
|
config.action_controller.allow_forgery_protection = false
|
|
@@ -38,7 +39,7 @@ Rails.application.configure do
|
|
|
38
39
|
config.active_storage.service = :test
|
|
39
40
|
|
|
40
41
|
<%- end -%>
|
|
41
|
-
<%- unless skip_action_mailer? -%>
|
|
42
|
+
<%- unless options.skip_action_mailer? -%>
|
|
42
43
|
config.action_mailer.perform_caching = false
|
|
43
44
|
|
|
44
45
|
# Tell Action Mailer not to deliver emails to the real world.
|
|
@@ -61,4 +62,7 @@ Rails.application.configure do
|
|
|
61
62
|
|
|
62
63
|
# Annotate rendered view with file names.
|
|
63
64
|
# config.action_view.annotate_rendered_view_with_filenames = true
|
|
65
|
+
|
|
66
|
+
# Raise error when a before_action's only/except options reference missing actions
|
|
67
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
|
64
68
|
end
|
|
@@ -5,8 +5,10 @@ Rails.application.config.assets.version = "1.0"
|
|
|
5
5
|
|
|
6
6
|
# Add additional assets to the asset load path.
|
|
7
7
|
# Rails.application.config.assets.paths << Emoji.images_path
|
|
8
|
+
<% if options[:asset_pipeline] == "sprockets" -%>
|
|
8
9
|
|
|
9
10
|
# Precompile additional assets.
|
|
10
11
|
# application.js, application.css, and all non-JS/CSS in the app/assets
|
|
11
12
|
# folder are already added.
|
|
12
13
|
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|
|
14
|
+
<% end -%>
|
data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
# # policy.report_uri "/csp-violation-report-endpoint"
|
|
17
17
|
# end
|
|
18
18
|
#
|
|
19
|
-
# # Generate session nonces for permitted importmap and inline
|
|
19
|
+
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
|
20
20
|
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
|
21
|
-
# config.content_security_policy_nonce_directives = %w(script-src)
|
|
21
|
+
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
|
22
22
|
#
|
|
23
23
|
# # Report violations without enforcing the policy.
|
|
24
24
|
# # config.content_security_policy_report_only = true
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
|
2
2
|
|
|
3
3
|
# Avoid CORS issues when API is called from the frontend app.
|
|
4
|
-
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin
|
|
4
|
+
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin Ajax requests.
|
|
5
5
|
|
|
6
6
|
# Read more: https://github.com/cyu/rack-cors
|
|
7
7
|
|