railties 8.0.1 → 8.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adc7a54226a0d457897877951d6e57773a0410509532712c3f23e4a327eba22b
4
- data.tar.gz: 9a4fdb1a2b8d77039f670694c6639162577cf832cd92653fb4f95a14c9d16980
3
+ metadata.gz: 4f57239195d47ae3ad800e5f2dedde7e8eb8a03b3250abed8638ba84bdfe0ae4
4
+ data.tar.gz: c4164328a94221e3366ab5c1ff886fa1a9eb72e55b4c2995afbc746c121fd103
5
5
  SHA512:
6
- metadata.gz: c9135f6974186b7c1e6fb473416bf5c5c63affa34fecc4e2bd9714d9690e68a68061a1229d34fab7379eae97b110985543e2dff22cc111160276bdda16dc1b3e
7
- data.tar.gz: '0354482884c4a3f5d8959603d602b2a1064409e825fab90cdad52b81f2db32bcdacc4f2697ffd679bf37d77adc6b6f47f7da456d48390a19b6ec5ce049448bf6'
6
+ metadata.gz: 19ba4fdc8b71b593a48826cd5f60406521412869d5f4f8f21c493eb5ae97a5832b5babeef889e077c48b3e6fba6b86adb4964b959bf404a1dafa5a4f95628c07
7
+ data.tar.gz: 855f15029d50fae909e2931650d2a475183fd61b46bbcbc7d45189c9bf3cf355c433979c3d47c5d6275222fa12867ea31caa4210ef0689164184f7df420c32a5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ ## Rails 8.0.2 (March 12, 2025) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 8.0.2 (March 12, 2025) ##
7
+
8
+ * Fix Rails console to load routes.
9
+
10
+ Otherwise `*_path` and `*url` methods are missing on the `app` object.
11
+
12
+ *Édouard Chin*
13
+
14
+ * Update `rails new --minimal` option
15
+
16
+ Extend the `--minimal` flag to exclude recently added features:
17
+ `skip_brakeman`, `skip_ci`, `skip_docker`, `skip_kamal`, `skip_rubocop`, `skip_solid` and `skip_thruster`.
18
+
19
+ *eelcoj*
20
+
21
+ * Use `secret_key_base` from ENV or credentials when present locally.
22
+
23
+ When ENV["SECRET_KEY_BASE"] or
24
+ `Rails.application.credentials.secret_key_base` is set for test or
25
+ development, it is used for the `Rails.config.secret_key_base`,
26
+ instead of generating a `tmp/local_secret.txt` file.
27
+
28
+ *Petrik de Heus*
29
+
30
+
1
31
  ## Rails 8.0.1 (December 13, 2024) ##
2
32
 
3
33
  * Skip generation system tests related code for CI when `--skip-system-test` is given.
@@ -503,16 +503,18 @@ module Rails
503
503
 
504
504
  def secret_key_base
505
505
  @secret_key_base || begin
506
- self.secret_key_base = if generate_local_secret?
506
+ self.secret_key_base = if ENV["SECRET_KEY_BASE_DUMMY"]
507
507
  generate_local_secret
508
508
  else
509
- ENV["SECRET_KEY_BASE"] || Rails.application.credentials.secret_key_base
509
+ ENV["SECRET_KEY_BASE"] ||
510
+ Rails.application.credentials.secret_key_base ||
511
+ (Rails.env.local? && generate_local_secret)
510
512
  end
511
513
  end
512
514
  end
513
515
 
514
516
  def secret_key_base=(new_secret_key_base)
515
- if new_secret_key_base.nil? && generate_local_secret?
517
+ if new_secret_key_base.nil? && Rails.env.local?
516
518
  @secret_key_base = generate_local_secret
517
519
  elsif new_secret_key_base.is_a?(String) && new_secret_key_base.present?
518
520
  @secret_key_base = new_secret_key_base
@@ -640,10 +642,6 @@ module Rails
640
642
 
641
643
  File.binread(key_file)
642
644
  end
643
-
644
- def generate_local_secret?
645
- Rails.env.local? || ENV["SECRET_KEY_BASE_DUMMY"]
646
- end
647
645
  end
648
646
  end
649
647
  end
@@ -459,18 +459,21 @@ module Rails
459
459
  # is used to create all ActiveSupport::MessageVerifier and ActiveSupport::MessageEncryptor instances,
460
460
  # including the ones that sign and encrypt cookies.
461
461
  #
462
- # In development and test, this is randomly generated and stored in a
463
- # temporary file in <tt>tmp/local_secret.txt</tt>.
462
+ # We look for it first in <tt>ENV["SECRET_KEY_BASE"]</tt>, then in
463
+ # +credentials.secret_key_base+. For most applications, the correct place
464
+ # to store it is in the encrypted credentials file.
464
465
  #
465
- # You can also set <tt>ENV["SECRET_KEY_BASE_DUMMY"]</tt> to trigger the use of a randomly generated
466
- # secret_key_base that's stored in a temporary file. This is useful when precompiling assets for
467
- # production as part of a build step that otherwise does not need access to the production secrets.
466
+ # In development and test, if the secret_key_base is still empty, it is
467
+ # randomly generated and stored in a temporary file in
468
+ # <tt>tmp/local_secret.txt</tt>.
468
469
  #
469
- # Dockerfile example: <tt>RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile</tt>.
470
+ # Generating a random secret_key_base and storing it in
471
+ # <tt>tmp/local_secret.txt</tt> can also be triggered by setting
472
+ # <tt>ENV["SECRET_KEY_BASE_DUMMY"]</tt>. This is useful when precompiling
473
+ # assets for production as part of a build step that otherwise does not
474
+ # need access to the production secrets.
470
475
  #
471
- # In all other environments, we look for it first in <tt>ENV["SECRET_KEY_BASE"]</tt>,
472
- # then +credentials.secret_key_base+. For most applications, the correct place to store it is in the
473
- # encrypted credentials file.
476
+ # Dockerfile example: <tt>RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile</tt>.
474
477
  def secret_key_base
475
478
  config.secret_key_base
476
479
  end
@@ -45,11 +45,11 @@ module Rails
45
45
  class_attribute :directories, default: DIRECTORIES
46
46
  class_attribute :test_types, default: TEST_TYPES
47
47
 
48
- # Add directories to the output of the `bin/rails stats` command.
48
+ # Add directories to the output of the <tt>bin/rails stats</tt> command.
49
49
  #
50
50
  # Rails::CodeStatistics.register_directory("My Directory", "path/to/dir")
51
51
  #
52
- # For directories that contain test code, set the `test_directory` argument to true.
52
+ # For directories that contain test code, set the <tt>test_directory</tt> argument to true.
53
53
  #
54
54
  # Rails::CodeStatistics.register_directory("Model specs", "spec/models", test_directory: true)
55
55
  def self.register_directory(label, path, test_directory: false)
@@ -24,22 +24,26 @@ module Rails
24
24
 
25
25
  desc "configs", "Update config files in the application config/ directory", hide: true
26
26
  def configs
27
+ require_application!
27
28
  app_generator.create_boot_file
28
29
  app_generator.update_config_files
29
30
  end
30
31
 
31
32
  desc "bin", "Add or update executables in the application bin/ directory", hide: true
32
33
  def bin
34
+ require_application!
33
35
  app_generator.update_bin_files
34
36
  end
35
37
 
36
38
  desc "public_directory", "Add or update files in the application public/ directory", hide: true
37
39
  def public_directory
40
+ require_application!
38
41
  app_generator.create_public_files
39
42
  end
40
43
 
41
44
  desc "active_storage", "Run the active_storage:update command", hide: true
42
45
  def active_storage
46
+ require_application!
43
47
  app_generator.update_active_storage
44
48
  end
45
49
 
@@ -31,6 +31,7 @@ module Rails
31
31
 
32
32
  def execute(*)
33
33
  app = Rails.application
34
+ app.reload_routes_unless_loaded
34
35
  session = ActionDispatch::Integration::Session.new(app)
35
36
 
36
37
  # This makes app.url_for and app.foo_path available in the console
@@ -31,8 +31,6 @@ module Rails
31
31
  Rails::TestUnit::Runner.parse_options(args)
32
32
  run_prepare_task if self.args.none?(EXACT_TEST_ARGUMENT_PATTERN)
33
33
  Rails::TestUnit::Runner.run(args)
34
- rescue Rails::TestUnit::InvalidTestError => error
35
- raise ArgumentError, error.message
36
34
  end
37
35
 
38
36
  # Define Thor tasks to avoid going through Rake and booting twice when using bin/rails test:*
@@ -9,7 +9,7 @@ module Rails
9
9
  module VERSION
10
10
  MAJOR = 8
11
11
  MINOR = 0
12
- TINY = 1
12
+ TINY = 2
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -445,8 +445,8 @@ module Rails
445
445
 
446
446
  private
447
447
  # Define log for backwards compatibility. If just one argument is sent,
448
- # invoke say, otherwise invoke say_status. Differently from say and
449
- # similarly to say_status, this method respects the quiet? option given.
448
+ # invoke +say+, otherwise invoke +say_status+. Differently from +say+ and
449
+ # similarly to +say_status+, this method respects the +quiet?+ option given.
450
450
  def log(*args) # :doc:
451
451
  if args.size == 1
452
452
  say args.first.to_s unless options.quiet?
@@ -456,7 +456,7 @@ module Rails
456
456
  end
457
457
  end
458
458
 
459
- # Runs the supplied command using either "rake ..." or "rails ..."
459
+ # Runs the supplied command using either +rake+ or +rails+
460
460
  # based on the executor parameter provided.
461
461
  def execute_command(executor, command, options = {}) # :doc:
462
462
  log executor, command
@@ -490,12 +490,16 @@ module Rails
490
490
  end
491
491
  alias rebase_indentation optimize_indentation
492
492
 
493
- # Indent the +Gemfile+ to the depth of @indentation
493
+ # Returns a string corresponding to the current indentation level
494
+ # (i.e. 2 * <code>@indentation</code> spaces). See also
495
+ # #with_indentation, which can be used to manage the indentation level.
494
496
  def indentation # :doc:
495
497
  " " * @indentation
496
498
  end
497
499
 
498
- # Manage +Gemfile+ indentation for a DSL action block
500
+ # Increases the current indentation indentation level for the duration
501
+ # of the given block, and decreases it after the block ends. Call
502
+ # #indentation to get an indentation string.
499
503
  def with_indentation(&block) # :doc:
500
504
  @indentation += 1
501
505
  instance_eval(&block)
@@ -539,6 +539,11 @@ module Rails
539
539
  "latest"
540
540
  end
541
541
 
542
+ def yarn_through_corepack?
543
+ true if dockerfile_yarn_version == "latest"
544
+ dockerfile_yarn_version >= "2"
545
+ end
546
+
542
547
  def dockerfile_bun_version
543
548
  using_bun? and `bun --version`[/\d+\.\d+\.\d+/]
544
549
  rescue
@@ -592,7 +597,7 @@ module Rails
592
597
 
593
598
  def dockerfile_build_packages
594
599
  # start with the essentials
595
- packages = %w(build-essential git pkg-config)
600
+ packages = %w(build-essential git pkg-config libyaml-dev)
596
601
 
597
602
  # add database support
598
603
  packages << database.build_package unless skip_active_record?
@@ -305,11 +305,18 @@ module Rails
305
305
  :skip_active_job,
306
306
  :skip_active_storage,
307
307
  :skip_bootsnap,
308
+ :skip_brakeman,
309
+ :skip_ci,
308
310
  :skip_dev_gems,
311
+ :skip_docker,
309
312
  :skip_hotwire,
310
313
  :skip_javascript,
311
314
  :skip_jbuilder,
315
+ :skip_kamal,
316
+ :skip_rubocop,
317
+ :skip_solid,
312
318
  :skip_system_test,
319
+ :skip_thruster
313
320
  ],
314
321
  api: [
315
322
  :skip_asset_pipeline,
@@ -38,10 +38,17 @@ RUN apt-get update -qq && \
38
38
  ARG NODE_VERSION=<%= node_version %>
39
39
  ARG YARN_VERSION=<%= dockerfile_yarn_version %>
40
40
  ENV PATH=/usr/local/node/bin:$PATH
41
+ <% if yarn_through_corepack? -%>
42
+ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
43
+ /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
44
+ rm -rf /tmp/node-build-master
45
+ RUN corepack enable && yarn set version $YARN_VERSION
46
+ <% else -%>
41
47
  RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
42
48
  /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
43
49
  npm install -g yarn@$YARN_VERSION && \
44
50
  rm -rf /tmp/node-build-master
51
+ <% end -%>
45
52
 
46
53
  <% end -%>
47
54
  <% if using_bun? -%>
@@ -60,7 +67,7 @@ RUN bundle install && \
60
67
  <% if using_node? -%>
61
68
  # Install node modules
62
69
  COPY package.json yarn.lock ./
63
- RUN yarn install --frozen-lockfile
70
+ RUN yarn install --immutable
64
71
 
65
72
  <% end -%>
66
73
  <% if using_bun? -%>
@@ -66,15 +66,15 @@ group :development, :test do
66
66
  <%- end -%>
67
67
  end
68
68
  <% end -%>
69
-
70
69
  <%- unless options.api? || options.skip_dev_gems? -%>
70
+
71
71
  group :development do
72
72
  # Use console on exceptions pages [https://github.com/rails/web-console]
73
73
  gem "web-console"
74
74
  end
75
75
  <%- end -%>
76
-
77
76
  <%- if depends_on_system_test? -%>
77
+
78
78
  group :test do
79
79
  # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
80
80
  gem "capybara"
@@ -1,4 +1,4 @@
1
- # MySQL. Versions 5.5.8 and up are supported.
1
+ # MySQL. Versions 5.6.4 and up are supported.
2
2
  #
3
3
  # Install the MySQL driver
4
4
  # gem install mysql2
@@ -41,6 +41,16 @@ production:
41
41
  <<: *default
42
42
  # database: path/to/persistent/storage/production_cache.sqlite3
43
43
  migrations_paths: db/cache_migrate
44
+ queue:
45
+ <<: *default
46
+ # database: path/to/persistent/storage/production_queue.sqlite3
47
+ migrations_paths: db/queue_migrate
48
+ <%- unless options.skip_action_cable? -%>
49
+ cable:
50
+ <<: *default
51
+ # database: path/to/persistent/storage/production_cable.sqlite3
52
+ migrations_paths: db/cable_migrate
53
+ <%- end -%>
44
54
  <%- end -%>
45
55
  <%- else -%>
46
56
  # Store production database in the storage/ directory, which by default
@@ -1,4 +1,4 @@
1
- # MySQL. Versions 5.5.8 and up are supported.
1
+ # MySQL. Versions 5.6.4 and up are supported.
2
2
  #
3
3
  # Install the MySQL driver
4
4
  # gem install trilogy
@@ -15,14 +15,13 @@ default: &default
15
15
  pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
16
16
  username: root
17
17
  password:
18
- <% if database.socket -%>
19
- socket: <%= database.socket %>
20
- <% else -%>
21
18
  host: <%%= ENV.fetch("DB_HOST") { "<%= database.host %>" } %>
22
- <% end -%>
23
19
 
24
20
  development:
25
21
  <<: *default
22
+ <% if database.socket -%>
23
+ socket: <%= database.socket %>
24
+ <% end -%>
26
25
  database: <%= app_name %>_development
27
26
 
28
27
  # Warning: The database defined as "test" will be erased and
@@ -30,6 +29,9 @@ development:
30
29
  # Do not set this db to the same as development or production.
31
30
  test:
32
31
  <<: *default
32
+ <% if database.socket -%>
33
+ socket: <%= database.socket %>
34
+ <% end -%>
33
35
  database: <%= app_name %>_test
34
36
 
35
37
  # As with config/credentials.yml, you never want to store sensitive information,
@@ -120,8 +120,10 @@ jobs:
120
120
  - name: Run tests
121
121
  env:
122
122
  RAILS_ENV: test
123
- <%- if options[:database] == "mysql" || options[:database] == "trilogy" -%>
123
+ <%- if options[:database] == "mysql" -%>
124
124
  DATABASE_URL: mysql2://127.0.0.1:3306
125
+ <%- elsif options[:database] == "trilogy" -%>
126
+ DATABASE_URL: trilogy://127.0.0.1:3306
125
127
  <%- elsif options[:database] == "postgresql" -%>
126
128
  DATABASE_URL: postgres://postgres:postgres@localhost:5432
127
129
  <%- end -%>
@@ -84,8 +84,10 @@ jobs:
84
84
  - name: Run tests
85
85
  env:
86
86
  RAILS_ENV: test
87
- <%- if options[:database] == "mysql" || options[:database] == "trilogy" -%>
87
+ <%- if options[:database] == "mysql" -%>
88
88
  DATABASE_URL: mysql2://127.0.0.1:3306
89
+ <%- elsif options[:database] == "trilogy" -%>
90
+ DATABASE_URL: trilogy://127.0.0.1:3306
89
91
  <%- elsif options[:database] == "postgresql" -%>
90
92
  DATABASE_URL: postgres://postgres:postgres@localhost:5432
91
93
  <%- end -%>
@@ -100,4 +102,3 @@ jobs:
100
102
  path: ${{ github.workspace }}/tmp/screenshots
101
103
  if-no-files-found: ignore
102
104
  <% end -%>
103
-
@@ -97,11 +97,11 @@ module Rails
97
97
  # generator group to fall back to another group in case of missing generators,
98
98
  # they can add a fallback.
99
99
  #
100
- # For example, shoulda is considered a test_framework and is an extension
101
- # of test_unit. However, most part of shoulda generators are similar to
102
- # test_unit ones.
100
+ # For example, shoulda is considered a +test_framework+ and is an extension
101
+ # of +test_unit+. However, most part of shoulda generators are similar to
102
+ # +test_unit+ ones.
103
103
  #
104
- # Shoulda then can tell generators to search for test_unit generators when
104
+ # Shoulda then can tell generators to search for +test_unit+ generators when
105
105
  # some of them are not available by adding a fallback:
106
106
  #
107
107
  # Rails::Generators.fallbacks[:shoulda] = :test_unit
@@ -317,7 +317,7 @@ module Rails
317
317
 
318
318
  def run_after_generate_callback
319
319
  if defined?(@@generated_files) && !@@generated_files.empty?
320
- @after_generate_callbacks.each do |callback|
320
+ after_generate_callbacks.each do |callback|
321
321
  callback.call(@@generated_files)
322
322
  end
323
323
  @@generated_files = []
@@ -9,13 +9,17 @@ require "rails/test_unit/test_parser"
9
9
 
10
10
  module Rails
11
11
  module TestUnit
12
- class InvalidTestError < StandardError
12
+ class InvalidTestError < ArgumentError
13
13
  def initialize(path, suggestion)
14
- super(<<~MESSAGE.squish)
14
+ super(<<~MESSAGE.rstrip)
15
15
  Could not load test file: #{path}.
16
16
  #{suggestion}
17
17
  MESSAGE
18
18
  end
19
+
20
+ def backtrace(*args)
21
+ []
22
+ end
19
23
  end
20
24
 
21
25
  class Runner
@@ -68,7 +72,7 @@ module Rails
68
72
  if corrections.empty?
69
73
  raise exception
70
74
  end
71
- raise InvalidTestError.new(path, DidYouMean::Formatter.message_for(corrections))
75
+ raise(InvalidTestError.new(path, DidYouMean::Formatter.message_for(corrections)), cause: nil)
72
76
  else
73
77
  raise
74
78
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railties
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.1
4
+ version: 8.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-12-13 00:00:00.000000000 Z
10
+ date: 2025-03-12 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -16,28 +15,28 @@ dependencies:
16
15
  requirements:
17
16
  - - '='
18
17
  - !ruby/object:Gem::Version
19
- version: 8.0.1
18
+ version: 8.0.2
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - '='
25
24
  - !ruby/object:Gem::Version
26
- version: 8.0.1
25
+ version: 8.0.2
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: actionpack
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - '='
32
31
  - !ruby/object:Gem::Version
33
- version: 8.0.1
32
+ version: 8.0.2
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - '='
39
38
  - !ruby/object:Gem::Version
40
- version: 8.0.1
39
+ version: 8.0.2
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: rackup
43
42
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +119,14 @@ dependencies:
120
119
  requirements:
121
120
  - - '='
122
121
  - !ruby/object:Gem::Version
123
- version: 8.0.1
122
+ version: 8.0.2
124
123
  type: :development
125
124
  prerelease: false
126
125
  version_requirements: !ruby/object:Gem::Requirement
127
126
  requirements:
128
127
  - - '='
129
128
  - !ruby/object:Gem::Version
130
- version: 8.0.1
129
+ version: 8.0.2
131
130
  description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
132
131
  email: david@loudthinking.com
133
132
  executables:
@@ -491,12 +490,11 @@ licenses:
491
490
  - MIT
492
491
  metadata:
493
492
  bug_tracker_uri: https://github.com/rails/rails/issues
494
- changelog_uri: https://github.com/rails/rails/blob/v8.0.1/railties/CHANGELOG.md
495
- documentation_uri: https://api.rubyonrails.org/v8.0.1/
493
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.2/railties/CHANGELOG.md
494
+ documentation_uri: https://api.rubyonrails.org/v8.0.2/
496
495
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
497
- source_code_uri: https://github.com/rails/rails/tree/v8.0.1/railties
496
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.2/railties
498
497
  rubygems_mfa_required: 'true'
499
- post_install_message:
500
498
  rdoc_options:
501
499
  - "--exclude"
502
500
  - "."
@@ -513,8 +511,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
513
511
  - !ruby/object:Gem::Version
514
512
  version: '0'
515
513
  requirements: []
516
- rubygems_version: 3.5.22
517
- signing_key:
514
+ rubygems_version: 3.6.2
518
515
  specification_version: 4
519
516
  summary: Tools for creating, working with, and running Rails applications.
520
517
  test_files: []