railties 8.0.3 → 8.1.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 +101 -206
 - data/lib/minitest/rails_plugin.rb +48 -12
 - data/lib/rails/application/bootstrap.rb +5 -0
 - data/lib/rails/application/configuration.rb +31 -9
 - data/lib/rails/application/default_middleware_stack.rb +1 -1
 - data/lib/rails/application/finisher.rb +2 -1
 - data/lib/rails/application/routes_reloader.rb +0 -1
 - data/lib/rails/application.rb +1 -3
 - data/lib/rails/code_statistics.rb +4 -1
 - data/lib/rails/command/base.rb +0 -2
 - data/lib/rails/command/environment_argument.rb +0 -1
 - data/lib/rails/command.rb +1 -1
 - data/lib/rails/commands/app/update_command.rb +1 -0
 - data/lib/rails/commands/console/irb_console.rb +4 -4
 - data/lib/rails/commands/credentials/credentials_command.rb +25 -5
 - data/lib/rails/commands/encrypted/encrypted_command.rb +0 -1
 - data/lib/rails/engine.rb +0 -1
 - data/lib/rails/gem_version.rb +2 -2
 - data/lib/rails/generators/actions.rb +2 -3
 - data/lib/rails/generators/app_base.rb +49 -28
 - data/lib/rails/generators/database.rb +1 -1
 - data/lib/rails/generators/erb/authentication/authentication_generator.rb +2 -0
 - data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +2 -2
 - data/lib/rails/generators/generated_attribute.rb +1 -1
 - data/lib/rails/generators/migration.rb +0 -1
 - data/lib/rails/generators/rails/app/app_generator.rb +16 -5
 - data/lib/rails/generators/rails/app/templates/Dockerfile.tt +19 -15
 - data/lib/rails/generators/rails/app/templates/Gemfile.tt +6 -1
 - data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +5 -0
 - data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +1 -0
 - data/lib/rails/generators/rails/app/templates/bin/bundler-audit.tt +5 -0
 - data/lib/rails/generators/rails/app/templates/bin/ci.tt +5 -0
 - data/lib/rails/generators/rails/app/templates/bin/rubocop.tt +1 -1
 - data/lib/rails/generators/rails/app/templates/bin/setup.tt +1 -0
 - data/lib/rails/generators/rails/app/templates/config/bundler-audit.yml.tt +5 -0
 - data/lib/rails/generators/rails/app/templates/config/ci.rb.tt +38 -0
 - data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +9 -1
 - data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +10 -2
 - data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
 - data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +9 -1
 - data/lib/rails/generators/rails/app/templates/config/deploy.yml.tt +21 -16
 - data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +8 -0
 - data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +2 -2
 - data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +4 -0
 - data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_1.rb.tt +74 -0
 - data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +3 -2
 - data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +0 -7
 - data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +0 -6
 - data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +107 -21
 - data/lib/rails/generators/rails/app/templates/github/dependabot.yml +2 -2
 - data/lib/rails/generators/rails/app/templates/kamal-secrets.tt +4 -1
 - data/lib/rails/generators/rails/app/templates/public/400.html +26 -5
 - data/lib/rails/generators/rails/app/templates/public/404.html +27 -6
 - data/lib/rails/generators/rails/app/templates/public/406-unsupported-browser.html +25 -4
 - data/lib/rails/generators/rails/app/templates/public/422.html +26 -5
 - data/lib/rails/generators/rails/app/templates/public/500.html +27 -6
 - data/lib/rails/generators/rails/authentication/authentication_generator.rb +8 -6
 - data/lib/rails/generators/rails/authentication/templates/app/controllers/passwords_controller.rb.tt +6 -0
 - data/lib/rails/generators/rails/authentication/templates/app/controllers/sessions_controller.rb.tt +2 -2
 - data/lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt +3 -1
 - data/lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt +3 -1
 - data/lib/rails/generators/rails/benchmark/USAGE +1 -1
 - data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +0 -2
 - data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +1 -1
 - data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +4 -0
 - data/lib/rails/generators/rails/devcontainer/templates/devcontainer/compose.yaml.tt +2 -2
 - data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +1 -1
 - data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +17 -5
 - data/lib/rails/generators/rails/master_key/master_key_generator.rb +0 -12
 - data/lib/rails/generators/rails/plugin/plugin_generator.rb +1 -0
 - data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +0 -4
 - data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +20 -9
 - data/lib/rails/generators/rails/plugin/templates/github/dependabot.yml +2 -2
 - data/lib/rails/generators/rails/script/USAGE +1 -1
 - data/lib/rails/generators/test_unit/authentication/authentication_generator.rb +13 -0
 - data/lib/rails/generators/test_unit/authentication/templates/test/controllers/passwords_controller_test.rb.tt +67 -0
 - data/lib/rails/generators/test_unit/authentication/templates/test/controllers/sessions_controller_test.rb +33 -0
 - data/lib/rails/generators/test_unit/authentication/templates/test/models/user_test.rb.tt +4 -3
 - data/lib/rails/generators/test_unit/authentication/templates/test/test_helpers/session_test_helper.rb.tt +19 -0
 - data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +1 -1
 - data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +4 -2
 - data/lib/rails/generators/testing/behavior.rb +0 -3
 - data/lib/rails/generators.rb +3 -1
 - data/lib/rails/health_controller.rb +8 -2
 - data/lib/rails/info.rb +4 -5
 - data/lib/rails/info_controller.rb +4 -5
 - data/lib/rails/initializable.rb +63 -19
 - data/lib/rails/rack/silence_request.rb +5 -2
 - data/lib/rails/railtie/configurable.rb +0 -1
 - data/lib/rails/railtie.rb +0 -1
 - data/lib/rails/tasks/statistics.rake +3 -21
 - data/lib/rails/tasks.rb +1 -3
 - data/lib/rails/templates/rails/info/notes.html.erb +23 -0
 - data/lib/rails/templates/rails/mailers/email.html.erb +2 -1
 - data/lib/rails/templates/rails/welcome/index.html.erb +19 -3
 - data/lib/rails/test_unit/reporter.rb +5 -4
 - data/lib/rails/test_unit/runner.rb +8 -5
 - data/lib/rails.rb +9 -2
 - metadata +18 -15
 - data/lib/rails/console/methods.rb +0 -7
 - data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_0.rb.tt +0 -30
 - data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +0 -15
 - data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +0 -7
 - 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 
     | 
    
         
            -
               
     | 
| 
      
 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=/ 
     | 
| 
      
 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 
     | 
    
         
            -
               
     | 
| 
      
 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 
     | 
    
         
             
            #
         
     | 
| 
         @@ -12,7 +12,7 @@ 
     | 
|
| 
       12 
12 
     | 
    
         
             
            default: &default
         
     | 
| 
       13 
13 
     | 
    
         
             
              adapter: trilogy
         
     | 
| 
       14 
14 
     | 
    
         
             
              encoding: utf8mb4
         
     | 
| 
       15 
     | 
    
         
            -
               
     | 
| 
      
 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 
     | 
    
         
             
            #
         
     | 
| 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Name of your application. Used to uniquely configure containers.
         
     | 
| 
       2 
2 
     | 
    
         
             
            service: <%= app_name %>
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
            # Name of the container image.
         
     | 
| 
       5 
     | 
    
         
            -
            image:  
     | 
| 
      
 4 
     | 
    
         
            +
            # Name of the container image (use your-user/app-name on external registries).
         
     | 
| 
      
 5 
     | 
    
         
            +
            image: <%= app_name %>
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            # Deploy to these servers.
         
     | 
| 
       8 
8 
     | 
    
         
             
            servers:
         
     | 
| 
         @@ -17,19 +17,21 @@ servers: 
     | 
|
| 
       17 
17 
     | 
    
         
             
            # Remove this section when using multiple web servers and ensure you terminate SSL at your load balancer.
         
     | 
| 
       18 
18 
     | 
    
         
             
            #
         
     | 
| 
       19 
19 
     | 
    
         
             
            # Note: If using Cloudflare, set encryption mode in SSL/TLS setting to "Full" to enable CF-to-app encryption.
         
     | 
| 
       20 
     | 
    
         
            -
            proxy:
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
            # proxy:
         
     | 
| 
      
 21 
     | 
    
         
            +
            #   ssl: true
         
     | 
| 
      
 22 
     | 
    
         
            +
            #   host: app.example.com
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
            #  
     | 
| 
      
 24 
     | 
    
         
            +
            # Where you keep your container images.
         
     | 
| 
       25 
25 
     | 
    
         
             
            registry:
         
     | 
| 
       26 
     | 
    
         
            -
              #  
     | 
| 
       27 
     | 
    
         
            -
               
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 26 
     | 
    
         
            +
              # Alternatives: hub.docker.com / registry.digitalocean.com / ghcr.io / ...
         
     | 
| 
      
 27 
     | 
    
         
            +
              server: localhost:5555
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              # Needed for authenticated registries.
         
     | 
| 
      
 30 
     | 
    
         
            +
              # username: your-user
         
     | 
| 
       29 
31 
     | 
    
         | 
| 
       30 
32 
     | 
    
         
             
              # Always use an access token rather than real password when possible.
         
     | 
| 
       31 
     | 
    
         
            -
              password:
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
      
 33 
     | 
    
         
            +
              # password:
         
     | 
| 
      
 34 
     | 
    
         
            +
              #   - KAMAL_REGISTRY_PASSWORD
         
     | 
| 
       33 
35 
     | 
    
         | 
| 
       34 
36 
     | 
    
         
             
            # Inject ENV variables into containers (secrets come from .kamal/secrets).
         
     | 
| 
       35 
37 
     | 
    
         
             
            env:
         
     | 
| 
         @@ -38,7 +40,7 @@ env: 
     | 
|
| 
       38 
40 
     | 
    
         
             
            <% if skip_solid? -%>
         
     | 
| 
       39 
41 
     | 
    
         
             
              # clear:
         
     | 
| 
       40 
42 
     | 
    
         
             
              #   # Set number of cores available to the application on each server (default: 1).
         
     | 
| 
       41 
     | 
    
         
            -
              #   WEB_CONCURRENCY:  
     | 
| 
      
 43 
     | 
    
         
            +
              #   WEB_CONCURRENCY: auto
         
     | 
| 
       42 
44 
     | 
    
         | 
| 
       43 
45 
     | 
    
         
             
              #   # Match this to any external database server to configure Active Record correctly
         
     | 
| 
       44 
46 
     | 
    
         
             
              #   DB_HOST: 192.168.0.2
         
     | 
| 
         @@ -71,20 +73,23 @@ aliases: 
     | 
|
| 
       71 
73 
     | 
    
         
             
              console: app exec --interactive --reuse "bin/rails console"
         
     | 
| 
       72 
74 
     | 
    
         
             
              shell: app exec --interactive --reuse "bash"
         
     | 
| 
       73 
75 
     | 
    
         
             
              logs: app logs -f
         
     | 
| 
       74 
     | 
    
         
            -
              dbc: app exec --interactive --reuse "bin/rails dbconsole"
         
     | 
| 
      
 76 
     | 
    
         
            +
              dbc: app exec --interactive --reuse "bin/rails dbconsole --include-password"
         
     | 
| 
       75 
77 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
            <% unless skip_storage?  
     | 
| 
      
 78 
     | 
    
         
            +
            <% unless skip_storage? -%>
         
     | 
| 
       77 
79 
     | 
    
         
             
            # Use a persistent storage volume for sqlite database files and local Active Storage files.
         
     | 
| 
       78 
80 
     | 
    
         
             
            # Recommended to change this to a mounted volume path that is backed up off server.
         
     | 
| 
       79 
81 
     | 
    
         
             
            volumes:
         
     | 
| 
       80 
82 
     | 
    
         
             
              - "<%= app_name %>_storage:/rails/storage"
         
     | 
| 
       81 
83 
     | 
    
         | 
| 
       82 
     | 
    
         
            -
            <% end  
     | 
| 
      
 84 
     | 
    
         
            +
            <% end -%>
         
     | 
| 
      
 85 
     | 
    
         
            +
            <% unless options.api? -%>
         
     | 
| 
       83 
86 
     | 
    
         
             
            # Bridge fingerprinted assets, like JS and CSS, between versions to avoid
         
     | 
| 
       84 
87 
     | 
    
         
             
            # hitting 404 on in-flight requests. Combines all files from new and old
         
     | 
| 
       85 
88 
     | 
    
         
             
            # version inside the asset_path.
         
     | 
| 
       86 
89 
     | 
    
         
             
            asset_path: /rails/public/assets
         
     | 
| 
       87 
90 
     | 
    
         | 
| 
      
 91 
     | 
    
         
            +
            <% end -%>
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
       88 
93 
     | 
    
         
             
            # Configure the image builder.
         
     | 
| 
       89 
94 
     | 
    
         
             
            builder:
         
     | 
| 
       90 
95 
     | 
    
         
             
              arch: amd64
         
     | 
| 
         @@ -121,7 +126,7 @@ builder: 
     | 
|
| 
       121 
126 
     | 
    
         
             
            #     directories:
         
     | 
| 
       122 
127 
     | 
    
         
             
            #       - data:/var/lib/mysql
         
     | 
| 
       123 
128 
     | 
    
         
             
            #   redis:
         
     | 
| 
       124 
     | 
    
         
            -
            #     image:  
     | 
| 
      
 129 
     | 
    
         
            +
            #     image: valkey/valkey:8
         
     | 
| 
       125 
130 
     | 
    
         
             
            #     host: 192.168.0.2
         
     | 
| 
       126 
131 
     | 
    
         
             
            #     port: 6379
         
     | 
| 
       127 
132 
     | 
    
         
             
            #     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),
         
     | 
    
        data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt
    CHANGED
    
    | 
         @@ -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
         
     | 
    
        data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_1.rb.tt
    ADDED
    
    | 
         @@ -0,0 +1,74 @@ 
     | 
|
| 
      
 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 
     | 
    
         
            +
            # Use a Ruby parser to track dependencies between Action View templates
         
     | 
| 
      
 65 
     | 
    
         
            +
            #++
         
     | 
| 
      
 66 
     | 
    
         
            +
            # Rails.configuration.action_view.render_tracker = :ruby
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            ###
         
     | 
| 
      
 69 
     | 
    
         
            +
            # When enabled, hidden inputs generated by `form_tag`, `token_tag`, `method_tag`, and the hidden parameter fields
         
     | 
| 
      
 70 
     | 
    
         
            +
            # included in `button_to` forms will omit the `autocomplete="off"` attribute.
         
     | 
| 
      
 71 
     | 
    
         
            +
            #
         
     | 
| 
      
 72 
     | 
    
         
            +
            # Applications that want to keep generating the `autocomplete` attribute for those tags can set it to `false`.
         
     | 
| 
      
 73 
     | 
    
         
            +
            #++
         
     | 
| 
      
 74 
     | 
    
         
            +
            # 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: [  
     | 
| 
      
 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@ 
     | 
| 
      
 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
         
     | 
| 
      
 21 
     | 
    
         
            +
                  <%- unless skip_brakeman? -%>
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
                  - name: Scan for common Rails security vulnerabilities using static analysis
         
     | 
| 
       24 
24 
     | 
    
         
             
                    run: bin/brakeman --no-pager
         
     | 
| 
      
 25 
     | 
    
         
            +
                  <% end -%>
         
     | 
| 
      
 26 
     | 
    
         
            +
                  <%- unless skip_bundler_audit? -%>
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                  - name: Scan for known security vulnerabilities in gems used
         
     | 
| 
      
 29 
     | 
    
         
            +
                    run: bin/bundler-audit
         
     | 
| 
      
 30 
     | 
    
         
            +
                  <% end -%>
         
     | 
| 
       25 
31 
     | 
    
         | 
| 
       26 
32 
     | 
    
         
             
            <% end -%>
         
     | 
| 
       27 
     | 
    
         
            -
            <%- if  
     | 
| 
      
 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@ 
     | 
| 
      
 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@ 
     | 
| 
      
 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:  
     | 
| 
      
 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:  
     | 
| 
      
 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@ 
     | 
| 
      
 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 
     | 
    
         
            -
                     
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
      
 231 
     | 
    
         
            +
              <%- end -%>
         
     | 
| 
      
 232 
     | 
    
         
            +
            <%- end -%>
         
     | 
| 
         @@ -3,10 +3,10 @@ updates: 
     | 
|
| 
       3 
3 
     | 
    
         
             
            - package-ecosystem: bundler
         
     | 
| 
       4 
4 
     | 
    
         
             
              directory: "/"
         
     | 
| 
       5 
5 
     | 
    
         
             
              schedule:
         
     | 
| 
       6 
     | 
    
         
            -
                interval:  
     | 
| 
      
 6 
     | 
    
         
            +
                interval: weekly
         
     | 
| 
       7 
7 
     | 
    
         
             
              open-pull-requests-limit: 10
         
     | 
| 
       8 
8 
     | 
    
         
             
            - package-ecosystem: github-actions
         
     | 
| 
       9 
9 
     | 
    
         
             
              directory: "/"
         
     | 
| 
       10 
10 
     | 
    
         
             
              schedule:
         
     | 
| 
       11 
     | 
    
         
            -
                interval:  
     | 
| 
      
 11 
     | 
    
         
            +
                interval: weekly
         
     | 
| 
       12 
12 
     | 
    
         
             
              open-pull-requests-limit: 10
         
     | 
| 
         @@ -7,11 +7,14 @@ 
     | 
|
| 
       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 
     | 
    
         | 
| 
       13 
16 
     | 
    
         
             
            # Grab the registry password from ENV
         
     | 
| 
       14 
     | 
    
         
            -
            KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
         
     | 
| 
      
 17 
     | 
    
         
            +
            # KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
         
     | 
| 
       15 
18 
     | 
    
         | 
| 
       16 
19 
     | 
    
         
             
            # Improve security by using a password manager. Never check config/master.key into git!
         
     | 
| 
       17 
20 
     | 
    
         
             
            RAILS_MASTER_KEY=$(cat config/master.key)
         
     |