railties 8.0.3 → 8.1.0.rc1

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.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +103 -205
  3. data/lib/minitest/rails_plugin.rb +48 -12
  4. data/lib/rails/application/bootstrap.rb +5 -0
  5. data/lib/rails/application/configuration.rb +31 -9
  6. data/lib/rails/application/default_middleware_stack.rb +1 -1
  7. data/lib/rails/application/finisher.rb +2 -1
  8. data/lib/rails/application/routes_reloader.rb +0 -1
  9. data/lib/rails/application.rb +1 -3
  10. data/lib/rails/code_statistics.rb +4 -1
  11. data/lib/rails/command/base.rb +0 -2
  12. data/lib/rails/command/environment_argument.rb +0 -1
  13. data/lib/rails/command.rb +1 -1
  14. data/lib/rails/commands/app/update_command.rb +1 -0
  15. data/lib/rails/commands/console/irb_console.rb +4 -4
  16. data/lib/rails/commands/credentials/credentials_command.rb +25 -5
  17. data/lib/rails/commands/encrypted/encrypted_command.rb +0 -1
  18. data/lib/rails/engine.rb +0 -1
  19. data/lib/rails/gem_version.rb +3 -3
  20. data/lib/rails/generators/actions.rb +2 -3
  21. data/lib/rails/generators/app_base.rb +49 -28
  22. data/lib/rails/generators/database.rb +1 -1
  23. data/lib/rails/generators/erb/authentication/authentication_generator.rb +2 -0
  24. data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +2 -2
  25. data/lib/rails/generators/generated_attribute.rb +1 -1
  26. data/lib/rails/generators/migration.rb +0 -1
  27. data/lib/rails/generators/rails/app/app_generator.rb +16 -5
  28. data/lib/rails/generators/rails/app/templates/Dockerfile.tt +19 -15
  29. data/lib/rails/generators/rails/app/templates/Gemfile.tt +6 -1
  30. data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +5 -0
  31. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +1 -0
  32. data/lib/rails/generators/rails/app/templates/bin/bundler-audit.tt +5 -0
  33. data/lib/rails/generators/rails/app/templates/bin/ci.tt +5 -0
  34. data/lib/rails/generators/rails/app/templates/bin/rubocop.tt +1 -1
  35. data/lib/rails/generators/rails/app/templates/bin/setup.tt +1 -0
  36. data/lib/rails/generators/rails/app/templates/config/bundler-audit.yml.tt +5 -0
  37. data/lib/rails/generators/rails/app/templates/config/ci.rb.tt +38 -0
  38. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +9 -1
  39. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +10 -2
  40. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
  41. data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +9 -1
  42. data/lib/rails/generators/rails/app/templates/config/deploy.yml.tt +8 -5
  43. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +8 -0
  44. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +2 -2
  45. data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +4 -0
  46. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_1.rb.tt +93 -0
  47. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +3 -2
  48. data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +0 -7
  49. data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +0 -6
  50. data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +107 -21
  51. data/lib/rails/generators/rails/app/templates/github/dependabot.yml +2 -2
  52. data/lib/rails/generators/rails/app/templates/kamal-secrets.tt +3 -0
  53. data/lib/rails/generators/rails/app/templates/public/400.html +1 -1
  54. data/lib/rails/generators/rails/app/templates/public/404.html +2 -2
  55. data/lib/rails/generators/rails/app/templates/public/422.html +1 -1
  56. data/lib/rails/generators/rails/app/templates/public/500.html +2 -2
  57. data/lib/rails/generators/rails/authentication/authentication_generator.rb +8 -6
  58. data/lib/rails/generators/rails/authentication/templates/app/controllers/passwords_controller.rb.tt +6 -0
  59. data/lib/rails/generators/rails/authentication/templates/app/controllers/sessions_controller.rb.tt +2 -2
  60. data/lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt +3 -1
  61. data/lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt +3 -1
  62. data/lib/rails/generators/rails/benchmark/USAGE +1 -1
  63. data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +0 -2
  64. data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +1 -1
  65. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +4 -0
  66. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/compose.yaml.tt +2 -2
  67. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +1 -1
  68. data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +17 -5
  69. data/lib/rails/generators/rails/master_key/master_key_generator.rb +0 -12
  70. data/lib/rails/generators/rails/plugin/plugin_generator.rb +1 -0
  71. data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +0 -4
  72. data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +20 -9
  73. data/lib/rails/generators/rails/plugin/templates/github/dependabot.yml +2 -2
  74. data/lib/rails/generators/rails/script/USAGE +1 -1
  75. data/lib/rails/generators/test_unit/authentication/authentication_generator.rb +13 -0
  76. data/lib/rails/generators/test_unit/authentication/templates/test/controllers/passwords_controller_test.rb.tt +67 -0
  77. data/lib/rails/generators/test_unit/authentication/templates/test/controllers/sessions_controller_test.rb +33 -0
  78. data/lib/rails/generators/test_unit/authentication/templates/test/models/user_test.rb.tt +4 -3
  79. data/lib/rails/generators/test_unit/authentication/templates/test/test_helpers/session_test_helper.rb.tt +19 -0
  80. data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +1 -1
  81. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +4 -2
  82. data/lib/rails/generators/testing/behavior.rb +0 -3
  83. data/lib/rails/generators.rb +3 -1
  84. data/lib/rails/health_controller.rb +8 -2
  85. data/lib/rails/info.rb +4 -5
  86. data/lib/rails/info_controller.rb +4 -5
  87. data/lib/rails/initializable.rb +63 -19
  88. data/lib/rails/rack/silence_request.rb +5 -2
  89. data/lib/rails/railtie/configurable.rb +0 -1
  90. data/lib/rails/railtie.rb +0 -1
  91. data/lib/rails/tasks/statistics.rake +3 -21
  92. data/lib/rails/tasks.rb +1 -3
  93. data/lib/rails/templates/rails/info/notes.html.erb +23 -0
  94. data/lib/rails/templates/rails/mailers/email.html.erb +2 -1
  95. data/lib/rails/templates/rails/welcome/index.html.erb +19 -3
  96. data/lib/rails/test_unit/reporter.rb +5 -4
  97. data/lib/rails/test_unit/runner.rb +8 -5
  98. data/lib/rails.rb +9 -2
  99. metadata +18 -15
  100. data/lib/rails/console/methods.rb +0 -7
  101. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_0.rb.tt +0 -30
  102. data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +0 -15
  103. data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +0 -7
  104. data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +0 -2
@@ -0,0 +1,38 @@
1
+ # Run using bin/ci
2
+
3
+ CI.run do
4
+ step "Setup", "bin/setup --skip-server"
5
+ <% unless options.skip_rubocop? %>
6
+ step "Style: Ruby", "bin/rubocop"
7
+ <% end -%>
8
+
9
+ <% unless options.skip_bundler_audit? -%>
10
+ step "Security: Gem audit", "bin/bundler-audit"
11
+ <% end -%>
12
+ <% if using_node? -%>
13
+ step "Security: Yarn vulnerability audit", "yarn audit"
14
+ <% end -%>
15
+ <% if using_importmap? -%>
16
+ step "Security: Importmap vulnerability audit", "bin/importmap audit"
17
+ <% end -%>
18
+ <% unless options.skip_brakeman? -%>
19
+ step "Security: Brakeman code analysis", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error"
20
+ <% end -%>
21
+ <% if options[:api] || options[:skip_system_test] -%>
22
+ step "Tests: Rails", "bin/rails test"
23
+ <% else %>
24
+ step "Tests: Rails", "bin/rails test"
25
+ step "Tests: System", "bin/rails test:system"
26
+ <% end -%>
27
+ <% unless options.skip_active_record? -%>
28
+ step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant"
29
+ <% end -%>
30
+
31
+ # Optional: set a green GitHub commit status to unblock PR merge.
32
+ # Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`.
33
+ # if success?
34
+ # step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff"
35
+ # else
36
+ # failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again."
37
+ # end
38
+ end
@@ -12,7 +12,7 @@
12
12
  default: &default
13
13
  adapter: mysql2
14
14
  encoding: utf8mb4
15
- pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
15
+ max_connections: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
16
16
  username: root
17
17
  password:
18
18
  <% if database.socket -%>
@@ -49,6 +49,14 @@ test:
49
49
  # production:
50
50
  # url: <%%= ENV["MY_APP_DATABASE_URL"] %>
51
51
  #
52
+ <%- unless options.skip_solid? -%>
53
+ # Connection URLs for non-primary databases can also be configured using
54
+ # environment variables. The variable name is formed by concatenating the
55
+ # connection name with `_DATABASE_URL`. For example:
56
+ #
57
+ # CACHE_DATABASE_URL="mysql2://cacheuser:cachepass@localhost/cachedatabase"
58
+ #
59
+ <%- end -%>
52
60
  # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
53
61
  # for a full overview on how database connection configuration can be specified.
54
62
  #
@@ -3,7 +3,7 @@
3
3
  # Install the pg driver:
4
4
  # gem install pg
5
5
  # On macOS with Homebrew:
6
- # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
6
+ # gem install pg -- --with-pg-config=/opt/homebrew/bin/pg_config
7
7
  # On Windows:
8
8
  # gem install pg
9
9
  # Choose the win32 build.
@@ -17,7 +17,7 @@ default: &default
17
17
  encoding: unicode
18
18
  # For details on connection pooling, see Rails configuration guide
19
19
  # https://guides.rubyonrails.org/configuring.html#database-pooling
20
- pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
20
+ max_connections: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
21
21
  <% if devcontainer? -%>
22
22
  <%% if ENV["DB_HOST"] %>
23
23
  host: <%%= ENV["DB_HOST"] %>
@@ -81,6 +81,14 @@ test:
81
81
  # production:
82
82
  # url: <%%= ENV["MY_APP_DATABASE_URL"] %>
83
83
  #
84
+ <%- unless options.skip_solid? -%>
85
+ # Connection URLs for non-primary databases can also be configured using
86
+ # environment variables. The variable name is formed by concatenating the
87
+ # connection name with `_DATABASE_URL`. For example:
88
+ #
89
+ # CACHE_DATABASE_URL="postgres://cacheuser:cachepass@localhost/cachedatabase"
90
+ #
91
+ <%- end -%>
84
92
  # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
85
93
  # for a full overview on how database connection configuration can be specified.
86
94
  #
@@ -6,7 +6,7 @@
6
6
  #
7
7
  default: &default
8
8
  adapter: sqlite3
9
- pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
9
+ max_connections: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
10
  timeout: 5000
11
11
 
12
12
  development:
@@ -12,7 +12,7 @@
12
12
  default: &default
13
13
  adapter: trilogy
14
14
  encoding: utf8mb4
15
- pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
15
+ max_connections: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
16
16
  username: root
17
17
  password:
18
18
  host: <%%= ENV.fetch("DB_HOST") { "<%= database.host %>" } %>
@@ -51,6 +51,14 @@ test:
51
51
  # production:
52
52
  # url: <%%= ENV["MY_APP_DATABASE_URL"] %>
53
53
  #
54
+ <%- unless options.skip_solid? -%>
55
+ # Connection URLs for non-primary databases can also be configured using
56
+ # environment variables. The variable name is formed by concatenating the
57
+ # connection name with `_DATABASE_URL`. For example:
58
+ #
59
+ # CACHE_DATABASE_URL="trilogy://cacheuser:cachepass@localhost/cachedatabase"
60
+ #
61
+ <%- end -%>
54
62
  # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
55
63
  # for a full overview on how database connection configuration can be specified.
56
64
  #
@@ -38,7 +38,7 @@ env:
38
38
  <% if skip_solid? -%>
39
39
  # clear:
40
40
  # # Set number of cores available to the application on each server (default: 1).
41
- # WEB_CONCURRENCY: 2
41
+ # WEB_CONCURRENCY: auto
42
42
 
43
43
  # # Match this to any external database server to configure Active Record correctly
44
44
  # DB_HOST: 192.168.0.2
@@ -71,20 +71,23 @@ aliases:
71
71
  console: app exec --interactive --reuse "bin/rails console"
72
72
  shell: app exec --interactive --reuse "bash"
73
73
  logs: app logs -f
74
- dbc: app exec --interactive --reuse "bin/rails dbconsole"
74
+ dbc: app exec --interactive --reuse "bin/rails dbconsole --include-password"
75
75
 
76
- <% unless skip_storage? %>
76
+ <% unless skip_storage? -%>
77
77
  # Use a persistent storage volume for sqlite database files and local Active Storage files.
78
78
  # Recommended to change this to a mounted volume path that is backed up off server.
79
79
  volumes:
80
80
  - "<%= app_name %>_storage:/rails/storage"
81
81
 
82
- <% end %>
82
+ <% end -%>
83
+ <% unless options.api? -%>
83
84
  # Bridge fingerprinted assets, like JS and CSS, between versions to avoid
84
85
  # hitting 404 on in-flight requests. Combines all files from new and old
85
86
  # version inside the asset_path.
86
87
  asset_path: /rails/public/assets
87
88
 
89
+ <% end -%>
90
+
88
91
  # Configure the image builder.
89
92
  builder:
90
93
  arch: amd64
@@ -121,7 +124,7 @@ builder:
121
124
  # directories:
122
125
  # - data:/var/lib/mysql
123
126
  # redis:
124
- # image: redis:7.0
127
+ # image: valkey/valkey:8
125
128
  # host: 192.168.0.2
126
129
  # port: 6379
127
130
  # directories:
@@ -64,6 +64,14 @@ Rails.application.configure do
64
64
  # Highlight code that enqueued background job in logs.
65
65
  config.active_job.verbose_enqueue_logs = true
66
66
 
67
+ <%- end -%>
68
+ # Highlight code that triggered redirect in logs.
69
+ config.action_dispatch.verbose_redirect_logs = true
70
+
71
+ <%- unless options[:skip_asset_pipeline] -%>
72
+ # Suppress logger output for asset requests.
73
+ config.assets.quiet = true
74
+
67
75
  <%- end -%>
68
76
  # Raises error for missing translations.
69
77
  # config.i18n.raise_on_missing_translations = true
@@ -41,7 +41,7 @@ Rails.application.configure do
41
41
  config.log_tags = [ :request_id ]
42
42
  config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
43
43
 
44
- # Change to "debug" to log everything (including potentially personally-identifiable information!)
44
+ # Change to "debug" to log everything (including potentially personally-identifiable information!).
45
45
  config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
46
46
 
47
47
  # Prevent health checks from clogging up the logs.
@@ -66,7 +66,7 @@ Rails.application.configure do
66
66
  # Set host to be used by links generated in mailer templates.
67
67
  config.action_mailer.default_url_options = { host: "example.com" }
68
68
 
69
- # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
69
+ # Specify outgoing SMTP server. Remember to add smtp/* credentials via bin/rails credentials:edit.
70
70
  # config.action_mailer.smtp_settings = {
71
71
  # user_name: Rails.application.credentials.dig(:smtp, :user_name),
72
72
  # password: Rails.application.credentials.dig(:smtp, :password),
@@ -20,6 +20,10 @@
20
20
  # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21
21
  # config.content_security_policy_nonce_directives = %w(script-src style-src)
22
22
  #
23
+ # # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag`
24
+ # # if the corresponding directives are specified in `content_security_policy_nonce_directives`.
25
+ # # config.content_security_policy_nonce_auto = true
26
+ #
23
27
  # # Report violations without enforcing the policy.
24
28
  # # config.content_security_policy_report_only = true
25
29
  # end
@@ -0,0 +1,93 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file eases your Rails 8.1 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 `8.1`.
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
+ # Skips escaping HTML entities and line separators. When set to `false`, the
14
+ # JSON renderer no longer escapes these to improve performance.
15
+ #
16
+ # Example:
17
+ # class PostsController < ApplicationController
18
+ # def index
19
+ # render json: { key: "\u2028\u2029<>&" }
20
+ # end
21
+ # end
22
+ #
23
+ # Renders `{"key":"\u2028\u2029\u003c\u003e\u0026"}` with the previous default, but `{"key":"

<>&"}` with the config
24
+ # set to `false`.
25
+ #
26
+ # Applications that want to keep the escaping behavior can set the config to `true`.
27
+ #++
28
+ # Rails.configuration.action_controller.escape_json_responses = false
29
+
30
+ ###
31
+ # Skips escaping LINE SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) in JSON.
32
+ #
33
+ # Historically these characters were not valid inside JavaScript literal strings but that changed in ECMAScript 2019.
34
+ # As such it's no longer a concern in modern browsers: https://caniuse.com/mdn-javascript_builtins_json_json_superset.
35
+ #++
36
+ # Rails.configuration.active_support.escape_js_separators_in_json = false
37
+
38
+ ###
39
+ # Raises an error when order dependent finder methods (e.g. `#first`, `#second`) are called without `order` values
40
+ # on the relation, and the model does not have any order columns (`implicit_order_column`, `query_constraints`, or
41
+ # `primary_key`) to fall back on.
42
+ #
43
+ # The current behavior of not raising an error has been deprecated, and this configuration option will be removed in
44
+ # Rails 8.2.
45
+ #++
46
+ # Rails.configuration.active_record.raise_on_missing_required_finder_order_columns = true
47
+
48
+ ###
49
+ # Controls how Rails handles path relative URL redirects.
50
+ # When set to `:raise`, Rails will raise an `ActionController::Redirecting::UnsafeRedirectError`
51
+ # for relative URLs without a leading slash, which can help prevent open redirect vulnerabilities.
52
+ #
53
+ # Example:
54
+ # redirect_to "example.com" # Raises UnsafeRedirectError
55
+ # redirect_to "@attacker.com" # Raises UnsafeRedirectError
56
+ # redirect_to "/safe/path" # Works correctly
57
+ #
58
+ # Applications that want to allow these redirects can set the config to `:log` (previous default)
59
+ # to only log warnings, or `:notify` to send ActiveSupport notifications.
60
+ #++
61
+ # Rails.configuration.action_controller.action_on_path_relative_redirect = :raise
62
+
63
+ ###
64
+ # Controls how Rails handles open redirect vulnerabilities.
65
+ # When set to `:raise`, Rails will raise an `ActionController::Redirecting::UnsafeRedirectError`
66
+ # for redirects to external hosts, which helps prevent open redirect attacks.
67
+ #
68
+ # This configuration replaces the deprecated `raise_on_open_redirects` setting, providing
69
+ # the ability for large codebases to safely turn on the protection (after monitoring it with :log/:notifications)
70
+ #
71
+ # Example:
72
+ # redirect_to params[:redirect_url] # May raise UnsafeRedirectError if URL is external
73
+ # redirect_to "http://evil.com" # Raises UnsafeRedirectError
74
+ # redirect_to "/safe/path" # Works correctly (internal URL)
75
+ # redirect_to "http://evil.com", allow_other_host: true # Works (explicitly allowed)
76
+ #
77
+ # Applications that want to allow these redirects can set the config to `:log` (previous default)
78
+ # to only log warnings, or `:notify` to send ActiveSupport notifications for monitoring.
79
+ #
80
+ #++
81
+ # Rails.configuration.action_controller.action_on_open_redirect = :raise
82
+ ###
83
+ # Use a Ruby parser to track dependencies between Action View templates
84
+ #++
85
+ # Rails.configuration.action_view.render_tracker = :ruby
86
+
87
+ ###
88
+ # When enabled, hidden inputs generated by `form_tag`, `token_tag`, `method_tag`, and the hidden parameter fields
89
+ # included in `button_to` forms will omit the `autocomplete="off"` attribute.
90
+ #
91
+ # Applications that want to keep generating the `autocomplete` attribute for those tags can set it to `false`.
92
+ #++
93
+ # Rails.configuration.action_view.remove_hidden_field_autocomplete = true
@@ -7,7 +7,8 @@
7
7
  #
8
8
  # You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
9
9
  # should only set this value when you want to run 2 or more workers. The
10
- # default is already 1.
10
+ # default is already 1. You can set it to `auto` to automatically start a worker
11
+ # for each available processor.
11
12
  #
12
13
  # The ideal number of threads per worker depends both on how much time the
13
14
  # application spends waiting for IO operations and on how much you wish to
@@ -34,7 +35,7 @@ port ENV.fetch("PORT", 3000)
34
35
  plugin :tmp_restart
35
36
 
36
37
  <% unless skip_solid? -%>
37
- # Run the Solid Queue supervisor inside of Puma for single-server deployments
38
+ # Run the Solid Queue supervisor inside of Puma for single-server deployments.
38
39
  plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
39
40
 
40
41
  <% end -%>
@@ -21,13 +21,6 @@ local:
21
21
  # credentials: <%%= Rails.root.join("path/to/gcs.keyfile") %>
22
22
  # bucket: your_own_bucket-<%%= Rails.env %>
23
23
 
24
- # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
- # microsoft:
26
- # service: AzureStorage
27
- # storage_account_name: your_account_name
28
- # storage_access_key: <%%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
- # container: your_container_name-<%%= Rails.env %>
30
-
31
24
  # mirror:
32
25
  # service: Mirror
33
26
  # primary: local
@@ -1,11 +1,5 @@
1
1
  #!/bin/bash -e
2
2
 
3
- # Enable jemalloc for reduced memory usage and latency.
4
- if [ -z "${LD_PRELOAD+x}" ]; then
5
- LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
6
- export LD_PRELOAD
7
- fi
8
-
9
3
  <% unless skip_active_record? -%>
10
4
  # If running the rails server then create or migrate existing database
11
5
  if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
@@ -3,39 +3,44 @@ name: CI
3
3
  on:
4
4
  pull_request:
5
5
  push:
6
- branches: [ main ]
6
+ branches: [ <%= user_default_branch %> ]
7
7
 
8
8
  jobs:
9
- <%- unless skip_brakeman? -%>
9
+ <%- unless skip_brakeman? && skip_bundler_audit? -%>
10
10
  scan_ruby:
11
11
  runs-on: ubuntu-latest
12
12
 
13
13
  steps:
14
14
  - name: Checkout code
15
- uses: actions/checkout@v4
15
+ uses: actions/checkout@v5
16
16
 
17
17
  - name: Set up Ruby
18
18
  uses: ruby/setup-ruby@v1
19
19
  with:
20
- ruby-version: .ruby-version
21
20
  bundler-cache: true
22
21
 
22
+ <%- unless skip_brakeman? %>
23
23
  - name: Scan for common Rails security vulnerabilities using static analysis
24
24
  run: bin/brakeman --no-pager
25
+ <% end %>
26
+
27
+ <%- unless skip_bundler_audit? -%>
28
+ - name: Scan for known security vulnerabilities in gems used
29
+ run: bin/bundler-audit
30
+ <% end %>
25
31
 
26
32
  <% end -%>
27
- <%- if options[:javascript] == "importmap" && !options[:api] && !options[:skip_javascript] -%>
33
+ <%- if using_importmap? -%>
28
34
  scan_js:
29
35
  runs-on: ubuntu-latest
30
36
 
31
37
  steps:
32
38
  - name: Checkout code
33
- uses: actions/checkout@v4
39
+ uses: actions/checkout@v5
34
40
 
35
41
  - name: Set up Ruby
36
42
  uses: ruby/setup-ruby@v1
37
43
  with:
38
- ruby-version: .ruby-version
39
44
  bundler-cache: true
40
45
 
41
46
  - name: Scan for security vulnerabilities in JavaScript dependencies
@@ -45,16 +50,27 @@ jobs:
45
50
  <%- unless skip_rubocop? -%>
46
51
  lint:
47
52
  runs-on: ubuntu-latest
53
+ env:
54
+ RUBOCOP_CACHE_ROOT: tmp/rubocop
48
55
  steps:
49
56
  - name: Checkout code
50
- uses: actions/checkout@v4
57
+ uses: actions/checkout@v5
51
58
 
52
59
  - name: Set up Ruby
53
60
  uses: ruby/setup-ruby@v1
54
61
  with:
55
- ruby-version: .ruby-version
56
62
  bundler-cache: true
57
63
 
64
+ - name: Prepare RuboCop cache
65
+ uses: actions/cache@v4
66
+ env:
67
+ DEPENDENCIES_HASH: ${{ hashFiles('.ruby-version', '**/.rubocop.yml', '**/.rubocop_todo.yml', 'Gemfile.lock') }}
68
+ with:
69
+ path: ${{ env.RUBOCOP_CACHE_ROOT }}
70
+ key: rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}-${{ github.ref_name == github.event.repository.default_branch && github.run_id || 'default' }}
71
+ restore-keys: |
72
+ rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}-
73
+
58
74
  - name: Lint code for consistent style
59
75
  run: bin/rubocop -f github
60
76
 
@@ -66,7 +82,7 @@ jobs:
66
82
  <%- if options[:database] == "sqlite3" -%>
67
83
  # services:
68
84
  # redis:
69
- # image: redis
85
+ # image: valkey/valkey:8
70
86
  # ports:
71
87
  # - 6379:6379
72
88
  # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
@@ -92,23 +108,24 @@ jobs:
92
108
  <%- end -%>
93
109
 
94
110
  # redis:
95
- # image: redis
111
+ # image: valkey/valkey:8
96
112
  # ports:
97
113
  # - 6379:6379
98
114
  # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
99
115
 
100
116
  <%- end -%>
101
117
  steps:
118
+ <%- unless ci_packages.empty? -%>
102
119
  - name: Install packages
103
120
  run: sudo apt-get update && sudo apt-get install --no-install-recommends -y <%= ci_packages.join(" ") %>
104
121
 
122
+ <%- end -%>
105
123
  - name: Checkout code
106
- uses: actions/checkout@v4
124
+ uses: actions/checkout@v5
107
125
 
108
126
  - name: Set up Ruby
109
127
  uses: ruby/setup-ruby@v1
110
128
  with:
111
- ruby-version: .ruby-version
112
129
  bundler-cache: true
113
130
  <%- if using_bun? -%>
114
131
 
@@ -127,13 +144,82 @@ jobs:
127
144
  <%- elsif options[:database] == "postgresql" -%>
128
145
  DATABASE_URL: postgres://postgres:postgres@localhost:5432
129
146
  <%- end -%>
147
+ # RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
130
148
  # REDIS_URL: redis://localhost:6379/0
131
- <%- if options[:api] || options[:skip_system_test] -%>
132
- run: bin/rails db:test:prepare test
133
- <%- else -%>
134
- run: bin/rails db:test:prepare test test:system
135
- <%- end -%>
136
- <%- unless options[:api] || options[:skip_system_test] -%>
149
+ run: bin/rails <%= "db:test:prepare " unless skip_active_record? %>test
150
+ <%- unless options[:api] || options[:skip_system_test] -%>
151
+
152
+ system-test:
153
+ runs-on: ubuntu-latest
154
+
155
+ <%- if options[:database] == "sqlite3" -%>
156
+ # services:
157
+ # redis:
158
+ # image: valkey/valkey:8
159
+ # ports:
160
+ # - 6379:6379
161
+ # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
162
+ <%- else -%>
163
+ services:
164
+ <%- if options[:database] == "mysql" || options[:database] == "trilogy" -%>
165
+ mysql:
166
+ image: mysql
167
+ env:
168
+ MYSQL_ALLOW_EMPTY_PASSWORD: true
169
+ ports:
170
+ - 3306:3306
171
+ options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
172
+ <%- elsif options[:database] == "postgresql" -%>
173
+ postgres:
174
+ image: postgres
175
+ env:
176
+ POSTGRES_USER: postgres
177
+ POSTGRES_PASSWORD: postgres
178
+ ports:
179
+ - 5432:5432
180
+ options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
181
+ <%- end -%>
182
+
183
+ # redis:
184
+ # image: valkey/valkey:8
185
+ # ports:
186
+ # - 6379:6379
187
+ # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
188
+
189
+ <%- end -%>
190
+ steps:
191
+ <%- unless ci_packages.empty? -%>
192
+ - name: Install packages
193
+ run: sudo apt-get update && sudo apt-get install --no-install-recommends -y <%= ci_packages.join(" ") %>
194
+
195
+ <%- end -%>
196
+ - name: Checkout code
197
+ uses: actions/checkout@v5
198
+
199
+ - name: Set up Ruby
200
+ uses: ruby/setup-ruby@v1
201
+ with:
202
+ bundler-cache: true
203
+ <%- if using_bun? -%>
204
+
205
+ - uses: oven-sh/setup-bun@v1
206
+ with:
207
+ bun-version: <%= dockerfile_bun_version %>
208
+ <%- end -%>
209
+
210
+ - name: Run System Tests
211
+ env:
212
+ RAILS_ENV: test
213
+ <%- if options[:database] == "mysql" -%>
214
+ DATABASE_URL: mysql2://127.0.0.1:3306
215
+ <%- elsif options[:database] == "trilogy" -%>
216
+ DATABASE_URL: trilogy://127.0.0.1:3306
217
+ <%- elsif options[:database] == "postgresql" -%>
218
+ DATABASE_URL: postgres://postgres:postgres@localhost:5432
219
+ <%- end -%>
220
+ # RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
221
+ # REDIS_URL: redis://localhost:6379/0
222
+ run: bin/rails <%= "db:test:prepare " unless skip_active_record? %>test:system
137
223
 
138
224
  - name: Keep screenshots from failed system tests
139
225
  uses: actions/upload-artifact@v4
@@ -142,5 +228,5 @@ jobs:
142
228
  name: screenshots
143
229
  path: ${{ github.workspace }}/tmp/screenshots
144
230
  if-no-files-found: ignore
145
- <%- end -%>
146
- <% end -%>
231
+ <%- end -%>
232
+ <%- end -%>
@@ -3,10 +3,10 @@ updates:
3
3
  - package-ecosystem: bundler
4
4
  directory: "/"
5
5
  schedule:
6
- interval: daily
6
+ interval: weekly
7
7
  open-pull-requests-limit: 10
8
8
  - package-ecosystem: github-actions
9
9
  directory: "/"
10
10
  schedule:
11
- interval: daily
11
+ interval: weekly
12
12
  open-pull-requests-limit: 10
@@ -7,6 +7,9 @@
7
7
  # KAMAL_REGISTRY_PASSWORD=$(kamal secrets extract KAMAL_REGISTRY_PASSWORD ${SECRETS})
8
8
  # RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY ${SECRETS})
9
9
 
10
+ # Example of extracting secrets from Rails credentials
11
+ # KAMAL_REGISTRY_PASSWORD=$(rails credentials:fetch kamal.registry_password)
12
+
10
13
  # Use a GITHUB_TOKEN if private repositories are needed for the image
11
14
  # GITHUB_TOKEN=$(gh config get -h github.com oauth_token)
12
15
 
@@ -105,7 +105,7 @@
105
105
  <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm140.456 133.2831c-40.823 0-64.884-35.146-64.884-85.7015 0-50.5554 24.061-85.700907 64.884-85.700907 40.822 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.062 85.7015-64.884 85.7015zm0-133.2831c-17.573 0-22.71 21.8984-22.71 47.5816 0 25.6835 5.137 47.5815 22.71 47.5815 17.302 0 22.709-21.898 22.709-47.5815 0-25.6832-5.407-47.5816-22.709-47.5816z" fill="#f0eff0"/><path d="m123.606 85.4445c3.212 1.0523 5.538 4.2089 5.538 8.0301 0 6.1472-4.209 9.5254-11.298 9.5254h-15.617v-34.0033h14.565c7.089 0 11.353 3.1566 11.353 9.2484 0 3.6551-2.049 6.3134-4.541 7.1994zm-12.904-2.9905h5.095c2.603 0 3.988-.9968 3.988-3.1013 0-2.1044-1.385-3.0459-3.988-3.0459h-5.095zm0 6.6456v6.5902h5.981c2.492 0 3.877-1.3291 3.877-3.2674 0-2.049-1.385-3.3228-3.877-3.3228zm43.786 13.9004h-8.362v-1.274c-.831.831-3.323 1.717-5.981 1.717-4.929 0-9.083-2.769-9.083-8.0301 0-4.818 4.154-7.9193 9.581-7.9193 2.049 0 4.486.6646 5.483 1.3845v-1.606c0-1.606-.942-2.9905-3.046-2.9905-1.606 0-2.548.7199-2.935 1.8275h-8.197c.72-4.8181 4.985-8.6393 11.409-8.6393 7.088 0 11.131 3.7659 11.131 10.2453zm-8.362-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.434.7199-3.434 2.3813 0 1.7168 1.717 2.4367 3.434 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm27.996 6.9779v-1.994c-1.163 1.329-3.599 2.548-6.147 2.548-7.199 0-11.131-5.8151-11.131-13.0145s3.932-13.0143 11.131-13.0143c2.548 0 4.984 1.2184 6.147 2.5475v-13.0697h8.695v35.997zm0-9.1931v-6.5902c-.664-1.3291-2.159-2.326-3.821-2.326-2.99 0-4.763 2.4368-4.763 5.6488s1.773 5.5934 4.763 5.5934c1.717 0 3.157-.9415 3.821-2.326zm35.471-2.049h-3.101v11.2421h-8.806v-34.0033h15.285c7.31 0 12.35 4.1535 12.35 11.5744 0 5.1503-2.603 8.6947-6.757 10.2453l7.975 12.1836h-9.858zm-3.101-15.2849v8.1962h5.538c3.156 0 4.596-1.606 4.596-4.0981s-1.44-4.0981-4.596-4.0981zm36.957 17.8323h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm30.98 27.5234v-10.799c-1.163 1.329-3.6 2.548-6.147 2.548-7.2 0-11.132-5.9259-11.132-13.0145 0-7.144 3.932-13.0143 11.132-13.0143 2.547 0 4.984 1.2184 6.147 2.5475v-1.9937h8.695v33.726zm0-17.9981v-6.5902c-.665-1.3291-2.105-2.326-3.821-2.326-2.991 0-4.763 2.4368-4.763 5.6488s1.772 5.5934 4.763 5.5934c1.661 0 3.156-.9415 3.821-2.326zm36.789-15.7279v24.921h-8.695v-2.16c-1.329 1.551-3.821 2.714-6.646 2.714-5.482 0-8.75-3.5999-8.75-9.1379v-16.3371h8.64v14.288c0 2.1045.996 3.5997 3.212 3.5997 1.606 0 3.101-1.0522 3.544-2.769v-15.1187zm19.084 16.2263h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.963 5.095 11.963 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm13.428 11.0206h8.474c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.939-1.5506l-4.873-.9969c-4.154-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.762-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.741-8.2518zm27.538-.8861v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.993-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.871 0-9.193-2.769-9.193-9.0819z" fill="#d30001"/></svg>
106
106
  </header>
107
107
  <article>
108
- <p><strong>The server cannot process the request due to a client error.</strong> Please check the request and try again. If youre the application owner check the logs for more information.</p>
108
+ <p><strong>The server cannot process the request due to a client error.</strong> Please check the request and try again. If you're the application owner check the logs for more information.</p>
109
109
  </article>
110
110
  </main>
111
111
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  <head>
6
6
 
7
- <title>The page you were looking for doesnt exist (404 Not found)</title>
7
+ <title>The page you were looking for doesn't exist (404 Not found)</title>
8
8
 
9
9
  <meta charset="utf-8">
10
10
  <meta name="viewport" content="initial-scale=1, width=device-width">
@@ -105,7 +105,7 @@
105
105
  <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm165.328-35.41581-45.689 100.02991h26.224v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.184v-31.901l50.285-103.27391z" fill="#f0eff0"/><path d="m157.758 68.9967v34.0033h-7.199l-14.233-19.8814v19.8814h-8.584v-34.0033h8.307l13.125 18.7184v-18.7184zm28.454 21.5428c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.528 0c0-3.4336-1.496-5.8703-4.209-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.209-2.3813 4.209-5.8149zm13.184 3.8766v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm37.027 8.5839h-8.806v-34.0033h23.924v7.6978h-15.118v6.7564h13.9v7.5316h-13.9zm41.876-12.4605c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm35.337-12.4605v24.921h-8.695v-2.16c-1.329 1.551-3.821 2.714-6.646 2.714-5.482 0-8.75-3.5999-8.75-9.1379v-16.3371h8.64v14.288c0 2.1045.997 3.5997 3.212 3.5997 1.606 0 3.101-1.0522 3.544-2.769v-15.1187zm4.076 24.921v-24.921h8.694v2.1598c1.385-1.5506 3.822-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.639v-14.2327c0-2.049-1.053-3.5443-3.268-3.5443-1.717 0-3.156.9969-3.6 2.7136v15.0634zm44.113 0v-1.994c-1.163 1.329-3.6 2.548-6.147 2.548-7.2 0-11.132-5.8151-11.132-13.0145s3.932-13.0143 11.132-13.0143c2.547 0 4.984 1.2184 6.147 2.5475v-13.0697h8.695v35.997zm0-9.1931v-6.5902c-.665-1.3291-2.16-2.326-3.821-2.326-2.991 0-4.763 2.4368-4.763 5.6488s1.772 5.5934 4.763 5.5934c1.717 0 3.156-.9415 3.821-2.326z" fill="#d30001"/></svg>
106
106
  </header>
107
107
  <article>
108
- <p><strong>The page you were looking for doesnt exist.</strong> You may have mistyped the address or the page may have moved. If youre the application owner check the logs for more information.</p>
108
+ <p><strong>The page you were looking for doesn't exist.</strong> You may have mistyped the address or the page may have moved. If you're the application owner check the logs for more information.</p>
109
109
  </article>
110
110
  </main>
111
111