railties 8.0.3 → 8.1.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +72 -232
  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 +26 -0
  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/command/base.rb +0 -2
  11. data/lib/rails/command/environment_argument.rb +0 -1
  12. data/lib/rails/command.rb +1 -1
  13. data/lib/rails/commands/console/irb_console.rb +4 -4
  14. data/lib/rails/commands/credentials/credentials_command.rb +25 -5
  15. data/lib/rails/commands/encrypted/encrypted_command.rb +0 -1
  16. data/lib/rails/engine.rb +0 -1
  17. data/lib/rails/gem_version.rb +3 -3
  18. data/lib/rails/generators/actions.rb +2 -3
  19. data/lib/rails/generators/app_base.rb +37 -28
  20. data/lib/rails/generators/database.rb +1 -1
  21. data/lib/rails/generators/erb/authentication/authentication_generator.rb +2 -0
  22. data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +2 -2
  23. data/lib/rails/generators/generated_attribute.rb +1 -1
  24. data/lib/rails/generators/migration.rb +0 -1
  25. data/lib/rails/generators/rails/app/app_generator.rb +12 -2
  26. data/lib/rails/generators/rails/app/templates/Dockerfile.tt +14 -12
  27. data/lib/rails/generators/rails/app/templates/Gemfile.tt +3 -0
  28. data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +5 -0
  29. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +1 -0
  30. data/lib/rails/generators/rails/app/templates/bin/bundler-audit.tt +5 -0
  31. data/lib/rails/generators/rails/app/templates/bin/ci.tt +5 -0
  32. data/lib/rails/generators/rails/app/templates/bin/rubocop.tt +1 -1
  33. data/lib/rails/generators/rails/app/templates/bin/setup.tt +1 -0
  34. data/lib/rails/generators/rails/app/templates/config/bundler-audit.yml.tt +5 -0
  35. data/lib/rails/generators/rails/app/templates/config/ci.rb.tt +34 -0
  36. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +9 -1
  37. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +10 -2
  38. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
  39. data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +9 -1
  40. data/lib/rails/generators/rails/app/templates/config/deploy.yml.tt +5 -5
  41. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +5 -0
  42. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +16 -4
  43. data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +4 -0
  44. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_1.rb.tt +66 -0
  45. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +3 -2
  46. data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +0 -7
  47. data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +0 -6
  48. data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +101 -19
  49. data/lib/rails/generators/rails/app/templates/github/dependabot.yml +2 -2
  50. data/lib/rails/generators/rails/app/templates/kamal-secrets.tt +3 -0
  51. data/lib/rails/generators/rails/app/templates/public/400.html +1 -1
  52. data/lib/rails/generators/rails/app/templates/public/404.html +2 -2
  53. data/lib/rails/generators/rails/app/templates/public/422.html +1 -1
  54. data/lib/rails/generators/rails/app/templates/public/500.html +2 -2
  55. data/lib/rails/generators/rails/authentication/authentication_generator.rb +17 -6
  56. data/lib/rails/generators/rails/authentication/templates/app/controllers/passwords_controller.rb.tt +6 -0
  57. data/lib/rails/generators/rails/authentication/templates/app/controllers/sessions_controller.rb.tt +2 -2
  58. data/lib/rails/generators/rails/authentication/templates/test/test_helpers/session_test_helper.rb.tt +15 -0
  59. data/lib/rails/generators/rails/benchmark/USAGE +1 -1
  60. data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +0 -2
  61. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +4 -0
  62. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/compose.yaml.tt +2 -2
  63. data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +17 -5
  64. data/lib/rails/generators/rails/master_key/master_key_generator.rb +0 -12
  65. data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +20 -9
  66. data/lib/rails/generators/rails/plugin/templates/github/dependabot.yml +2 -2
  67. data/lib/rails/generators/rails/script/USAGE +1 -1
  68. data/lib/rails/generators/test_unit/authentication/authentication_generator.rb +3 -2
  69. data/lib/rails/generators/test_unit/authentication/templates/test/controllers/passwords_controller_test.rb.tt +67 -0
  70. data/lib/rails/generators/test_unit/authentication/templates/test/controllers/sessions_controller_test.rb +33 -0
  71. data/lib/rails/generators/test_unit/authentication/templates/test/models/user_test.rb.tt +4 -3
  72. data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +1 -1
  73. data/lib/rails/generators/testing/behavior.rb +0 -3
  74. data/lib/rails/generators.rb +3 -1
  75. data/lib/rails/health_controller.rb +8 -2
  76. data/lib/rails/info.rb +4 -5
  77. data/lib/rails/info_controller.rb +2 -3
  78. data/lib/rails/initializable.rb +63 -19
  79. data/lib/rails/rack/silence_request.rb +5 -2
  80. data/lib/rails/railtie/configurable.rb +0 -1
  81. data/lib/rails/railtie.rb +0 -1
  82. data/lib/rails/templates/rails/info/notes.html.erb +23 -0
  83. data/lib/rails/templates/rails/mailers/email.html.erb +3 -2
  84. data/lib/rails/templates/rails/welcome/index.html.erb +17 -1
  85. data/lib/rails/test_unit/reporter.rb +5 -4
  86. data/lib/rails/test_unit/runner.rb +8 -5
  87. data/lib/rails.rb +9 -2
  88. metadata +19 -15
  89. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_0.rb.tt +0 -30
  90. data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +0 -15
  91. data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +0 -7
  92. data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +0 -2
  93. /data/lib/rails/generators/{test_unit → rails}/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb.tt +0 -0
@@ -35,6 +35,14 @@
35
35
  text-align: center;
36
36
  }
37
37
 
38
+ @media (prefers-color-scheme: dark) {
39
+ body {
40
+ background-color: #1a1a1a;
41
+ background-image: url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwMjQiIHZpZXdCb3g9IjAgMCAxNDQwIDEwMjQiIHdpZHRoPSIxNDQwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Im0xNDQwIDUxMC4wMDA2NDh2LTUxMC4wMDA2NDhoLTE0NDB2Mzg0LjAwMDY0OGM0MTcuMzExOTM5IDEzMS4xNDIxNzkgODkxIDE3MS41MTMgMTQ0MCAxMjZ6IiBmaWxsPSIjMzMzIi8+PC9zdmc+);
42
+ color: #e0e0e0;
43
+ }
44
+ }
45
+
38
46
  nav {
39
47
  font-size: 0;
40
48
  height: 20vw;
@@ -48,7 +56,7 @@
48
56
 
49
57
  nav a {
50
58
  background: #D30001;
51
- border-radius: 100%;
59
+ border-radius: 50%;
52
60
  display: flex;
53
61
  transition: background 0.25s cubic-bezier(0.33, 1, 0.68, 1);
54
62
  filter: drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08));
@@ -58,11 +66,19 @@
58
66
  background: #261B23;
59
67
  }
60
68
 
69
+ @media (prefers-color-scheme: dark) {
70
+ nav a {
71
+ background: #D30001;
72
+ filter: drop-shadow(0 20px 13px rgb(255 255 255 / 0.03)) drop-shadow(0 8px 5px rgb(255 255 255 / 0.08));
73
+ }
74
+ }
75
+
61
76
  nav a img {
62
77
  height: auto;
63
78
  max-width: 100%;
64
79
  width: 100%;
65
80
  cursor: pointer;
81
+ border-radius: 50%;
66
82
  }
67
83
 
68
84
  ul {
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "active_support/core_ext/class/attribute"
4
3
  require "minitest"
5
4
 
6
5
  module Rails
7
6
  class TestUnitReporter < Minitest::StatisticsReporter
8
- class_attribute :app_root
9
- class_attribute :executable, default: "bin/rails test"
7
+ singleton_class.attr_accessor :app_root
8
+
9
+ @executable = "bin/rails test"
10
+ singleton_class.attr_accessor :executable
10
11
 
11
12
  def prerecord(test_class, test_name)
12
13
  super
@@ -86,7 +87,7 @@ module Rails
86
87
  result.method(result.name).source_location
87
88
  end
88
89
 
89
- "#{executable} #{relative_path_for(location)}:#{line}"
90
+ "#{self.class.executable} #{relative_path_for(location)}:#{line}"
90
91
  end
91
92
 
92
93
  def app_root
@@ -26,6 +26,7 @@ module Rails
26
26
  TEST_FOLDERS = [:models, :helpers, :channels, :controllers, :mailers, :integration, :jobs, :mailboxes]
27
27
  PATH_ARGUMENT_PATTERN = %r"^(?!/.+/$)[.\w]*[/\\]"
28
28
  mattr_reader :filters, default: []
29
+ mattr_reader :load_test_files, default: false
29
30
 
30
31
  class << self
31
32
  def attach_before_load_options(opts)
@@ -52,10 +53,14 @@ module Rails
52
53
  success || exit(false)
53
54
  end
54
55
 
55
- def run(argv = [])
56
- load_tests(argv)
57
-
56
+ def run(args = [])
58
57
  require "active_support/testing/autorun"
58
+
59
+ @@load_test_files = true
60
+
61
+ at_exit do
62
+ ARGV.replace(args)
63
+ end
59
64
  end
60
65
 
61
66
  def load_tests(argv)
@@ -93,8 +98,6 @@ module Rails
93
98
  def extract_filters(argv)
94
99
  # Extract absolute and relative paths but skip -n /.*/ regexp filters.
95
100
  argv.filter_map do |path|
96
- next unless path_argument?(path)
97
-
98
101
  path = path.tr("\\", "/")
99
102
  case
100
103
  when /(:\d+(-\d+)?)+$/.match?(path)
data/lib/rails.rb CHANGED
@@ -3,10 +3,9 @@
3
3
  require "pathname"
4
4
 
5
5
  require "active_support"
6
+ require "active_support/rails"
6
7
  require "active_support/core_ext/kernel/reporting"
7
- require "active_support/core_ext/module/delegation"
8
8
  require "active_support/core_ext/array/extract_options"
9
- require "active_support/core_ext/object/blank"
10
9
 
11
10
  require "rails/version"
12
11
  require "rails/deprecator"
@@ -94,6 +93,14 @@ module Rails
94
93
  ActiveSupport.error_reporter
95
94
  end
96
95
 
96
+ # Returns the ActiveSupport::EventReporter of the current \Rails project,
97
+ # otherwise it returns +nil+ if there is no project.
98
+ #
99
+ # Rails.event.notify("my_event", { message: "Hello, world!" })
100
+ def event
101
+ ActiveSupport.event_reporter
102
+ end
103
+
97
104
  # Returns all \Rails groups for loading based on:
98
105
  #
99
106
  # * The \Rails environment;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railties
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.3
4
+ version: 8.1.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -15,28 +15,28 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 8.0.3
18
+ version: 8.1.0.beta1
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 8.0.3
25
+ version: 8.1.0.beta1
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: actionpack
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - '='
31
31
  - !ruby/object:Gem::Version
32
- version: 8.0.3
32
+ version: 8.1.0.beta1
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 8.0.3
39
+ version: 8.1.0.beta1
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rackup
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -133,14 +133,14 @@ dependencies:
133
133
  requirements:
134
134
  - - '='
135
135
  - !ruby/object:Gem::Version
136
- version: 8.0.3
136
+ version: 8.1.0.beta1
137
137
  type: :development
138
138
  prerelease: false
139
139
  version_requirements: !ruby/object:Gem::Requirement
140
140
  requirements:
141
141
  - - '='
142
142
  - !ruby/object:Gem::Version
143
- version: 8.0.3
143
+ version: 8.1.0.beta1
144
144
  description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
145
145
  email: david@loudthinking.com
146
146
  executables:
@@ -279,6 +279,8 @@ files:
279
279
  - lib/rails/generators/rails/app/templates/app/views/pwa/manifest.json.erb.tt
280
280
  - lib/rails/generators/rails/app/templates/app/views/pwa/service-worker.js
281
281
  - lib/rails/generators/rails/app/templates/bin/brakeman.tt
282
+ - lib/rails/generators/rails/app/templates/bin/bundler-audit.tt
283
+ - lib/rails/generators/rails/app/templates/bin/ci.tt
282
284
  - lib/rails/generators/rails/app/templates/bin/dev.tt
283
285
  - lib/rails/generators/rails/app/templates/bin/rails.tt
284
286
  - lib/rails/generators/rails/app/templates/bin/rake.tt
@@ -288,7 +290,9 @@ files:
288
290
  - lib/rails/generators/rails/app/templates/config.ru.tt
289
291
  - lib/rails/generators/rails/app/templates/config/application.rb.tt
290
292
  - lib/rails/generators/rails/app/templates/config/boot.rb.tt
293
+ - lib/rails/generators/rails/app/templates/config/bundler-audit.yml.tt
291
294
  - lib/rails/generators/rails/app/templates/config/cable.yml.tt
295
+ - lib/rails/generators/rails/app/templates/config/ci.rb.tt
292
296
  - lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt
293
297
  - lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt
294
298
  - lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt
@@ -303,7 +307,7 @@ files:
303
307
  - lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt
304
308
  - lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt
305
309
  - lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt
306
- - lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_0.rb.tt
310
+ - lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_1.rb.tt
307
311
  - lib/rails/generators/rails/app/templates/config/locales/en.yml
308
312
  - lib/rails/generators/rails/app/templates/config/puma.rb.tt
309
313
  - lib/rails/generators/rails/app/templates/config/routes.rb.tt
@@ -342,6 +346,8 @@ files:
342
346
  - lib/rails/generators/rails/authentication/templates/app/models/user.rb.tt
343
347
  - lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt
344
348
  - lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt
349
+ - lib/rails/generators/rails/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb.tt
350
+ - lib/rails/generators/rails/authentication/templates/test/test_helpers/session_test_helper.rb.tt
345
351
  - lib/rails/generators/rails/benchmark/USAGE
346
352
  - lib/rails/generators/rails/benchmark/benchmark_generator.rb
347
353
  - lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt
@@ -425,8 +431,9 @@ files:
425
431
  - lib/rails/generators/test_case.rb
426
432
  - lib/rails/generators/test_unit.rb
427
433
  - lib/rails/generators/test_unit/authentication/authentication_generator.rb
434
+ - lib/rails/generators/test_unit/authentication/templates/test/controllers/passwords_controller_test.rb.tt
435
+ - lib/rails/generators/test_unit/authentication/templates/test/controllers/sessions_controller_test.rb
428
436
  - lib/rails/generators/test_unit/authentication/templates/test/fixtures/users.yml.tt
429
- - lib/rails/generators/test_unit/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb.tt
430
437
  - lib/rails/generators/test_unit/authentication/templates/test/models/user_test.rb.tt
431
438
  - lib/rails/generators/test_unit/controller/controller_generator.rb
432
439
  - lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt
@@ -443,9 +450,6 @@ files:
443
450
  - lib/rails/generators/test_unit/model/model_generator.rb
444
451
  - lib/rails/generators/test_unit/model/templates/fixtures.yml.tt
445
452
  - lib/rails/generators/test_unit/model/templates/unit_test.rb.tt
446
- - lib/rails/generators/test_unit/plugin/plugin_generator.rb
447
- - lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt
448
- - lib/rails/generators/test_unit/plugin/templates/test_helper.rb
449
453
  - lib/rails/generators/test_unit/scaffold/scaffold_generator.rb
450
454
  - lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt
451
455
  - lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt
@@ -505,10 +509,10 @@ licenses:
505
509
  - MIT
506
510
  metadata:
507
511
  bug_tracker_uri: https://github.com/rails/rails/issues
508
- changelog_uri: https://github.com/rails/rails/blob/v8.0.3/railties/CHANGELOG.md
509
- documentation_uri: https://api.rubyonrails.org/v8.0.3/
512
+ changelog_uri: https://github.com/rails/rails/blob/v8.1.0.beta1/railties/CHANGELOG.md
513
+ documentation_uri: https://api.rubyonrails.org/v8.1.0.beta1/
510
514
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
511
- source_code_uri: https://github.com/rails/rails/tree/v8.0.3/railties
515
+ source_code_uri: https://github.com/rails/rails/tree/v8.1.0.beta1/railties
512
516
  rubygems_mfa_required: 'true'
513
517
  rdoc_options:
514
518
  - "--exclude"
@@ -1,30 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
- #
3
- # This file eases your Rails 8.0 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.0`.
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
- # Specifies whether `to_time` methods preserve the UTC offset of their receivers or preserves the timezone.
14
- # If set to `:zone`, `to_time` methods will use the timezone of their receivers.
15
- # If set to `:offset`, `to_time` methods will use the UTC offset.
16
- # If `false`, `to_time` methods will convert to the local system UTC offset instead.
17
- #++
18
- # Rails.application.config.active_support.to_time_preserves_timezone = :zone
19
-
20
- ###
21
- # When both `If-Modified-Since` and `If-None-Match` are provided by the client
22
- # only consider `If-None-Match` as specified by RFC 7232 Section 6.
23
- # If set to `false` both conditions need to be satisfied.
24
- #++
25
- # Rails.application.config.action_dispatch.strict_freshness = true
26
-
27
- ###
28
- # Set `Regexp.timeout` to `1`s by default to improve security over Regexp Denial-of-Service attacks.
29
- #++
30
- # Regexp.timeout = 1
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rails/generators/test_unit"
4
-
5
- module TestUnit # :nodoc:
6
- module Generators # :nodoc:
7
- class PluginGenerator < Base # :nodoc:
8
- check_class_collision suffix: "Test"
9
-
10
- def create_test_files
11
- directory ".", "test"
12
- end
13
- end
14
- end
15
- end
@@ -1,7 +0,0 @@
1
- require "test_helper"
2
-
3
- class <%= class_name %>Test < ActiveSupport::TestCase
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- end
@@ -1,2 +0,0 @@
1
- require "active_support/testing/autorun"
2
- require "active_support"