railties 7.2.0 → 8.0.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +111 -254
  3. data/lib/minitest/rails_plugin.rb +1 -1
  4. data/lib/rails/application/configuration.rb +15 -2
  5. data/lib/rails/application/default_middleware_stack.rb +4 -0
  6. data/lib/rails/application/finisher.rb +2 -2
  7. data/lib/rails/application/routes_reloader.rb +11 -1
  8. data/lib/rails/application.rb +12 -0
  9. data/lib/rails/code_statistics.rb +128 -86
  10. data/lib/rails/code_statistics_calculator.rb +78 -76
  11. data/lib/rails/command/helpers/editor.rb +1 -1
  12. data/lib/rails/commands/app/update_command.rb +10 -9
  13. data/lib/rails/commands/console/irb_console.rb +1 -2
  14. data/lib/rails/commands/credentials/USAGE +4 -4
  15. data/lib/rails/commands/credentials/credentials_command.rb +5 -1
  16. data/lib/rails/commands/dev/dev_command.rb +1 -1
  17. data/lib/rails/commands/devcontainer/devcontainer_command.rb +1 -1
  18. data/lib/rails/commands/stats/stats_command.rb +19 -0
  19. data/lib/rails/dev_caching.rb +2 -2
  20. data/lib/rails/engine/configuration.rb +3 -1
  21. data/lib/rails/engine/lazy_route_set.rb +109 -0
  22. data/lib/rails/engine.rb +10 -5
  23. data/lib/rails/gem_version.rb +3 -3
  24. data/lib/rails/generators/app_base.rb +46 -24
  25. data/lib/rails/generators/database.rb +102 -68
  26. data/lib/rails/generators/erb/authentication/authentication_generator.rb +15 -0
  27. data/lib/rails/generators/erb/authentication/templates/views/passwords/edit.html.erb +9 -0
  28. data/lib/rails/generators/erb/authentication/templates/views/passwords/new.html.erb +8 -0
  29. data/lib/rails/generators/erb/authentication/templates/views/sessions/new.html.erb +11 -0
  30. data/lib/rails/generators/generated_attribute.rb +16 -11
  31. data/lib/rails/generators/rails/app/app_generator.rb +22 -32
  32. data/lib/rails/generators/rails/app/templates/Dockerfile.tt +12 -3
  33. data/lib/rails/generators/rails/app/templates/Gemfile.tt +23 -8
  34. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +6 -11
  35. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +10 -3
  36. data/lib/rails/generators/rails/app/templates/app/views/pwa/service-worker.js +3 -3
  37. data/lib/rails/generators/rails/app/templates/bin/dev.tt +1 -0
  38. data/lib/rails/generators/rails/app/templates/bin/setup.tt +5 -7
  39. data/lib/rails/generators/rails/app/templates/bin/thrust.tt +4 -0
  40. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +23 -0
  41. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +23 -0
  42. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +40 -0
  43. data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +23 -0
  44. data/lib/rails/generators/rails/app/templates/config/deploy.yml.tt +124 -0
  45. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +12 -23
  46. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +34 -51
  47. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +5 -19
  48. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +0 -7
  49. data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +1 -1
  50. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_0.rb.tt +25 -0
  51. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +13 -3
  52. data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +5 -3
  53. data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +4 -3
  54. data/lib/rails/generators/rails/app/templates/dockerignore.tt +1 -2
  55. data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +1 -1
  56. data/lib/rails/generators/rails/app/templates/gitignore.tt +1 -2
  57. data/lib/rails/generators/rails/app/templates/kamal-secrets.tt +17 -0
  58. data/lib/rails/generators/rails/app/templates/public/400.html +114 -0
  59. data/lib/rails/generators/rails/app/templates/public/404.html +113 -66
  60. data/lib/rails/generators/rails/app/templates/public/406-unsupported-browser.html +113 -65
  61. data/lib/rails/generators/rails/app/templates/public/422.html +113 -66
  62. data/lib/rails/generators/rails/app/templates/public/500.html +113 -65
  63. data/lib/rails/generators/rails/app/templates/public/icon.png +0 -0
  64. data/lib/rails/generators/rails/app/templates/public/icon.svg +2 -2
  65. data/lib/rails/generators/rails/authentication/USAGE +6 -0
  66. data/lib/rails/generators/rails/authentication/authentication_generator.rb +54 -0
  67. data/lib/rails/generators/rails/authentication/templates/controllers/concerns/authentication.rb +55 -0
  68. data/lib/rails/generators/rails/authentication/templates/controllers/passwords_controller.rb +33 -0
  69. data/lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb +21 -0
  70. data/lib/rails/generators/rails/authentication/templates/mailers/passwords_mailer.rb +6 -0
  71. data/lib/rails/generators/rails/authentication/templates/models/current.rb +4 -0
  72. data/lib/rails/generators/rails/authentication/templates/models/session.rb +3 -0
  73. data/lib/rails/generators/rails/authentication/templates/models/user.rb +6 -0
  74. data/lib/rails/generators/rails/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb +7 -0
  75. data/lib/rails/generators/rails/authentication/templates/views/passwords_mailer/reset.html.erb +4 -0
  76. data/lib/rails/generators/rails/authentication/templates/views/passwords_mailer/reset.text.erb +2 -0
  77. data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +4 -0
  78. data/lib/rails/generators/rails/db/system/change/change_generator.rb +1 -1
  79. data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +5 -3
  80. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +1 -1
  81. data/lib/rails/generators/rails/plugin/plugin_generator.rb +11 -11
  82. data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +1 -1
  83. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +2 -2
  84. data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -2
  85. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +3 -3
  86. data/lib/rails/generators/rails/script/USAGE +18 -0
  87. data/lib/rails/generators/rails/script/script_generator.rb +18 -0
  88. data/lib/rails/generators/rails/script/templates/script.rb.tt +3 -0
  89. data/lib/rails/generators.rb +7 -2
  90. data/lib/rails/info_controller.rb +10 -2
  91. data/lib/rails/rack/silence_request.rb +33 -0
  92. data/lib/rails/rack.rb +1 -0
  93. data/lib/rails/railtie.rb +13 -13
  94. data/lib/rails/source_annotation_extractor.rb +31 -14
  95. data/lib/rails/tasks/statistics.rake +13 -28
  96. data/lib/rails/templates/rails/info/notes.html.erb +65 -0
  97. metadata +45 -25
  98. data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +0 -2
  99. data/lib/rails/generators/rails/app/templates/app/channels/application_cable/channel.rb.tt +0 -4
  100. data/lib/rails/generators/rails/app/templates/app/channels/application_cable/connection.rb.tt +0 -4
  101. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.tt +0 -70
  102. data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +0 -13
  103. data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +0 -13
  104. data/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js.tt +0 -10
  105. data/lib/rails/generators/rails/plugin/templates/rails/engine_manifest.js.tt +0 -6
  106. data/lib/rails/generators/rails/plugin/templates/rails/javascripts.js.tt +0 -17
@@ -1,70 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
- #
3
- # This file eases your Rails 7.2 framework defaults upgrade.
4
- #
5
- # Uncomment each configuration one by one to switch to the new default.
6
- # Once your application is ready to run with all new defaults, you can remove
7
- # this file and set the `config.load_defaults` to `7.2`.
8
- #
9
- # Read the Guide for Upgrading Ruby on Rails for more info on each option.
10
- # https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
11
-
12
- ###
13
- # Controls whether Active Job's `#perform_later` and similar methods automatically defer
14
- # the job queuing to after the current Active Record transaction is committed.
15
- #
16
- # Example:
17
- # Topic.transaction do
18
- # topic = Topic.create(...)
19
- # NewTopicNotificationJob.perform_later(topic)
20
- # end
21
- #
22
- # In this example, if the configuration is set to `:never`, the job will
23
- # be enqueued immediately, even though the `Topic` hasn't been committed yet.
24
- # Because of this, if the job is picked up almost immediately, or if the
25
- # transaction doesn't succeed for some reason, the job will fail to find this
26
- # topic in the database.
27
- #
28
- # If `enqueue_after_transaction_commit` is set to `:default`, the queue adapter
29
- # will define the behaviour.
30
- #
31
- # Note: Active Job backends can disable this feature. This is generally done by
32
- # backends that use the same database as Active Record as a queue, hence they
33
- # don't need this feature.
34
- #++
35
- # Rails.application.config.active_job.enqueue_after_transaction_commit = :default
36
-
37
- ###
38
- # Adds image/webp to the list of content types Active Storage considers as an image
39
- # Prevents automatic conversion to a fallback PNG, and assumes clients support WebP, as they support gif, jpeg, and png.
40
- # This is possible due to broad browser support for WebP, but older browsers and email clients may still not support
41
- # WebP. Requires imagemagick/libvips built with WebP support.
42
- #++
43
- # Rails.application.config.active_storage.web_image_content_types = %w[image/png image/jpeg image/gif image/webp]
44
-
45
- ###
46
- # Enable validation of migration timestamps. When set, an ActiveRecord::InvalidMigrationTimestampError
47
- # will be raised if the timestamp prefix for a migration is more than a day ahead of the timestamp
48
- # associated with the current time. This is done to prevent forward-dating of migration files, which can
49
- # impact migration generation and other migration commands.
50
- #
51
- # Applications with existing timestamped migrations that do not adhere to the
52
- # expected format can disable validation by setting this config to `false`.
53
- #++
54
- # Rails.application.config.active_record.validate_migration_timestamps = true
55
-
56
- ###
57
- # Controls whether the PostgresqlAdapter should decode dates automatically with manual queries.
58
- #
59
- # Example:
60
- # ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date") #=> Date
61
- #
62
- # This query used to return a `String`.
63
- #++
64
- # Rails.application.config.active_record.postgresql_adapter_decode_dates = true
65
-
66
- ###
67
- # Enables YJIT as of Ruby 3.3, to bring sizeable performance improvements. If you are
68
- # deploying to a memory constrained environment you may want to set this to `false`.
69
- #++
70
- # Rails.application.config.yjit = true
@@ -1,13 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Define an application-wide HTTP permissions policy. For further
4
- # information see: https://developers.google.com/web/updates/2018/06/feature-policy
5
-
6
- # Rails.application.config.permissions_policy do |policy|
7
- # policy.camera :none
8
- # policy.gyroscope :none
9
- # policy.microphone :none
10
- # policy.usb :none
11
- # policy.fullscreen :self
12
- # policy.payment :self, "https://secure.example.com"
13
- # end
@@ -1,13 +0,0 @@
1
- require "test_helper"
2
-
3
- module ApplicationCable
4
- class ConnectionTest < ActionCable::Connection::TestCase
5
- # test "connects with cookies" do
6
- # cookies.signed[:user_id] = 42
7
- #
8
- # connect
9
- #
10
- # assert_equal connection.user_id, "42"
11
- # end
12
- end
13
- end
@@ -1,10 +0,0 @@
1
- <% unless api? -%>
2
- //= link_tree ../images
3
- <% end -%>
4
- <% unless options.skip_javascript -%>
5
- //= link_directory ../javascripts .js
6
- <% end -%>
7
- //= link_directory ../stylesheets .css
8
- <% if mountable? && !api? -%>
9
- //= link <%= underscored_name %>_manifest.js
10
- <% end -%>
@@ -1,6 +0,0 @@
1
- <% if mountable? -%>
2
- <% if !options.skip_javascript -%>
3
- //= link_directory ../javascripts/<%= namespaced_name %> .js
4
- <% end -%>
5
- //= link_directory ../stylesheets/<%= namespaced_name %> .css
6
- <% end -%>
@@ -1,17 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require rails-ujs
14
- <% unless skip_active_storage? -%>
15
- //= require activestorage
16
- <% end -%>
17
- //= require_tree .