railties 7.0.8 → 7.2.0
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 +188 -268
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.md +99 -0
- data/README.rdoc +4 -4
- data/lib/minitest/rails_plugin.rb +67 -1
- data/lib/rails/all.rb +1 -3
- data/lib/rails/api/task.rb +39 -6
- data/lib/rails/application/bootstrap.rb +28 -10
- data/lib/rails/application/configuration.rb +228 -72
- 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 +50 -33
- data/lib/rails/application.rb +110 -76
- data/lib/rails/backtrace_cleaner.rb +19 -4
- data/lib/rails/cli.rb +5 -3
- 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/app/update_command.rb +93 -0
- data/lib/rails/commands/application/application_command.rb +2 -0
- data/lib/rails/commands/boot/boot_command.rb +14 -0
- data/lib/rails/commands/console/console_command.rb +11 -30
- data/lib/rails/commands/console/irb_console.rb +137 -0
- 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 +32 -131
- data/lib/rails/commands/destroy/destroy_command.rb +3 -2
- data/lib/rails/commands/dev/dev_command.rb +1 -6
- data/lib/rails/commands/devcontainer/devcontainer_command.rb +39 -0
- 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 +42 -19
- data/lib/rails/commands/secret/secret_command.rb +13 -0
- data/lib/rails/commands/server/server_command.rb +37 -34
- data/lib/rails/commands/test/USAGE +14 -0
- data/lib/rails/commands/test/test_command.rb +58 -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 +15 -6
- data/lib/rails/console/app.rb +5 -35
- data/lib/rails/console/helpers.rb +5 -16
- data/lib/rails/console/methods.rb +23 -0
- data/lib/rails/deprecator.rb +7 -0
- data/lib/rails/engine/configuration.rb +50 -6
- data/lib/rails/engine.rb +51 -23
- data/lib/rails/gem_version.rb +3 -3
- data/lib/rails/generators/actions.rb +6 -15
- data/lib/rails/generators/active_model.rb +28 -14
- data/lib/rails/generators/app_base.rb +382 -88
- data/lib/rails/generators/app_name.rb +3 -14
- data/lib/rails/generators/base.rb +21 -9
- data/lib/rails/generators/database.rb +231 -35
- data/lib/rails/generators/erb/mailer/templates/layout.html.erb.tt +1 -1
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +2 -0
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +2 -0
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +2 -0
- data/lib/rails/generators/generated_attribute.rb +38 -1
- data/lib/rails/generators/migration.rb +4 -5
- data/lib/rails/generators/model_helpers.rb +2 -1
- data/lib/rails/generators/rails/app/USAGE +22 -6
- data/lib/rails/generators/rails/app/app_generator.rb +132 -82
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +110 -0
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +19 -21
- data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +4 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +8 -1
- data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/views/pwa/manifest.json.erb.tt +22 -0
- data/lib/rails/generators/rails/app/templates/app/views/pwa/service-worker.js +26 -0
- data/lib/rails/generators/rails/app/templates/bin/brakeman.tt +6 -0
- data/lib/rails/generators/rails/app/templates/bin/rubocop.tt +7 -0
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +15 -2
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +6 -17
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +11 -6
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +10 -3
- data/lib/rails/generators/rails/app/templates/config/databases/{jdbcmysql.yml.tt → trilogy.yml.tt} +12 -7
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +25 -8
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +37 -28
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +20 -13
- 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/filter_parameter_logging.rb.tt +4 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.tt +70 -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 +24 -34
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +9 -1
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +6 -4
- data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +15 -0
- data/lib/rails/generators/rails/app/templates/dockerignore.tt +56 -0
- data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +138 -0
- data/lib/rails/generators/rails/app/templates/github/dependabot.yml +12 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +7 -11
- data/lib/rails/generators/rails/app/templates/node-version.tt +1 -0
- data/lib/rails/generators/rails/app/templates/public/406-unsupported-browser.html +66 -0
- data/lib/rails/generators/rails/app/templates/public/icon.png +0 -0
- data/lib/rails/generators/rails/app/templates/public/icon.svg +3 -0
- data/lib/rails/generators/rails/app/templates/rubocop.yml.tt +8 -0
- data/lib/rails/generators/rails/app/templates/test/application_system_test_case.rb.tt +1 -1
- 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 +6 -1
- 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/db/system/change/change_generator.rb +146 -5
- data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +166 -0
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +3 -0
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/compose.yaml.tt +47 -0
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +37 -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/migration/migration_generator.rb +4 -0
- 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 +43 -22
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +7 -3
- data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +2 -0
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +1 -17
- data/lib/rails/generators/rails/plugin/templates/bin/rubocop.tt +7 -0
- data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +103 -0
- data/lib/rails/generators/rails/plugin/templates/github/dependabot.yml +12 -0
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +0 -2
- data/lib/rails/generators/rails/plugin/templates/rubocop.yml.tt +8 -0
- data/lib/rails/generators/rails/plugin/templates/test/application_system_test_case.rb.tt +1 -1
- 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/mailer/templates/functional_test.rb.tt +6 -4
- data/lib/rails/generators/test_unit/mailer/templates/preview.rb.tt +3 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +16 -2
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +2 -2
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +2 -2
- data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +2 -0
- data/lib/rails/generators/test_unit/system/templates/application_system_test_case.rb.tt +1 -1
- data/lib/rails/generators/testing/assertions.rb +20 -0
- data/lib/rails/generators/testing/{behaviour.rb → behavior.rb} +8 -4
- data/lib/rails/generators.rb +7 -15
- data/lib/rails/health_controller.rb +55 -0
- data/lib/rails/info.rb +3 -3
- data/lib/rails/info_controller.rb +31 -11
- data/lib/rails/mailers_controller.rb +29 -6
- data/lib/rails/paths.rb +15 -12
- data/lib/rails/pwa_controller.rb +15 -0
- data/lib/rails/rack/logger.rb +27 -16
- data/lib/rails/rackup/server.rb +15 -0
- data/lib/rails/railtie/configurable.rb +2 -2
- data/lib/rails/railtie/configuration.rb +14 -1
- data/lib/rails/railtie.rb +20 -21
- data/lib/rails/source_annotation_extractor.rb +67 -18
- data/lib/rails/tasks/engine.rake +8 -8
- data/lib/rails/tasks/framework.rake +2 -34
- 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 +6 -6
- data/lib/rails/tasks/zeitwerk.rake +15 -35
- data/lib/rails/tasks.rb +0 -2
- data/lib/rails/templates/layouts/application.html.erb +1 -1
- data/lib/rails/templates/rails/mailers/email.html.erb +44 -8
- 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 +5 -2
- data/lib/rails/test_help.rb +11 -18
- data/lib/rails/test_unit/line_filtering.rb +1 -1
- data/lib/rails/test_unit/reporter.rb +14 -4
- data/lib/rails/test_unit/runner.rb +62 -20
- data/lib/rails/test_unit/test_parser.rb +133 -0
- data/lib/rails/test_unit/testing.rake +13 -33
- data/lib/rails/testing/maintain_test_schema.rb +16 -0
- data/lib/rails/version.rb +1 -1
- data/lib/rails/zeitwerk_checker.rb +15 -0
- data/lib/rails.rb +20 -17
- metadata +89 -42
- data/RDOC_MAIN.rdoc +0 -97
- data/lib/rails/app_updater.rb +0 -40
- data/lib/rails/application/dummy_erb_compiler.rb +0 -18
- data/lib/rails/commands/secrets/USAGE +0 -66
- data/lib/rails/commands/secrets/secrets_command.rb +0 -65
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +0 -68
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +0 -70
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +0 -24
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +0 -62
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +0 -53
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt +0 -143
- data/lib/rails/generators/rails/app/templates/public/apple-touch-icon-precomposed.png +0 -0
- data/lib/rails/generators/rails/app/templates/public/apple-touch-icon.png +0 -0
- data/lib/rails/generators/rails/app/templates/public/favicon.ico +0 -0
- data/lib/rails/generators/rails/model/USAGE +0 -113
- data/lib/rails/ruby_version_check.rb +0 -15
- data/lib/rails/secrets.rb +0 -110
- data/lib/rails/tasks/middleware.rake +0 -9
- data/lib/rails/tasks/restart.rake +0 -9
@@ -1,10 +1,10 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
|
3
|
-
# path to your application root.
|
4
3
|
APP_ROOT = File.expand_path("..", __dir__)
|
4
|
+
APP_NAME = "<%= app_name.dasherize %>"
|
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 install --check-files")
|
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 =="
|
@@ -31,4 +40,8 @@ FileUtils.chdir APP_ROOT do
|
|
31
40
|
|
32
41
|
puts "\n== Restarting application server =="
|
33
42
|
system! "bin/rails restart"
|
43
|
+
|
44
|
+
# puts "\n== Configuring puma-dev =="
|
45
|
+
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
|
46
|
+
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
|
34
47
|
end
|
@@ -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,11 @@ module <%= app_const_base %>
|
|
31
15
|
config.load_defaults Rails::VERSION::STRING.to_f
|
32
16
|
<%- end -%>
|
33
17
|
|
18
|
+
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
19
|
+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
20
|
+
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
21
|
+
config.autoload_lib(ignore: %w[assets tasks])
|
22
|
+
|
34
23
|
# Configuration for the application, engines, and railties goes here.
|
35
24
|
#
|
36
25
|
# These settings can be overridden in specific environments using the files
|
@@ -15,10 +15,10 @@ default: &default
|
|
15
15
|
pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
16
16
|
username: root
|
17
17
|
password:
|
18
|
-
<% if
|
19
|
-
socket: <%=
|
18
|
+
<% if database.socket -%>
|
19
|
+
socket: <%= database.socket %>
|
20
20
|
<% else -%>
|
21
|
-
host:
|
21
|
+
host: <%%= ENV.fetch("DB_HOST") { "<%= database.host %>" } %>
|
22
22
|
<% end -%>
|
23
23
|
|
24
24
|
development:
|
@@ -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.
|
@@ -20,18 +18,25 @@ default: &default
|
|
20
18
|
# For details on connection pooling, see Rails configuration guide
|
21
19
|
# https://guides.rubyonrails.org/configuring.html#database-pooling
|
22
20
|
pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
21
|
+
<% if devcontainer? -%>
|
22
|
+
<%% if ENV["DB_HOST"] %>
|
23
|
+
host: <%%= ENV["DB_HOST"] %>
|
24
|
+
username: postgres
|
25
|
+
password: postgres
|
26
|
+
<%% end %>
|
27
|
+
<% end %>
|
23
28
|
|
24
29
|
development:
|
25
30
|
<<: *default
|
26
31
|
database: <%= app_name %>_development
|
27
32
|
|
28
|
-
# The specified database role being used to connect to
|
29
|
-
# To create additional roles in
|
30
|
-
# When left blank,
|
33
|
+
# The specified database role being used to connect to PostgreSQL.
|
34
|
+
# To create additional roles in PostgreSQL see `$ createuser --help`.
|
35
|
+
# When left blank, PostgreSQL will use the default role. This is
|
31
36
|
# the same name as the operating system user running Rails.
|
32
37
|
#username: <%= app_name %>
|
33
38
|
|
34
|
-
# The password associated with the
|
39
|
+
# The password associated with the PostgreSQL role (username).
|
35
40
|
#password:
|
36
41
|
|
37
42
|
# Connect on a TCP socket. Omitted by default since the client uses a
|
@@ -11,15 +11,22 @@ 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
|
+
|
24
|
+
# SQLite3 write its data on the local filesystem, as such it requires
|
25
|
+
# persistent disks. If you are deploying to a managed service, you should
|
26
|
+
# make sure it provides disk persistence, as many don't.
|
27
|
+
#
|
28
|
+
# Similarly, if you deploy your application as a Docker container, you must
|
29
|
+
# ensure the database is located in a persisted volume.
|
23
30
|
production:
|
24
31
|
<<: *default
|
25
|
-
database:
|
32
|
+
# database: path/to/persistent/storage/production.sqlite3
|
data/lib/rails/generators/rails/app/templates/config/databases/{jdbcmysql.yml.tt → trilogy.yml.tt}
RENAMED
@@ -1,20 +1,25 @@
|
|
1
1
|
# MySQL. Versions 5.5.8 and up are supported.
|
2
2
|
#
|
3
|
-
# Install the MySQL driver
|
4
|
-
# gem install
|
3
|
+
# Install the MySQL driver
|
4
|
+
# gem install trilogy
|
5
5
|
#
|
6
|
-
#
|
7
|
-
#
|
6
|
+
# Ensure the MySQL gem is defined in your Gemfile
|
7
|
+
# gem "trilogy"
|
8
8
|
#
|
9
9
|
# And be sure to use new-style password hashing:
|
10
10
|
# https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
|
11
11
|
#
|
12
12
|
default: &default
|
13
|
-
adapter:
|
13
|
+
adapter: trilogy
|
14
|
+
encoding: utf8mb4
|
14
15
|
pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
15
16
|
username: root
|
16
17
|
password:
|
17
|
-
|
18
|
+
<% if database.socket -%>
|
19
|
+
socket: <%= database.socket %>
|
20
|
+
<% else -%>
|
21
|
+
host: <%%= ENV.fetch("DB_HOST") { "<%= database.host %>" } %>
|
22
|
+
<% end -%>
|
18
23
|
|
19
24
|
development:
|
20
25
|
<<: *default
|
@@ -34,7 +39,7 @@ test:
|
|
34
39
|
# Instead, provide the password or a full connection URL as an environment
|
35
40
|
# variable when you boot the app. For example:
|
36
41
|
#
|
37
|
-
# DATABASE_URL="
|
42
|
+
# DATABASE_URL="trilogy://myuser:mypass@localhost/somedatabase"
|
38
43
|
#
|
39
44
|
# If the connection URL is provided in the special DATABASE_URL environment
|
40
45
|
# variable, Rails will automatically merge its configuration values on top of
|
@@ -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
|
@@ -14,7 +14,7 @@ Rails.application.configure do
|
|
14
14
|
# Show full error reports.
|
15
15
|
config.consider_all_requests_local = true
|
16
16
|
|
17
|
-
# Enable server timing
|
17
|
+
# Enable server timing.
|
18
18
|
config.server_timing = true
|
19
19
|
|
20
20
|
# Enable/disable caching. By default caching is disabled.
|
@@ -26,9 +26,7 @@ Rails.application.configure do
|
|
26
26
|
|
27
27
|
<%- end -%>
|
28
28
|
config.cache_store = :memory_store
|
29
|
-
config.public_file_server.headers = {
|
30
|
-
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
31
|
-
}
|
29
|
+
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
|
32
30
|
else
|
33
31
|
config.action_controller.perform_caching = false
|
34
32
|
|
@@ -39,12 +37,16 @@ Rails.application.configure do
|
|
39
37
|
# Store uploaded files on the local file system (see config/storage.yml for options).
|
40
38
|
config.active_storage.service = :local
|
41
39
|
<%- end -%>
|
42
|
-
<%- unless skip_action_mailer? -%>
|
40
|
+
<%- unless options.skip_action_mailer? -%>
|
43
41
|
|
44
42
|
# Don't care if the mailer can't send.
|
45
43
|
config.action_mailer.raise_delivery_errors = false
|
46
44
|
|
45
|
+
# Disable caching for Action Mailer templates even if Action Controller
|
46
|
+
# caching is enabled.
|
47
47
|
config.action_mailer.perform_caching = false
|
48
|
+
|
49
|
+
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
|
48
50
|
<%- end -%>
|
49
51
|
|
50
52
|
# Print deprecation notices to the Rails logger.
|
@@ -63,18 +65,33 @@ Rails.application.configure do
|
|
63
65
|
# Highlight code that triggered database queries in logs.
|
64
66
|
config.active_record.verbose_query_logs = true
|
65
67
|
|
68
|
+
<%- end -%>
|
69
|
+
<%- unless options[:skip_active_job] -%>
|
70
|
+
# Highlight code that enqueued background job in logs.
|
71
|
+
config.active_job.verbose_enqueue_logs = true
|
72
|
+
|
66
73
|
<%- end -%>
|
67
74
|
<%- unless skip_sprockets? -%>
|
68
75
|
# Suppress logger output for asset requests.
|
69
76
|
config.assets.quiet = true
|
70
|
-
<%- end -%>
|
71
77
|
|
78
|
+
<%- end -%>
|
72
79
|
# Raises error for missing translations.
|
73
80
|
# config.i18n.raise_on_missing_translations = true
|
74
81
|
|
75
82
|
# Annotate rendered view with file names.
|
76
|
-
|
83
|
+
config.action_view.annotate_rendered_view_with_filenames = true
|
77
84
|
|
85
|
+
<%- unless skip_action_cable? -%>
|
78
86
|
# Uncomment if you wish to allow Action Cable access from any origin.
|
79
87
|
# config.action_cable.disable_request_forgery_protection = true
|
88
|
+
|
89
|
+
<%- end -%>
|
90
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
91
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
92
|
+
<%- unless skip_rubocop? -%>
|
93
|
+
|
94
|
+
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
|
95
|
+
# config.generators.apply_rubocop_autocorrect_after_generate!
|
96
|
+
<%- end -%>
|
80
97
|
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
|
@@ -13,24 +13,23 @@ Rails.application.configure do
|
|
13
13
|
config.eager_load = true
|
14
14
|
|
15
15
|
# Full error reports are disabled and caching is turned on.
|
16
|
-
config.consider_all_requests_local
|
16
|
+
config.consider_all_requests_local = false
|
17
17
|
<%- unless options.api? -%>
|
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
|
-
# Disable serving static files from
|
26
|
-
#
|
27
|
-
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
25
|
+
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
|
26
|
+
# config.public_file_server.enabled = false
|
28
27
|
|
29
28
|
<%- unless skip_sprockets? -%>
|
30
29
|
# Compress CSS using a preprocessor.
|
31
30
|
# config.assets.css_compressor = :sass
|
32
31
|
|
33
|
-
# Do not
|
32
|
+
# Do not fall back to assets pipeline if a precompiled asset is missed.
|
34
33
|
config.assets.compile = false
|
35
34
|
|
36
35
|
<%- end -%>
|
@@ -46,33 +45,48 @@ Rails.application.configure do
|
|
46
45
|
config.active_storage.service = :local
|
47
46
|
|
48
47
|
<%- end -%>
|
49
|
-
<%- unless
|
48
|
+
<%- unless skip_action_cable? -%>
|
50
49
|
# Mount Action Cable outside main process or domain.
|
51
50
|
# config.action_cable.mount_path = nil
|
52
51
|
# config.action_cable.url = "wss://example.com/cable"
|
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
|
61
|
+
|
62
|
+
# Skip http-to-https redirect for the default health check endpoint.
|
63
|
+
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
58
64
|
|
59
|
-
#
|
60
|
-
|
61
|
-
|
65
|
+
# Log to STDOUT by default
|
66
|
+
config.logger = ActiveSupport::Logger.new(STDOUT)
|
67
|
+
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
68
|
+
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
62
69
|
|
63
70
|
# Prepend all log lines with the following tags.
|
64
71
|
config.log_tags = [ :request_id ]
|
65
72
|
|
73
|
+
# "info" includes generic and useful information about system operation, but avoids logging too much
|
74
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
75
|
+
# want to log everything, set the level to "debug".
|
76
|
+
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
77
|
+
|
66
78
|
# Use a different cache store in production.
|
67
79
|
# config.cache_store = :mem_cache_store
|
68
80
|
|
69
81
|
<%- unless options[:skip_active_job] -%>
|
70
82
|
# Use a real queuing backend for Active Job (and separate queues per environment).
|
71
|
-
# config.active_job.queue_adapter
|
83
|
+
# config.active_job.queue_adapter = :resque
|
72
84
|
# config.active_job.queue_name_prefix = "<%= app_name %>_production"
|
73
85
|
|
74
86
|
<%- end -%>
|
75
|
-
<%- unless skip_action_mailer? -%>
|
87
|
+
<%- unless options.skip_action_mailer? -%>
|
88
|
+
# Disable caching for Action Mailer templates even if Action Controller
|
89
|
+
# caching is enabled.
|
76
90
|
config.action_mailer.perform_caching = false
|
77
91
|
|
78
92
|
# Ignore bad email addresses and do not raise email delivery errors.
|
@@ -86,22 +100,17 @@ Rails.application.configure do
|
|
86
100
|
|
87
101
|
# Don't log any deprecations.
|
88
102
|
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
103
|
<%- unless options.skip_active_record? -%>
|
103
104
|
|
104
105
|
# Do not dump schema after migrations.
|
105
106
|
config.active_record.dump_schema_after_migration = false
|
106
107
|
<%- end -%>
|
108
|
+
|
109
|
+
# Enable DNS rebinding protection and other `Host` header attacks.
|
110
|
+
# config.hosts = [
|
111
|
+
# "example.com", # Allow requests from example.com
|
112
|
+
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
113
|
+
# ]
|
114
|
+
# Skip DNS rebinding protection for the default health check endpoint.
|
115
|
+
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
107
116
|
end
|
@@ -8,27 +8,25 @@ 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.
|
20
|
-
config.public_file_server.
|
21
|
-
config.public_file_server.headers = {
|
22
|
-
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
|
23
|
-
}
|
21
|
+
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" }
|
24
22
|
|
25
23
|
# Show full error reports and disable caching.
|
26
|
-
config.consider_all_requests_local
|
24
|
+
config.consider_all_requests_local = true
|
27
25
|
config.action_controller.perform_caching = false
|
28
26
|
config.cache_store = :null_store
|
29
27
|
|
30
|
-
#
|
31
|
-
config.action_dispatch.show_exceptions =
|
28
|
+
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
29
|
+
config.action_dispatch.show_exceptions = :rescuable
|
32
30
|
|
33
31
|
# Disable request forgery protection in test environment.
|
34
32
|
config.action_controller.allow_forgery_protection = false
|
@@ -38,7 +36,9 @@ Rails.application.configure do
|
|
38
36
|
config.active_storage.service = :test
|
39
37
|
|
40
38
|
<%- end -%>
|
41
|
-
<%- unless skip_action_mailer? -%>
|
39
|
+
<%- unless options.skip_action_mailer? -%>
|
40
|
+
# Disable caching for Action Mailer templates even if Action Controller
|
41
|
+
# caching is enabled.
|
42
42
|
config.action_mailer.perform_caching = false
|
43
43
|
|
44
44
|
# Tell Action Mailer not to deliver emails to the real world.
|
@@ -46,6 +46,10 @@ Rails.application.configure do
|
|
46
46
|
# ActionMailer::Base.deliveries array.
|
47
47
|
config.action_mailer.delivery_method = :test
|
48
48
|
|
49
|
+
# Unlike controllers, the mailer instance doesn't have any context about the
|
50
|
+
# incoming request so you'll need to provide the :host parameter yourself.
|
51
|
+
config.action_mailer.default_url_options = { host: "www.example.com" }
|
52
|
+
|
49
53
|
<%- end -%>
|
50
54
|
# Print deprecation notices to the stderr.
|
51
55
|
config.active_support.deprecation = :stderr
|
@@ -61,4 +65,7 @@ Rails.application.configure do
|
|
61
65
|
|
62
66
|
# Annotate rendered view with file names.
|
63
67
|
# config.action_view.annotate_rendered_view_with_filenames = true
|
68
|
+
|
69
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
70
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
64
71
|
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
|
|
data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
|
-
# Configure parameters to be filtered from the log file.
|
4
|
-
#
|
5
|
-
# notations and behaviors.
|
3
|
+
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
4
|
+
# Use this to limit dissemination of sensitive information.
|
5
|
+
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
6
6
|
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
|
8
8
|
]
|
data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.tt
ADDED
@@ -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
|
@@ -1,11 +1,13 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
1
3
|
# Define an application-wide HTTP permissions policy. For further
|
2
|
-
# information see https://developers.google.com/web/updates/2018/06/feature-policy
|
3
|
-
|
4
|
-
# Rails.application.config.permissions_policy do |
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
4
|
+
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
|
5
|
+
|
6
|
+
# Rails.application.config.permissions_policy do |policy|
|
7
|
+
# policy.camera :none
|
8
|
+
# policy.gyroscope :none
|
9
|
+
# policy.microphone :none
|
10
|
+
# policy.usb :none
|
11
|
+
# policy.fullscreen :self
|
12
|
+
# policy.payment :self, "https://secure.example.com"
|
11
13
|
# end
|