railties 8.0.0.beta1 → 8.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/lib/rails/application/bootstrap.rb +0 -1
  4. data/lib/rails/application/configuration.rb +0 -12
  5. data/lib/rails/application/finisher.rb +0 -1
  6. data/lib/rails/command.rb +0 -6
  7. data/lib/rails/commands/console/irb_console.rb +11 -8
  8. data/lib/rails/commands/devcontainer/devcontainer_command.rb +1 -0
  9. data/lib/rails/console/methods.rb +5 -21
  10. data/lib/rails/engine/lazy_route_set.rb +11 -6
  11. data/lib/rails/engine.rb +2 -3
  12. data/lib/rails/gem_version.rb +1 -1
  13. data/lib/rails/generators/app_base.rb +0 -4
  14. data/lib/rails/generators/base.rb +0 -4
  15. data/lib/rails/generators/erb/authentication/authentication_generator.rb +3 -3
  16. data/lib/rails/generators/erb/authentication/templates/{views → app/views}/passwords/edit.html.erb +1 -1
  17. data/lib/rails/generators/rails/app/app_generator.rb +1 -0
  18. data/lib/rails/generators/rails/app/templates/Dockerfile.tt +1 -1
  19. data/lib/rails/generators/rails/app/templates/Gemfile.tt +3 -3
  20. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +2 -2
  21. data/lib/rails/generators/rails/app/templates/bin/setup.tt +0 -1
  22. data/lib/rails/generators/rails/app/templates/config/deploy.yml.tt +7 -3
  23. data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +4 -0
  24. data/lib/rails/generators/rails/authentication/authentication_generator.rb +14 -12
  25. data/lib/rails/generators/rails/authentication/templates/{controllers/concerns/authentication.rb → app/controllers/concerns/authentication.rb.tt} +2 -2
  26. data/lib/rails/generators/rails/authentication/templates/{models/user.rb → app/models/user.rb.tt} +1 -1
  27. data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +5 -0
  28. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +1 -1
  29. data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +1 -1
  30. data/lib/rails/generators/test_unit/authentication/authentication_generator.rb +14 -0
  31. data/lib/rails/generators/test_unit/authentication/templates/test/fixtures/users.yml.tt +9 -0
  32. data/lib/rails/generators/test_unit/authentication/templates/test/models/user_test.rb.tt +7 -0
  33. data/lib/rails/test_unit/runner.rb +1 -0
  34. metadata +27 -26
  35. data/lib/rails/console/app.rb +0 -8
  36. data/lib/rails/console/helpers.rb +0 -8
  37. /data/lib/rails/generators/erb/authentication/templates/{views → app/views}/passwords/new.html.erb +0 -0
  38. /data/lib/rails/generators/erb/authentication/templates/{views → app/views}/sessions/new.html.erb +0 -0
  39. /data/lib/rails/generators/rails/authentication/templates/{controllers/passwords_controller.rb → app/controllers/passwords_controller.rb.tt} +0 -0
  40. /data/lib/rails/generators/rails/authentication/templates/{controllers/sessions_controller.rb → app/controllers/sessions_controller.rb.tt} +0 -0
  41. /data/lib/rails/generators/rails/authentication/templates/{mailers/passwords_mailer.rb → app/mailers/passwords_mailer.rb.tt} +0 -0
  42. /data/lib/rails/generators/rails/authentication/templates/{models/current.rb → app/models/current.rb.tt} +0 -0
  43. /data/lib/rails/generators/rails/authentication/templates/{models/session.rb → app/models/session.rb.tt} +0 -0
  44. /data/lib/rails/generators/rails/authentication/templates/{views/passwords_mailer/reset.html.erb → app/views/passwords_mailer/reset.html.erb.tt} +0 -0
  45. /data/lib/rails/generators/rails/authentication/templates/{views/passwords_mailer/reset.text.erb → app/views/passwords_mailer/reset.text.erb.tt} +0 -0
  46. /data/lib/rails/generators/rails/authentication/templates/test/mailers/previews/{passwords_mailer_preview.rb → passwords_mailer_preview.rb.tt} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e33b7c8f20e79a1706cdcad58be19d009563111e20a59f96d8c387d4088883c
4
- data.tar.gz: 4490c2625c393ab52a69d98a61caaa3a3b3f5093899e8203dad3d28a8a5dbc99
3
+ metadata.gz: 48dcbad64d0cf8be785e5a5a80d210e4f0c77ab14abb4b623c3631607e304c0e
4
+ data.tar.gz: afe11b82be536134605bbd67230361f11d547108f3e6fc32c66462922038d9c4
5
5
  SHA512:
6
- metadata.gz: 7fd02c87add0fdf9ac0b0a1b5ed6b79a278b258f8d40fc02c912e24d6995a4155bdea1a460b795c180e938a7b9f7af793f23a8ff3feec9cb15c4812101d22ce5
7
- data.tar.gz: 4788fa68c076ebb9901afd5fc6e24112939de491353096659b1151d841a37872d17f45b21b659287a976916d1b02a1342f2de536a835108a46559cfbd7af3ba2
6
+ metadata.gz: 3467d3b3d227a967abf2aae1399900f6fdccba995e139e5d5efd9ba0eaa694e60909122de013fd8670d4c757fb5d294e3b4e8c257e50632c686e1155185521cc
7
+ data.tar.gz: 16972421f0101f97d3425a105507e886d5d588a48539ba6a4c32af7675281653268bd6b47df8a7370d5837b106f0a832bc35f54dcfdd1f5d12c1bb7408ba8dd1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ ## Rails 8.0.0.rc1 (October 19, 2024) ##
2
+
3
+ * Remove deprecated support to extend Rails console through `Rails::ConsoleMethods`.
4
+
5
+ *Rafael Mendonça França*
6
+
7
+ * Remove deprecated file `rails/console/helpers`.
8
+
9
+ *Rafael Mendonça França*
10
+
11
+ * Remove deprecated file `rails/console/app`.
12
+
13
+ *Rafael Mendonça França*
14
+
15
+ * Remove deprecated `config.read_encrypted_secrets`.
16
+
17
+ *Rafael Mendonça França*
18
+
19
+ * Add Kamal support for devcontainers
20
+
21
+ Previously generated devcontainer could not use docker and therefore Kamal.
22
+
23
+ *Joé Dupuis*
24
+
25
+
1
26
  ## Rails 8.0.0.beta1 (September 26, 2024) ##
2
27
 
3
28
  * Exit `rails g` with code 1 if generator could not be found.
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "fileutils"
4
- require "set"
5
4
  require "active_support/notifications"
6
5
  require "active_support/dependencies"
7
6
  require "active_support/descendants_tracker"
@@ -326,10 +326,6 @@ module Rails
326
326
 
327
327
  self.yjit = true
328
328
 
329
- if respond_to?(:active_job)
330
- active_job.enqueue_after_transaction_commit = :default
331
- end
332
-
333
329
  if respond_to?(:active_storage)
334
330
  active_storage.web_image_content_types = %w( image/png image/jpeg image/gif image/webp )
335
331
  end
@@ -367,14 +363,6 @@ module Rails
367
363
  self.cache_classes = !value
368
364
  end
369
365
 
370
- def read_encrypted_secrets
371
- Rails.deprecator.warn("'config.read_encrypted_secrets' is deprecated and will be removed in Rails 8.0.")
372
- end
373
-
374
- def read_encrypted_secrets=(value)
375
- Rails.deprecator.warn("'config.read_encrypted_secrets=' is deprecated and will be removed in Rails 8.0.")
376
- end
377
-
378
366
  def encoding=(value)
379
367
  @encoding = value
380
368
  silence_warnings do
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
3
  require "active_support/core_ext/string/inflections"
5
4
  require "active_support/core_ext/array/conversions"
6
5
  require "active_support/descendants_tracker"
data/lib/rails/command.rb CHANGED
@@ -23,12 +23,6 @@ module Rails
23
23
  super(message)
24
24
  end
25
25
 
26
- if !Exception.method_defined?(:detailed_message) # Ruby 3.2+
27
- def detailed_message(...)
28
- message
29
- end
30
- end
31
-
32
26
  if defined?(DidYouMean::Correctable) && defined?(DidYouMean::SpellChecker)
33
27
  include DidYouMean::Correctable
34
28
 
@@ -6,7 +6,6 @@ require "irb/command"
6
6
  module Rails
7
7
  class Console
8
8
  class RailsHelperBase < IRB::HelperMethod::Base
9
- include ConsoleMethods
10
9
  end
11
10
 
12
11
  class ControllerHelper < RailsHelperBase
@@ -51,9 +50,16 @@ module Rails
51
50
  end
52
51
  end
53
52
 
54
- class Reloader < IRB::Command::Base
55
- include ConsoleMethods
53
+ class ReloadHelper < RailsHelperBase
54
+ description "Reloads the Rails application."
55
+
56
+ def execute
57
+ puts "Reloading..."
58
+ Rails.application.reloader.reload!
59
+ end
60
+ end
56
61
 
62
+ class ReloadCommand < IRB::Command::Base
57
63
  category "Rails console"
58
64
  description "Reloads the Rails application."
59
65
 
@@ -67,7 +73,8 @@ module Rails
67
73
  IRB::HelperMethod.register(:controller, ControllerInstance)
68
74
  IRB::HelperMethod.register(:new_session, NewSession)
69
75
  IRB::HelperMethod.register(:app, AppInstance)
70
- IRB::Command.register(:reload!, Reloader)
76
+ IRB::HelperMethod.register(:reload!, ReloadHelper)
77
+ IRB::Command.register(:reload!, ReloadCommand)
71
78
 
72
79
  class IRBConsole
73
80
  def initialize(app)
@@ -110,10 +117,6 @@ module Rails
110
117
  end
111
118
  end
112
119
 
113
- # Because some users/libs use Rails::ConsoleMethods to extend Rails console,
114
- # we still include it for backward compatibility.
115
- IRB::ExtendCommandBundle.include ConsoleMethods
116
-
117
120
  # Respect user's choice of prompt mode.
118
121
  IRB.conf[:PROMPT_MODE] = :RAILS_PROMPT if IRB.conf[:PROMPT_MODE] == :DEFAULT
119
122
  IRB::Irb.new.run(IRB.conf)
@@ -27,6 +27,7 @@ module Rails
27
27
  redis: !!((defined?(ActionCable) && !defined?(SolidCable)) || (defined?(ActiveJob) && !defined?(SolidQueue))),
28
28
  system_test: File.exist?("test/application_system_test_case.rb"),
29
29
  node: File.exist?(".node-version"),
30
+ kamal: File.exist?("config/deploy.yml"),
30
31
  }
31
32
  end
32
33
 
@@ -1,23 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Rails
4
- module ConsoleMethods
5
- def self.include(_mod, ...)
6
- raise_deprecation_warning
7
- super
8
- end
9
-
10
- def self.method_added(_method_name)
11
- raise_deprecation_warning
12
- super
13
- end
14
-
15
- def self.raise_deprecation_warning
16
- Rails.deprecator.warn(<<~MSG, caller_locations(2..2))
17
- Extending Rails console through `Rails::ConsoleMethods` is deprecated and will be removed in Rails 8.0.
18
- Please directly use IRB's extension API to add new commands or helpers to the console.
19
- For more details, please visit: https://github.com/ruby/irb/blob/master/EXTEND_IRB.md
20
- MSG
21
- end
22
- end
23
- end
3
+ Rails.deprecator.warn(<<~MSG, caller_locations(0..1))
4
+ `rails/console/methods` has been deprecated and will be removed in Rails 8.1.
5
+ Please directly use IRB's extension API to add new commands or helpers to the console.
6
+ For more details, please visit: https://github.com/ruby/irb/blob/master/EXTEND_IRB.md
7
+ MSG
@@ -78,6 +78,11 @@ module Rails
78
78
  super
79
79
  end
80
80
 
81
+ def recognize_path_with_request(...)
82
+ Rails.application&.reload_routes_unless_loaded
83
+ super
84
+ end
85
+
81
86
  def routes
82
87
  Rails.application&.reload_routes_unless_loaded
83
88
  super
@@ -87,19 +92,19 @@ module Rails
87
92
  def method_missing_module
88
93
  @method_missing_module ||= Module.new do
89
94
  private
90
- def method_missing(method_name, *args, &block)
95
+ def method_missing(...)
91
96
  if Rails.application&.reload_routes_unless_loaded
92
- public_send(method_name, *args, &block)
97
+ public_send(...)
93
98
  else
94
- super(method_name, *args, &block)
99
+ super
95
100
  end
96
101
  end
97
102
 
98
- def respond_to_missing?(method_name, *args)
103
+ def respond_to_missing?(...)
99
104
  if Rails.application&.reload_routes_unless_loaded
100
- respond_to?(method_name, *args)
105
+ respond_to?(...)
101
106
  else
102
- super(method_name, *args)
107
+ super
103
108
  end
104
109
  end
105
110
  end
data/lib/rails/engine.rb CHANGED
@@ -245,7 +245,7 @@ module Rails
245
245
  # polymorphic_url(MyEngine::Article.new)
246
246
  # # => "articles_path" # not "my_engine_articles_path"
247
247
  #
248
- # form_for(MyEngine::Article.new) do
248
+ # form_with(model: MyEngine::Article.new) do
249
249
  # text_field :title # => <input type="text" name="article[title]" id="article_title" />
250
250
  # end
251
251
  #
@@ -294,7 +294,7 @@ module Rails
294
294
  # All you need to do is pass the helper as the first element in array with
295
295
  # attributes for URL:
296
296
  #
297
- # form_for([my_engine, @user])
297
+ # form_with(model: [my_engine, @user])
298
298
  #
299
299
  # This code will use <tt>my_engine.user_path(@user)</tt> to generate the proper route.
300
300
  #
@@ -452,7 +452,6 @@ module Rails
452
452
  # Load console and invoke the registered hooks.
453
453
  # Check Rails::Railtie.console for more info.
454
454
  def load_console(app = self)
455
- require "rails/console/methods"
456
455
  run_console_blocks(app)
457
456
  self
458
457
  end
@@ -10,7 +10,7 @@ module Rails
10
10
  MAJOR = 8
11
11
  MINOR = 0
12
12
  TINY = 0
13
- PRE = "beta1"
13
+ PRE = "rc1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -659,10 +659,6 @@ module Rails
659
659
  !(options[:skip_bundle] || options[:pretend])
660
660
  end
661
661
 
662
- def bundler_windows_platforms
663
- Gem.rubygems_version >= Gem::Version.new("3.3.22") ? "windows" : "mswin mswin64 mingw x64_mingw"
664
- end
665
-
666
662
  def depends_on_system_test?
667
663
  !(options[:skip_system_test] || options[:skip_test] || options[:api])
668
664
  end
@@ -423,10 +423,6 @@ module Rails
423
423
  path = File.expand_path(File.join(base_name, generator_name), base_root)
424
424
  path if File.exist?(path)
425
425
  end
426
-
427
- def gem_ruby_version
428
- Gem::Version.new(Gem::VERSION) >= Gem::Version.new("3.3.13") ? Gem.ruby_version : RUBY_VERSION
429
- end
430
426
  end
431
427
  end
432
428
  end
@@ -6,9 +6,9 @@ module Erb # :nodoc:
6
6
  module Generators # :nodoc:
7
7
  class AuthenticationGenerator < Rails::Generators::Base # :nodoc:
8
8
  def create_files
9
- template "views/passwords/new.html.erb", File.join("app/views/passwords/new.html.erb")
10
- template "views/passwords/edit.html.erb", File.join("app/views/passwords/edit.html.erb")
11
- template "views/sessions/new.html.erb", File.join("app/views/sessions/new.html.erb")
9
+ template "app/views/passwords/new.html.erb"
10
+ template "app/views/passwords/edit.html.erb"
11
+ template "app/views/sessions/new.html.erb"
12
12
  end
13
13
  end
14
14
  end
@@ -1,4 +1,4 @@
1
- <h1>Update your password</h2>
1
+ <h1>Update your password</h1>
2
2
 
3
3
  <%%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %>
4
4
 
@@ -266,6 +266,7 @@ module Rails
266
266
  devcontainer_options = {
267
267
  database: options[:database],
268
268
  redis: options[:skip_solid] && !(options[:skip_action_cable] && options[:skip_active_job]),
269
+ kamal: !options[:skip_kamal],
269
270
  system_test: depends_on_system_test?,
270
271
  active_storage: !options[:skip_active_storage],
271
272
  dev: options[:dev],
@@ -8,7 +8,7 @@
8
8
  # For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
9
9
 
10
10
  # Make sure RUBY_VERSION matches the Ruby version in .ruby-version
11
- ARG RUBY_VERSION=<%= gem_ruby_version %>
11
+ ARG RUBY_VERSION=<%= Gem.ruby_version %>
12
12
  FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
13
13
 
14
14
  # Rails app lives here
@@ -10,7 +10,7 @@ source "https://rubygems.org"
10
10
  <% end -%>
11
11
 
12
12
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
13
- gem "tzinfo-data", platforms: %i[ <%= bundler_windows_platforms %> jruby ]
13
+ gem "tzinfo-data", platforms: %i[ windows jruby ]
14
14
  <% unless options.skip_solid? -%>
15
15
 
16
16
  <% if options.skip_action_cable? -%>
@@ -32,7 +32,7 @@ gem "bootsnap", require: false
32
32
  <% unless options.skip_kamal? -%>
33
33
 
34
34
  # Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
35
- gem "kamal", ">= 2.0.0.rc2", require: false
35
+ gem "kamal", require: false
36
36
  <% end -%>
37
37
  <% unless options.skip_thruster? -%>
38
38
 
@@ -53,7 +53,7 @@ gem "thruster", require: false
53
53
 
54
54
  group :development, :test do
55
55
  # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
56
- gem "debug", platforms: %i[ mri <%= bundler_windows_platforms %> ], require: "debug/prelude"
56
+ gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
57
57
  <%- unless options.skip_brakeman? -%>
58
58
 
59
59
  # Static analysis for security vulnerabilities [https://brakemanscanner.org/]
@@ -19,10 +19,10 @@
19
19
 
20
20
  <%- style_link_target = options[:skip_asset_pipeline] ? "\"application\"" : ":app" -%>
21
21
  <%- if options[:skip_hotwire] || options[:skip_javascript] -%>
22
- <%%# Includes all stylesheet files in app/views/stylesheets %>
22
+ <%%# Includes all stylesheet files in app/assets/stylesheets %>
23
23
  <%%= stylesheet_link_tag <%= style_link_target %> %>
24
24
  <%- else -%>
25
- <%%# Includes all stylesheet files in app/views/stylesheets %>
25
+ <%%# Includes all stylesheet files in app/assets/stylesheets %>
26
26
  <%%= stylesheet_link_tag <%= style_link_target %>, "data-turbo-track": "reload" %>
27
27
  <%- end -%>
28
28
  </head>
@@ -1,7 +1,6 @@
1
1
  require "fileutils"
2
2
 
3
3
  APP_ROOT = File.expand_path("..", __dir__)
4
- APP_NAME = "<%= app_name.dasherize %>"
5
4
 
6
5
  def system!(*args)
7
6
  system(*args, exception: true)
@@ -13,8 +13,10 @@ servers:
13
13
  # - 192.168.0.1
14
14
  # cmd: bin/jobs
15
15
 
16
- # Enable SSL auto certification via Let's Encrypt (and allow for multiple apps on one server).
17
- # Set ssl: false if using something like Cloudflare to terminate SSL (but keep host!).
16
+ # Enable SSL auto certification via Let's Encrypt and allow for multiple apps on a single web server.
17
+ # Remove this section when using multiple web servers and ensure you terminate SSL at your load balancer.
18
+ #
19
+ # Note: If using Cloudflare, set encryption mode in SSL/TLS setting to "Full" to enable CF-to-app encryption.
18
20
  proxy:
19
21
  ssl: true
20
22
  host: app.example.com
@@ -56,6 +58,7 @@ env:
56
58
  # WEB_CONCURRENCY: 2
57
59
 
58
60
  # Match this to any external database server to configure Active Record correctly
61
+ # Use <%= app_name %>-db for a db accessory server on same machine via local kamal docker network.
59
62
  # DB_HOST: 192.168.0.2
60
63
 
61
64
  # Log everything from Rails
@@ -105,7 +108,8 @@ builder:
105
108
  # db:
106
109
  # image: mysql:8.0
107
110
  # host: 192.168.0.2
108
- # port: 3306
111
+ # # Change to 3306 to expose port to the world instead of just local network.
112
+ # port: "127.0.0.1:3306:3306"
109
113
  # env:
110
114
  # clear:
111
115
  # MYSQL_ROOT_HOST: '%'
@@ -126,7 +126,11 @@ jobs:
126
126
  DATABASE_URL: postgres://postgres:postgres@localhost:5432
127
127
  <%- end -%>
128
128
  # REDIS_URL: redis://localhost:6379/0
129
+ <%- if options[:api] -%>
130
+ run: bin/rails db:test:prepare test
131
+ <%- else -%>
129
132
  run: bin/rails db:test:prepare test test:system
133
+ <%- end -%>
130
134
 
131
135
  - name: Keep screenshots from failed system tests
132
136
  uses: actions/upload-artifact@v4
@@ -11,24 +11,24 @@ module Rails
11
11
  end
12
12
 
13
13
  def create_authentication_files
14
- template "models/session.rb", File.join("app/models/session.rb")
15
- template "models/user.rb", File.join("app/models/user.rb")
16
- template "models/current.rb", File.join("app/models/current.rb")
14
+ template "app/models/session.rb"
15
+ template "app/models/user.rb"
16
+ template "app/models/current.rb"
17
17
 
18
- template "controllers/sessions_controller.rb", File.join("app/controllers/sessions_controller.rb")
19
- template "controllers/concerns/authentication.rb", File.join("app/controllers/concerns/authentication.rb")
20
- template "controllers/passwords_controller.rb", File.join("app/controllers/passwords_controller.rb")
18
+ template "app/controllers/sessions_controller.rb"
19
+ template "app/controllers/concerns/authentication.rb"
20
+ template "app/controllers/passwords_controller.rb"
21
21
 
22
- template "mailers/passwords_mailer.rb", File.join("app/mailers/passwords_mailer.rb")
22
+ template "app/mailers/passwords_mailer.rb"
23
23
 
24
- template "views/passwords_mailer/reset.html.erb", File.join("app/views/passwords_mailer/reset.html.erb")
25
- template "views/passwords_mailer/reset.text.erb", File.join("app/views/passwords_mailer/reset.text.erb")
24
+ template "app/views/passwords_mailer/reset.html.erb"
25
+ template "app/views/passwords_mailer/reset.text.erb"
26
26
 
27
- template "test/mailers/previews/passwords_mailer_preview.rb", File.join("test/mailers/previews/passwords_mailer_preview.rb")
27
+ template "test/mailers/previews/passwords_mailer_preview.rb"
28
28
  end
29
29
 
30
30
  def configure_application_controller
31
- gsub_file "app/controllers/application_controller.rb", /(class ApplicationController < ActionController::Base)/, "\\1\n include Authentication"
31
+ inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " include Authentication\n"
32
32
  end
33
33
 
34
34
  def configure_authentication_routes
@@ -41,7 +41,7 @@ module Rails
41
41
  uncomment_lines "Gemfile", /gem "bcrypt"/
42
42
  Bundler.with_original_env { execute_command :bundle, "install --quiet" }
43
43
  else
44
- Bundler.with_original_env { execute_command :bundle, "add bcrypt --quiet" }
44
+ Bundler.with_original_env { execute_command :bundle, "add bcrypt", capture: true }
45
45
  end
46
46
  end
47
47
 
@@ -49,6 +49,8 @@ module Rails
49
49
  generate "migration CreateUsers email_address:string!:uniq password_digest:string! --force"
50
50
  generate "migration CreateSessions user:references ip_address:string user_agent:string --force"
51
51
  end
52
+
53
+ hook_for :test_framework
52
54
  end
53
55
  end
54
56
  end
@@ -14,7 +14,7 @@ module Authentication
14
14
 
15
15
  private
16
16
  def authenticated?
17
- Current.session.present?
17
+ resume_session
18
18
  end
19
19
 
20
20
  def require_authentication
@@ -23,7 +23,7 @@ module Authentication
23
23
 
24
24
 
25
25
  def resume_session
26
- Current.session = find_session_by_cookie
26
+ Current.session ||= find_session_by_cookie
27
27
  end
28
28
 
29
29
  def find_session_by_cookie
@@ -2,5 +2,5 @@ class User < ApplicationRecord
2
2
  has_secure_password
3
3
  has_many :sessions, dependent: :destroy
4
4
 
5
- normalizes :email_address, with: -> e { e.strip.downcase }
5
+ normalizes :email_address, with: ->(e) { e.strip.downcase }
6
6
  end
@@ -26,6 +26,9 @@ module Rails
26
26
  class_option :dev, type: :boolean, default: false,
27
27
  desc: "For applications pointing to a local Rails checkout"
28
28
 
29
+ class_option :kamal, type: :boolean, default: true,
30
+ desc: "Include configuration for Kamal"
31
+
29
32
  source_paths << File.expand_path(File.join(base_name, "app", "templates"), base_root)
30
33
 
31
34
  def create_devcontainer
@@ -80,6 +83,7 @@ module Rails
80
83
  @container_env["CAPYBARA_SERVER_PORT"] = "45678" if options[:system_test]
81
84
  @container_env["SELENIUM_HOST"] = "selenium" if options[:system_test]
82
85
  @container_env["REDIS_URL"] = "redis://redis:6379/1" if options[:redis]
86
+ @container_env["KAMAL_REGISTRY_PASSWORD"] = "$KAMAL_REGISTRY_PASSWORD" if options[:kamal]
83
87
  @container_env["DB_HOST"] = database.name if database.service
84
88
 
85
89
  @container_env
@@ -105,6 +109,7 @@ module Rails
105
109
 
106
110
  @features["ghcr.io/rails/devcontainer/features/activestorage"] = {} if options[:active_storage]
107
111
  @features["ghcr.io/devcontainers/features/node:1"] = {} if options[:node]
112
+ @features["ghcr.io/devcontainers/features/docker-outside-of-docker:1"] = {} if options[:kamal]
108
113
 
109
114
  @features.merge!(database.feature) if database.feature
110
115
 
@@ -1,3 +1,3 @@
1
1
  # Make sure RUBY_VERSION matches the Ruby version in .ruby-version
2
- ARG RUBY_VERSION=<%= gem_ruby_version %>
2
+ ARG RUBY_VERSION=<%= Gem.ruby_version %>
3
3
  FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION
@@ -19,5 +19,5 @@ gem "rubocop-rails-omakase", require: false
19
19
  <% end -%>
20
20
  <% if RUBY_PLATFORM.match?(/mingw|mswin|java/) -%>
21
21
 
22
- gem "tzinfo-data", platforms: %i[ <%= bundler_windows_platforms %> jruby ]
22
+ gem "tzinfo-data", platforms: %i[ windows jruby ]
23
23
  <% end -%>
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators/test_unit"
4
+
5
+ module TestUnit # :nodoc:
6
+ module Generators # :nodoc:
7
+ class AuthenticationGenerator < Rails::Generators::Base # :nodoc:
8
+ def create_user_test_files
9
+ template "test/fixtures/users.yml"
10
+ template "test/models/user_test.rb"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ <%% password_digest = BCrypt::Password.create("password") %>
2
+
3
+ one:
4
+ email_address: one@example.com
5
+ password_digest: <%%= password_digest %>
6
+
7
+ two:
8
+ email_address: two@example.com
9
+ password_digest: <%%= password_digest %>
@@ -0,0 +1,7 @@
1
+ require "test_helper"
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -125,6 +125,7 @@ module Rails
125
125
  def list_tests(patterns)
126
126
  tests = Rake::FileList[patterns.any? ? patterns : default_test_glob]
127
127
  tests.exclude(default_test_exclude_glob) if patterns.empty?
128
+ tests.exclude(%r{test/isolation/assets/node_modules})
128
129
  tests
129
130
  end
130
131
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railties
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0.beta1
4
+ version: 8.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-26 00:00:00.000000000 Z
11
+ date: 2024-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 8.0.0.beta1
19
+ version: 8.0.0.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 8.0.0.beta1
26
+ version: 8.0.0.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 8.0.0.beta1
33
+ version: 8.0.0.rc1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 8.0.0.beta1
40
+ version: 8.0.0.rc1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rackup
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - '='
122
122
  - !ruby/object:Gem::Version
123
- version: 8.0.0.beta1
123
+ version: 8.0.0.rc1
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - '='
129
129
  - !ruby/object:Gem::Version
130
- version: 8.0.0.beta1
130
+ version: 8.0.0.rc1
131
131
  description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
132
132
  email: david@loudthinking.com
133
133
  executables:
@@ -206,8 +206,6 @@ files:
206
206
  - lib/rails/commands/unused_routes/unused_routes_command.rb
207
207
  - lib/rails/commands/version/version_command.rb
208
208
  - lib/rails/configuration.rb
209
- - lib/rails/console/app.rb
210
- - lib/rails/console/helpers.rb
211
209
  - lib/rails/console/methods.rb
212
210
  - lib/rails/deprecator.rb
213
211
  - lib/rails/dev_caching.rb
@@ -228,9 +226,9 @@ files:
228
226
  - lib/rails/generators/database.rb
229
227
  - lib/rails/generators/erb.rb
230
228
  - lib/rails/generators/erb/authentication/authentication_generator.rb
231
- - lib/rails/generators/erb/authentication/templates/views/passwords/edit.html.erb
232
- - lib/rails/generators/erb/authentication/templates/views/passwords/new.html.erb
233
- - lib/rails/generators/erb/authentication/templates/views/sessions/new.html.erb
229
+ - lib/rails/generators/erb/authentication/templates/app/views/passwords/edit.html.erb
230
+ - lib/rails/generators/erb/authentication/templates/app/views/passwords/new.html.erb
231
+ - lib/rails/generators/erb/authentication/templates/app/views/sessions/new.html.erb
234
232
  - lib/rails/generators/erb/controller/controller_generator.rb
235
233
  - lib/rails/generators/erb/controller/templates/view.html.erb.tt
236
234
  - lib/rails/generators/erb/mailer/mailer_generator.rb
@@ -320,16 +318,16 @@ files:
320
318
  - lib/rails/generators/rails/application_record/application_record_generator.rb
321
319
  - lib/rails/generators/rails/authentication/USAGE
322
320
  - lib/rails/generators/rails/authentication/authentication_generator.rb
323
- - lib/rails/generators/rails/authentication/templates/controllers/concerns/authentication.rb
324
- - lib/rails/generators/rails/authentication/templates/controllers/passwords_controller.rb
325
- - lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb
326
- - lib/rails/generators/rails/authentication/templates/mailers/passwords_mailer.rb
327
- - lib/rails/generators/rails/authentication/templates/models/current.rb
328
- - lib/rails/generators/rails/authentication/templates/models/session.rb
329
- - lib/rails/generators/rails/authentication/templates/models/user.rb
330
- - lib/rails/generators/rails/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb
331
- - lib/rails/generators/rails/authentication/templates/views/passwords_mailer/reset.html.erb
332
- - lib/rails/generators/rails/authentication/templates/views/passwords_mailer/reset.text.erb
321
+ - lib/rails/generators/rails/authentication/templates/app/controllers/concerns/authentication.rb.tt
322
+ - lib/rails/generators/rails/authentication/templates/app/controllers/passwords_controller.rb.tt
323
+ - lib/rails/generators/rails/authentication/templates/app/controllers/sessions_controller.rb.tt
324
+ - lib/rails/generators/rails/authentication/templates/app/mailers/passwords_mailer.rb.tt
325
+ - lib/rails/generators/rails/authentication/templates/app/models/current.rb.tt
326
+ - lib/rails/generators/rails/authentication/templates/app/models/session.rb.tt
327
+ - lib/rails/generators/rails/authentication/templates/app/models/user.rb.tt
328
+ - lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt
329
+ - lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt
330
+ - lib/rails/generators/rails/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb.tt
333
331
  - lib/rails/generators/rails/benchmark/USAGE
334
332
  - lib/rails/generators/rails/benchmark/benchmark_generator.rb
335
333
  - lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt
@@ -412,6 +410,9 @@ files:
412
410
  - lib/rails/generators/resource_helpers.rb
413
411
  - lib/rails/generators/test_case.rb
414
412
  - lib/rails/generators/test_unit.rb
413
+ - lib/rails/generators/test_unit/authentication/authentication_generator.rb
414
+ - lib/rails/generators/test_unit/authentication/templates/test/fixtures/users.yml.tt
415
+ - lib/rails/generators/test_unit/authentication/templates/test/models/user_test.rb.tt
415
416
  - lib/rails/generators/test_unit/controller/controller_generator.rb
416
417
  - lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt
417
418
  - lib/rails/generators/test_unit/generator/generator_generator.rb
@@ -489,10 +490,10 @@ licenses:
489
490
  - MIT
490
491
  metadata:
491
492
  bug_tracker_uri: https://github.com/rails/rails/issues
492
- changelog_uri: https://github.com/rails/rails/blob/v8.0.0.beta1/railties/CHANGELOG.md
493
- documentation_uri: https://api.rubyonrails.org/v8.0.0.beta1/
493
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.0.rc1/railties/CHANGELOG.md
494
+ documentation_uri: https://api.rubyonrails.org/v8.0.0.rc1/
494
495
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
495
- source_code_uri: https://github.com/rails/rails/tree/v8.0.0.beta1/railties
496
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.0.rc1/railties
496
497
  rubygems_mfa_required: 'true'
497
498
  post_install_message:
498
499
  rdoc_options:
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Rails.deprecator.warn(<<~MSG, caller_locations(0..1))
4
- `rails/console/app` has been deprecated and will be removed in Rails 8.0.
5
- Please require `rails/console/methods` instead.
6
- MSG
7
-
8
- require "rails/console/methods"
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Rails.deprecator.warn(<<~MSG, caller_locations(0..1))
4
- `rails/console/helpers` has been deprecated and will be removed in Rails 8.0.
5
- Please require `rails/console/methods` instead.
6
- MSG
7
-
8
- require "rails/console/methods"