railties 6.1.0.rc2 → 6.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac1f674c7449e11079fc024e3ad0615358ac700713d2e274c3fd2fb1ccb891d8
4
- data.tar.gz: 1d8841ea97183fa77784e1a7ef3ffdec7796fa281de6878f4aa3995d3e86078c
3
+ metadata.gz: 55150c81c10ad3400b9efd1be5186e637b051bebfa22c5f0d7e7ea2b99a7596c
4
+ data.tar.gz: c5a1f224c6709b3cb3b15cb77ef4e8b0154986b22dead106571918f796a675e7
5
5
  SHA512:
6
- metadata.gz: af92feb6af3f6b35e4974f91dd1b869736a45ab74c8b6217ee8b43bd62443efe22769b800b5adcc7810b18fb82a17a98ec888010fb984ef557989d3249ae81a7
7
- data.tar.gz: 3bc9759bea256a05a1a8d4160ded6fcaaf2657f880634de13863c6448f20d7d9bcdbb4970e9c0424b17add8823c91c216daaf2377a7b4f77c9078a25d2d51852
6
+ metadata.gz: d0e8a704a36ca741bf4441fe33558be0a76a8069d6d8c1b1daacaa3621134542d9058c3ae2b979dfb19882c6d058dfff771be2f5640328cd253a8f12dcf5865e
7
+ data.tar.gz: f5017766dcc4a5bde98b86e161320c511c237083d98c854dbc47ca18f62d4c0133463bafa8cc4b8b21fee336d6932b71d31be5b38401f57aa8a6687fbcad5d09
data/CHANGELOG.md CHANGED
@@ -1,9 +1,32 @@
1
- ## Rails 6.1.0.rc2 (December 01, 2020) ##
1
+ ## Rails 6.1.3 (February 17, 2021) ##
2
2
 
3
3
  * No changes.
4
4
 
5
5
 
6
- ## Rails 6.1.0.rc1 (November 02, 2020) ##
6
+ ## Rails 6.1.2.1 (February 10, 2021) ##
7
+
8
+ * No changes.
9
+
10
+
11
+ ## Rails 6.1.2 (February 09, 2021) ##
12
+
13
+ * No changes.
14
+
15
+
16
+ ## Rails 6.1.1 (January 07, 2021) ##
17
+
18
+ * Allow spaces in path to Yarn binstub and only run on precompile if needed.
19
+
20
+ *Markus Doits*
21
+
22
+ * Populate ARGV for app template.
23
+
24
+ Fixes #40945.
25
+
26
+ *Jonathan Hefner*
27
+
28
+
29
+ ## Rails 6.1.0 (December 09, 2020) ##
7
30
 
8
31
  * Added `Railtie#server` hook called when Rails starts a server.
9
32
  This is useful in case your application or a library needs to run
data/README.rdoc CHANGED
@@ -17,7 +17,7 @@ The latest version of Railties can be installed with RubyGems:
17
17
 
18
18
  Source code can be downloaded as part of the Rails project on GitHub
19
19
 
20
- * https://github.com/rails/rails/tree/master/railties
20
+ * https://github.com/rails/rails/tree/main/railties
21
21
 
22
22
  == License
23
23
 
@@ -189,7 +189,7 @@ module Rails
189
189
 
190
190
  class EdgeTask < RepoTask
191
191
  def rails_version
192
- "master@#{`git rev-parse HEAD`[0, 7]}"
192
+ "main@#{`git rev-parse HEAD`[0, 7]}"
193
193
  end
194
194
  end
195
195
 
@@ -183,6 +183,21 @@ module Rails
183
183
 
184
184
  if respond_to?(:action_view)
185
185
  action_view.form_with_generates_remote_forms = false
186
+ action_view.preload_links_header = true
187
+ end
188
+
189
+ if respond_to?(:active_storage)
190
+ active_storage.queues.analysis = nil
191
+ active_storage.queues.purge = nil
192
+ end
193
+
194
+ if respond_to?(:action_mailbox)
195
+ action_mailbox.queues.incineration = nil
196
+ action_mailbox.queues.routing = nil
197
+ end
198
+
199
+ if respond_to?(:action_mailer)
200
+ action_mailer.deliver_later_queue_name = nil
186
201
  end
187
202
 
188
203
  ActiveSupport.utc_to_local_returns_utc_offset_times = true
@@ -5,7 +5,7 @@ require "rails/source_annotation_extractor"
5
5
  module Rails
6
6
  module Command
7
7
  class NotesCommand < Base # :nodoc:
8
- class_option :annotations, aliases: "-a", desc: "Filter by specific annotations, e.g. Foobar TODO", type: :array, default: Rails::SourceAnnotationExtractor::Annotation.tags
8
+ class_option :annotations, aliases: "-a", desc: "Filter by specific annotations, e.g. Foobar TODO", type: :array
9
9
 
10
10
  def perform(*)
11
11
  require_application_and_environment!
@@ -15,7 +15,7 @@ module Rails
15
15
 
16
16
  private
17
17
  def display_annotations
18
- annotations = options[:annotations]
18
+ annotations = options[:annotations] || Rails::SourceAnnotationExtractor::Annotation.tags
19
19
  tag = (annotations.length > 1)
20
20
 
21
21
  Rails::SourceAnnotationExtractor.enumerate annotations.join("|"), tag: tag, dirs: directories
data/lib/rails/engine.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "rails/railtie"
4
4
  require "rails/engine/railties"
5
+ require "active_support/callbacks"
5
6
  require "active_support/core_ext/module/delegation"
6
7
  require "active_support/core_ext/object/try"
7
8
  require "pathname"
@@ -422,6 +423,9 @@ module Rails
422
423
  end
423
424
  end
424
425
 
426
+ include ActiveSupport::Callbacks
427
+ define_callbacks :load_seed
428
+
425
429
  delegate :middleware, :root, :paths, to: :config
426
430
  delegate :engine_name, :isolated?, to: :class
427
431
 
@@ -559,13 +563,7 @@ module Rails
559
563
  # Blog::Engine.load_seed
560
564
  def load_seed
561
565
  seed_file = paths["db/seeds.rb"].existent.first
562
- return unless seed_file
563
-
564
- if config.try(:active_job)&.queue_adapter == :async
565
- with_inline_jobs { load(seed_file) }
566
- else
567
- load(seed_file)
568
- end
566
+ run_callbacks(:load_seed) { load(seed_file) } if seed_file
569
567
  end
570
568
 
571
569
  initializer :load_environment_config, before: :load_environment_hook, group: :all do
@@ -637,6 +635,12 @@ module Rails
637
635
  end
638
636
  end
639
637
 
638
+ initializer :wrap_executor_around_load_seed do |app|
639
+ self.class.set_callback(:load_seed, :around) do |engine, seeds_block|
640
+ app.executor.wrap(&seeds_block)
641
+ end
642
+ end
643
+
640
644
  initializer :engines_blank_point do
641
645
  # We need this initializer so all extra initializers added in engines are
642
646
  # consistently executed after all the initializers above across all engines.
@@ -678,18 +682,6 @@ module Rails
678
682
  end
679
683
  end
680
684
 
681
- def with_inline_jobs
682
- queue_adapter = config.active_job.queue_adapter
683
- ActiveSupport.on_load(:active_job) do
684
- self.queue_adapter = :inline
685
- end
686
- yield
687
- ensure
688
- ActiveSupport.on_load(:active_job) do
689
- self.queue_adapter = queue_adapter
690
- end
691
- end
692
-
693
685
  def has_migrations?
694
686
  paths["db/migrate"].existent.any?
695
687
  end
@@ -9,8 +9,8 @@ module Rails
9
9
  module VERSION
10
10
  MAJOR = 6
11
11
  MINOR = 1
12
- TINY = 0
13
- PRE = "rc2"
12
+ TINY = 3
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -98,7 +98,7 @@ module Rails
98
98
  desc: "Set up the #{name} with Gemfile pointing to Rails repository"
99
99
 
100
100
  class_option :master, type: :boolean, default: false,
101
- desc: "Set up the #{name} with Gemfile pointing to Rails repository master branch"
101
+ desc: "Set up the #{name} with Gemfile pointing to Rails repository main branch"
102
102
 
103
103
  class_option :rc, type: :string, default: nil,
104
104
  desc: "Path to file containing extra configuration options for rails command"
@@ -110,8 +110,9 @@ module Rails
110
110
  desc: "Show this help message and quit"
111
111
  end
112
112
 
113
- def initialize(*args)
114
- @gem_filter = lambda { |gem| true }
113
+ def initialize(positional_argv, option_argv, *)
114
+ @argv = [*positional_argv, *option_argv]
115
+ @gem_filter = lambda { |gem| true }
115
116
  @extra_entries = []
116
117
  super
117
118
  end
@@ -172,9 +173,14 @@ module Rails
172
173
  end
173
174
 
174
175
  def apply_rails_template # :doc:
176
+ original_argv = ARGV.dup
177
+ ARGV.replace(@argv)
178
+
175
179
  apply rails_template if rails_template
176
180
  rescue Thor::Error, LoadError, Errno::ENOENT => e
177
181
  raise Error, "The template [#{rails_template}] could not be loaded. Error: #{e}"
182
+ ensure
183
+ ARGV.replace(original_argv)
178
184
  end
179
185
 
180
186
  def set_default_accessors! # :doc:
@@ -295,16 +301,16 @@ module Rails
295
301
  ]
296
302
  elsif options.edge?
297
303
  [
298
- GemfileEntry.github("rails", "rails/rails")
304
+ GemfileEntry.github("rails", "rails/rails", "6-1-stable")
299
305
  ]
300
306
  elsif options.master?
301
307
  [
302
- GemfileEntry.github("rails", "rails/rails", "master")
308
+ GemfileEntry.github("rails", "rails/rails", "main")
303
309
  ]
304
310
  else
305
311
  [GemfileEntry.version("rails",
306
312
  rails_version_specifier,
307
- "Bundle edge Rails instead: gem 'rails', github: 'rails/rails'")]
313
+ "Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'")]
308
314
  end
309
315
  end
310
316
 
@@ -423,11 +429,19 @@ module Rails
423
429
  end
424
430
 
425
431
  def run_webpack
426
- if webpack_install?
427
- rails_command "webpacker:install"
428
- if options[:webpack] && options[:webpack] != "webpack"
429
- rails_command "webpacker:install:#{options[:webpack]}"
430
- end
432
+ return unless webpack_install?
433
+
434
+ unless bundle_install?
435
+ say <<~EXPLAIN
436
+ Skipping `rails webpacker:install` because `bundle install` was skipped.
437
+ To complete setup, you must run `bundle install` followed by `rails webpacker:install`.
438
+ EXPLAIN
439
+ return
440
+ end
441
+
442
+ rails_command "webpacker:install"
443
+ if options[:webpack] && options[:webpack] != "webpack"
444
+ rails_command "webpacker:install:#{options[:webpack]}"
431
445
  end
432
446
  end
433
447
 
@@ -104,9 +104,7 @@ module Rails
104
104
  end
105
105
 
106
106
  def yarn_when_updating
107
- return if File.exist?("bin/yarn")
108
-
109
- template "bin/yarn" do |content|
107
+ template "bin/yarn", force: true do |content|
110
108
  "#{shebang}\n" + content
111
109
  end
112
110
 
@@ -1,3 +1,6 @@
1
+ <% if spring_install? -%>
2
+ load File.expand_path("spring", __dir__)
3
+ <% end -%>
1
4
  APP_PATH = File.expand_path('../config/application', __dir__)
2
5
  require_relative "../config/boot"
3
6
  require "rails/commands"
@@ -1,3 +1,6 @@
1
+ <% if spring_install? -%>
2
+ load File.expand_path("spring", __dir__)
3
+ <% end -%>
1
4
  require_relative "../config/boot"
2
5
  require "rake"
3
6
  Rake.application.run
@@ -1,7 +1,13 @@
1
- # Load Spring without loading other gems in the Gemfile, for speed.
2
- require "bundler"
3
- Bundler.locked_gems.specs.find { |spec| spec.name == "spring" }&.tap do |spring|
4
- Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
5
- gem "spring", spring.version
6
- require "spring/binstub"
1
+ if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
2
+ gem "bundler"
3
+ require "bundler"
4
+
5
+ # Load Spring without loading other gems in the Gemfile, for speed.
6
+ Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring|
7
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
8
+ gem "spring", spring.version
9
+ require "spring/binstub"
10
+ rescue Gem::LoadError
11
+ # Ignore when Spring is not installed.
12
+ end
7
13
  end
@@ -1,16 +1,16 @@
1
- require 'pathname'
2
-
3
1
  APP_ROOT = File.expand_path('..', __dir__)
4
2
  Dir.chdir(APP_ROOT) do
5
- executable_path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path|
6
- normalized_path = File.expand_path(path)
3
+ yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
4
+ select { |dir| File.expand_path(dir) != __dir__ }.
5
+ product(["yarn", "yarn.cmd", "yarn.ps1"]).
6
+ map { |dir, file| File.expand_path(file, dir) }.
7
+ find { |file| File.executable?(file) }
7
8
 
8
- normalized_path != __dir__ && File.executable?(Pathname.new(normalized_path).join('yarn'))
9
+ if yarn
10
+ exec yarn, *ARGV
11
+ else
12
+ $stderr.puts "Yarn executable was not detected in the system."
13
+ $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
14
+ exit 1
9
15
  end
10
-
11
- exec File.expand_path(Pathname.new(executable_path).join('yarn')), *ARGV
12
- rescue Errno::ENOENT
13
- $stderr.puts "Yarn executable was not detected in the system."
14
- $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
15
- exit 1
16
16
  end
@@ -1,10 +1,4 @@
1
1
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
- <% if spring_install? -%>
3
-
4
- if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
5
- load File.expand_path("../bin/spring", __dir__)
6
- end
7
- <% end -%>
8
2
 
9
3
  require "bundler/setup" # Set up gems listed in the Gemfile.
10
4
  <% if depend_on_bootsnap? -%>
@@ -46,3 +46,22 @@
46
46
 
47
47
  # Make `form_with` generate non-remote forms by default.
48
48
  # Rails.application.config.action_view.form_with_generates_remote_forms = false
49
+
50
+ # Set the default queue name for the analysis job to the queue adapter default.
51
+ # Rails.application.config.active_storage.queues.analysis = nil
52
+
53
+ # Set the default queue name for the purge job to the queue adapter default.
54
+ # Rails.application.config.active_storage.queues.purge = nil
55
+
56
+ # Set the default queue name for the incineration job to the queue adapter default.
57
+ # Rails.application.config.action_mailbox.queues.incineration = nil
58
+
59
+ # Set the default queue name for the routing job to the queue adapter default.
60
+ # Rails.application.config.action_mailbox.queues.routing = nil
61
+
62
+ # Set the default queue name for the mail deliver job to the queue adapter default.
63
+ # Rails.application.config.action_mailer.deliver_later_queue_name = nil
64
+
65
+ # Generate a `Link` header that gives a hint to modern browsers about
66
+ # preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
67
+ # Rails.application.config.action_view.preload_links_header = true
@@ -103,6 +103,7 @@ task default: :test
103
103
  opts = options.transform_keys(&:to_sym).except(*DUMMY_IGNORE_OPTIONS)
104
104
  opts[:force] = force
105
105
  opts[:skip_bundle] = true
106
+ opts[:skip_spring] = true
106
107
  opts[:skip_listen] = true
107
108
  opts[:skip_git] = true
108
109
  opts[:skip_turbolinks] = true
data/lib/rails/railtie.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "rails/initializable"
4
+ require "active_support/descendants_tracker"
4
5
  require "active_support/inflector"
5
6
  require "active_support/core_ext/module/introspection"
6
7
  require "active_support/core_ext/module/delegation"
@@ -119,11 +120,11 @@ module Rails
119
120
  # this less confusing for everyone.
120
121
  # It can be used like this:
121
122
  #
122
- # class MyRailtie < Rails::Railtie
123
- # server do
124
- # WebpackServer.start
123
+ # class MyRailtie < Rails::Railtie
124
+ # server do
125
+ # WebpackServer.start
126
+ # end
125
127
  # end
126
- # end
127
128
  #
128
129
  # == Application and Engine
129
130
  #
@@ -135,6 +136,7 @@ module Rails
135
136
  class Railtie
136
137
  autoload :Configuration, "rails/railtie/configuration"
137
138
 
139
+ extend ActiveSupport::DescendantsTracker
138
140
  include Initializable
139
141
 
140
142
  ABSTRACT_RAILTIES = %w(Rails::Railtie Rails::Engine Rails::Application)
@@ -144,13 +146,7 @@ module Rails
144
146
  delegate :config, to: :instance
145
147
 
146
148
  def subclasses
147
- @subclasses ||= []
148
- end
149
-
150
- def inherited(base)
151
- unless base.abstract_railtie?
152
- subclasses << base
153
- end
149
+ super.reject(&:abstract_railtie?)
154
150
  end
155
151
 
156
152
  def rake_tasks(&blk)
@@ -72,7 +72,7 @@ module Rails
72
72
  #
73
73
  # See <tt>#find_in</tt> for a list of file extensions that will be taken into account.
74
74
  #
75
- # This class method is the single entry point for the `rails notes` command.
75
+ # This class method is the single entry point for the <tt>rails notes</tt> command.
76
76
  def self.enumerate(tag = nil, options = {})
77
77
  tag ||= Annotation.tags.join("|")
78
78
  extractor = new(tag)
@@ -8,11 +8,23 @@ namespace :yarn do
8
8
  node_env = ENV.fetch("NODE_ENV") do
9
9
  valid_node_envs.include?(Rails.env) ? Rails.env : "production"
10
10
  end
11
- system({ "NODE_ENV" => node_env }, "#{Rails.root}/bin/yarn install --no-progress --frozen-lockfile")
11
+
12
+ yarn_flags =
13
+ if `"#{Rails.root}/bin/yarn" --version`.start_with?("1")
14
+ "--no-progress --frozen-lockfile"
15
+ else
16
+ "--immutable"
17
+ end
18
+
19
+ system({ "NODE_ENV" => node_env }, "\"#{Rails.root}/bin/yarn\" install #{yarn_flags}")
20
+ rescue Errno::ENOENT
21
+ $stderr.puts "bin/yarn was not found."
22
+ $stderr.puts "Please run `bundle exec rails app:update:bin` to create it."
23
+ exit 1
12
24
  end
13
25
  end
14
26
 
15
27
  # Run Yarn prior to Sprockets assets precompilation, so dependencies are available for use.
16
- if Rake::Task.task_defined?("assets:precompile")
28
+ if Rake::Task.task_defined?("assets:precompile") && File.exist?(Rails.root.join("bin", "yarn"))
17
29
  Rake::Task["assets:precompile"].enhance [ "yarn:install" ]
18
30
  end
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: 6.1.0.rc2
4
+ version: 6.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-01 00:00:00.000000000 Z
11
+ date: 2021-02-17 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: 6.1.0.rc2
19
+ version: 6.1.3
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: 6.1.0.rc2
26
+ version: 6.1.3
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: 6.1.0.rc2
33
+ version: 6.1.3
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: 6.1.0.rc2
40
+ version: 6.1.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 6.1.0.rc2
89
+ version: 6.1.3
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 6.1.0.rc2
96
+ version: 6.1.3
97
97
  description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
98
98
  email: david@loudthinking.com
99
99
  executables:
@@ -426,11 +426,11 @@ licenses:
426
426
  - MIT
427
427
  metadata:
428
428
  bug_tracker_uri: https://github.com/rails/rails/issues
429
- changelog_uri: https://github.com/rails/rails/blob/v6.1.0.rc2/railties/CHANGELOG.md
430
- documentation_uri: https://api.rubyonrails.org/v6.1.0.rc2/
429
+ changelog_uri: https://github.com/rails/rails/blob/v6.1.3/railties/CHANGELOG.md
430
+ documentation_uri: https://api.rubyonrails.org/v6.1.3/
431
431
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
432
- source_code_uri: https://github.com/rails/rails/tree/v6.1.0.rc2/railties
433
- post_install_message:
432
+ source_code_uri: https://github.com/rails/rails/tree/v6.1.3/railties
433
+ post_install_message:
434
434
  rdoc_options:
435
435
  - "--exclude"
436
436
  - "."
@@ -443,12 +443,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
443
443
  version: 2.5.0
444
444
  required_rubygems_version: !ruby/object:Gem::Requirement
445
445
  requirements:
446
- - - ">"
446
+ - - ">="
447
447
  - !ruby/object:Gem::Version
448
- version: 1.3.1
448
+ version: '0'
449
449
  requirements: []
450
- rubygems_version: 3.1.4
451
- signing_key:
450
+ rubygems_version: 3.2.3
451
+ signing_key:
452
452
  specification_version: 4
453
453
  summary: Tools for creating, working with, and running Rails applications.
454
454
  test_files: []