railties 5.2.2 → 5.2.4

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: fc6d0a9549676d109f5863192e512326bd2ac07df40c06161ce9a45b929b64f8
4
- data.tar.gz: f7ab90b6813852496920d79d977bb819b6e58c32e51a07c82b3c4f2d51f4fe54
3
+ metadata.gz: d29e86115edab9c724ecc2189e576d536126a9b3cf39998b757d34f8e8814ba0
4
+ data.tar.gz: 65762e159387158b43097135022127ef0f1941d30468aec108dc3768258e4cf6
5
5
  SHA512:
6
- metadata.gz: 8ad61f17fc22e112c23fbfd0448fcbac10251087f65340b1f171faae50eef8bc93d9e1cab5bc0fe366a211d8971e107e6d47a9febc913db5d8e10b05d3609dc2
7
- data.tar.gz: edbad6cda49e8242bf8c5be9c40369b20859bee4c595b2a7b4b4634d40b0efe984c9a0a0b0f82a54d5f8aa290075a29d968fb63daed7c4e9d7e675f616e7f3d8
6
+ metadata.gz: fd08ee427f2b6b305de5c3cc07d553569861687395e18364488e70e0dc6e03c59a097f657f97838f5f1cd8db4a8babd405872a5a89b2ed9e1bcb67beeaddb959
7
+ data.tar.gz: 6bc043ce2a55cb46e2b0643e8f6826fbcd7ec172684847ca1097b3c65de3bc5b65d53685908b70a05ebafba33169ef611a2f7d598e6a76675282bb1bca90949f
@@ -1,3 +1,45 @@
1
+ ## Rails 5.2.4 (November 27, 2019) ##
2
+
3
+ * Use original `bundler` environment variables during the process of generating a new rails project.
4
+
5
+ *Marco Costa*
6
+
7
+ * Allow loading seeds without ActiveJob.
8
+
9
+ Fixes #35782
10
+
11
+ *Jeremy Weathers*
12
+
13
+ * Only force `:async` ActiveJob adapter to `:inline` during seeding.
14
+
15
+ *BatedUrGonnaDie*
16
+
17
+
18
+ ## Rails 5.2.3 (March 27, 2019) ##
19
+
20
+ * Seed database with inline ActiveJob job adapter.
21
+
22
+ *Gannon McGibbon*
23
+
24
+ * Fix boolean interaction in scaffold system tests.
25
+
26
+ *Gannon McGibbon*
27
+
28
+
29
+ ## Rails 5.2.2.1 (March 11, 2019) ##
30
+
31
+ * Generate random development secrets
32
+
33
+ A random development secret is now generated to tmp/development_secret.txt
34
+
35
+ This avoids an issue where development mode servers were vulnerable to
36
+ remote code execution.
37
+
38
+ Fixes CVE-2019-5420
39
+
40
+ *Eileen M. Uchitelle*, *Aaron Patterson*, *John Hawthorn*
41
+
42
+
1
43
  ## Rails 5.2.2 (December 04, 2018) ##
2
44
 
3
45
  * Disable content security policy for mailer previews.
@@ -426,8 +426,8 @@ module Rails
426
426
  # then credentials.secret_key_base, and finally secrets.secret_key_base. For most applications,
427
427
  # the correct place to store it is in the encrypted credentials file.
428
428
  def secret_key_base
429
- if Rails.env.test? || Rails.env.development?
430
- secrets.secret_key_base || Digest::MD5.hexdigest(self.class.name)
429
+ if Rails.env.development? || Rails.env.test?
430
+ secrets.secret_key_base ||= generate_development_secret
431
431
  else
432
432
  validate_secret_key_base(
433
433
  ENV["SECRET_KEY_BASE"] || credentials.secret_key_base || secrets.secret_key_base
@@ -588,6 +588,22 @@ module Rails
588
588
 
589
589
  private
590
590
 
591
+ def generate_development_secret
592
+ if secrets.secret_key_base.nil?
593
+ key_file = Rails.root.join("tmp/development_secret.txt")
594
+
595
+ if !File.exist?(key_file)
596
+ random_key = SecureRandom.hex(64)
597
+ FileUtils.mkdir_p(key_file.dirname)
598
+ File.binwrite(key_file, random_key)
599
+ end
600
+
601
+ secrets.secret_key_base = File.binread(key_file)
602
+ end
603
+
604
+ secrets.secret_key_base
605
+ end
606
+
591
607
  def build_request(env)
592
608
  req = super
593
609
  env["ORIGINAL_FULLPATH"] = req.fullpath
@@ -11,10 +11,20 @@ module Rails
11
11
  end
12
12
 
13
13
  def require_application_and_environment!
14
+ require_application!
15
+ require_environment!
16
+ end
17
+
18
+ def require_application!
14
19
  require ENGINE_PATH if defined?(ENGINE_PATH)
15
20
 
16
21
  if defined?(APP_PATH)
17
22
  require APP_PATH
23
+ end
24
+ end
25
+
26
+ def require_environment!
27
+ if defined?(APP_PATH)
18
28
  Rails.application.require_environment!
19
29
  end
20
30
  end
@@ -17,6 +17,10 @@ module Rails
17
17
  include Actions
18
18
 
19
19
  class << self
20
+ def exit_on_failure? # :nodoc:
21
+ false
22
+ end
23
+
20
24
  # Returns true when the app is a Rails engine.
21
25
  def engine?
22
26
  defined?(ENGINE_ROOT)
@@ -17,7 +17,7 @@ module Rails
17
17
  end
18
18
 
19
19
  def edit
20
- require_application_and_environment!
20
+ require_application!
21
21
 
22
22
  ensure_editor_available(command: "bin/rails credentials:edit") || (return)
23
23
  ensure_master_key_has_been_added if Rails.application.credentials.key.nil?
@@ -31,7 +31,7 @@ module Rails
31
31
  end
32
32
 
33
33
  def show
34
- require_application_and_environment!
34
+ require_application!
35
35
 
36
36
  say Rails.application.credentials.read.presence || missing_credentials_message
37
37
  end
@@ -0,0 +1,28 @@
1
+ === Storing Encrypted Files in Source Control
2
+
3
+ The Rails `encrypted` commands provide access to encrypted files or configurations.
4
+ See the `Rails.application.encrypted` documentation for using them in your app.
5
+
6
+ === Encryption Keys
7
+
8
+ By default, Rails looks for the encryption key in `config/master.key` or
9
+ `ENV["RAILS_MASTER_KEY"]`, but that lookup can be overriden with `--key`:
10
+
11
+ rails encrypted:edit config/encrypted_file.yml.enc --key config/encrypted_file.key
12
+
13
+ Don't commit the key! Add it to your source control's ignore file. If you use
14
+ Git, Rails handles this for you.
15
+
16
+ === Editing Files
17
+
18
+ To edit or create an encrypted file use:
19
+
20
+ rails encrypted:edit config/encrypted_file.yml.enc
21
+
22
+ This opens a temporary file in `$EDITOR` with the decrypted contents for editing.
23
+
24
+ === Viewing Files
25
+
26
+ To print the decrypted contents of an encrypted file use:
27
+
28
+ rails encrypted:show config/encrypted_file.yml.enc
@@ -16,6 +16,7 @@ module Rails
16
16
  def help
17
17
  say "Usage:\n #{self.class.banner}"
18
18
  say ""
19
+ say self.class.desc
19
20
  end
20
21
  end
21
22
 
@@ -531,9 +531,9 @@ module Rails
531
531
 
532
532
  # Defines the routes for this engine. If a block is given to
533
533
  # routes, it is appended to the engine.
534
- def routes
534
+ def routes(&block)
535
535
  @routes ||= ActionDispatch::Routing::RouteSet.new_with_config(config)
536
- @routes.append(&Proc.new) if block_given?
536
+ @routes.append(&block) if block_given?
537
537
  @routes
538
538
  end
539
539
 
@@ -548,7 +548,13 @@ module Rails
548
548
  # Blog::Engine.load_seed
549
549
  def load_seed
550
550
  seed_file = paths["db/seeds.rb"].existent.first
551
- load(seed_file) if seed_file
551
+ return unless seed_file
552
+
553
+ if config.try(:active_job).try!(:queue_adapter) == :async
554
+ with_inline_jobs { load(seed_file) }
555
+ else
556
+ load(seed_file)
557
+ end
552
558
  end
553
559
 
554
560
  # Add configured load paths to Ruby's load path, and remove duplicate entries.
@@ -658,6 +664,18 @@ module Rails
658
664
  end
659
665
  end
660
666
 
667
+ def with_inline_jobs
668
+ queue_adapter = config.active_job.queue_adapter
669
+ ActiveSupport.on_load(:active_job) do
670
+ self.queue_adapter = :inline
671
+ end
672
+ yield
673
+ ensure
674
+ ActiveSupport.on_load(:active_job) do
675
+ self.queue_adapter = queue_adapter
676
+ end
677
+ end
678
+
661
679
  def has_migrations?
662
680
  paths["db/migrate"].existent.any?
663
681
  end
@@ -9,7 +9,7 @@ module Rails
9
9
  module VERSION
10
10
  MAJOR = 5
11
11
  MINOR = 2
12
- TINY = 2
12
+ TINY = 4
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -408,19 +408,21 @@ module Rails
408
408
  # its own vendored Thor, which could be a different version. Running both
409
409
  # things in the same process is a recipe for a night with paracetamol.
410
410
  #
411
- # We unset temporary bundler variables to load proper bundler and Gemfile.
412
- #
413
411
  # Thanks to James Tucker for the Gem tricks involved in this call.
414
412
  _bundle_command = Gem.bin_path("bundler", "bundle")
415
413
 
416
414
  require "bundler"
417
- Bundler.with_clean_env do
418
- full_command = %Q["#{Gem.ruby}" "#{_bundle_command}" #{command}]
419
- if options[:quiet]
420
- system(full_command, out: File::NULL)
421
- else
422
- system(full_command)
423
- end
415
+ Bundler.with_original_env do
416
+ exec_bundle_command(_bundle_command, command)
417
+ end
418
+ end
419
+
420
+ def exec_bundle_command(bundle_command, command)
421
+ full_command = %Q["#{Gem.ruby}" "#{bundle_command}" #{command}]
422
+ if options[:quiet]
423
+ system(full_command, out: File::NULL)
424
+ else
425
+ system(full_command)
424
426
  end
425
427
  end
426
428
 
@@ -24,6 +24,10 @@ module Rails
24
24
  add_runtime_options!
25
25
  strict_args_position!
26
26
 
27
+ def self.exit_on_failure? # :nodoc:
28
+ false
29
+ end
30
+
27
31
  # Returns the source root for this generator using default_source_root as default.
28
32
  def self.source_root(path = nil)
29
33
  @_source_root = path if path
@@ -232,6 +232,7 @@ module Rails
232
232
 
233
233
  def tmp
234
234
  empty_directory_with_keep_file "tmp"
235
+ empty_directory_with_keep_file "tmp/pids"
235
236
  empty_directory "tmp/cache"
236
237
  empty_directory "tmp/cache/assets"
237
238
  end
@@ -45,6 +45,7 @@ group :development, :test do
45
45
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
46
46
  end
47
47
 
48
+ <% end -%>
48
49
  group :development do
49
50
  <%- unless options.api? -%>
50
51
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
@@ -75,7 +76,6 @@ group :test do
75
76
  gem 'chromedriver-helper'
76
77
  end
77
78
  <%- end -%>
78
- <% end -%>
79
79
 
80
80
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
81
81
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
@@ -15,6 +15,9 @@ port ENV.fetch("PORT") { 3000 }
15
15
  #
16
16
  environment ENV.fetch("RAILS_ENV") { "development" }
17
17
 
18
+ # Specifies the `pidfile` that Puma will use.
19
+ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
20
+
18
21
  # Specifies the number of `workers` to boot in clustered mode.
19
22
  # Workers are forked webserver processes. If using threads and workers together
20
23
  # the concurrency of the application would be max `threads` * `workers`.
@@ -54,6 +54,11 @@ module TestUnit # :nodoc:
54
54
  end
55
55
  end.sort.to_h
56
56
  end
57
+
58
+ def boolean?(name)
59
+ attribute = attributes.find { |attr| attr.name == name }
60
+ attribute && attribute.type == :boolean
61
+ end
57
62
  end
58
63
  end
59
64
  end
@@ -16,8 +16,12 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase
16
16
  click_on "New <%= class_name.titleize %>"
17
17
 
18
18
  <%- attributes_hash.each do |attr, value| -%>
19
+ <%- if boolean?(attr) -%>
20
+ check "<%= attr.humanize %>" if <%= value %>
21
+ <%- else -%>
19
22
  fill_in "<%= attr.humanize %>", with: <%= value %>
20
23
  <%- end -%>
24
+ <%- end -%>
21
25
  click_on "Create <%= human_name %>"
22
26
 
23
27
  assert_text "<%= human_name %> was successfully created"
@@ -29,8 +33,12 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase
29
33
  click_on "Edit", match: :first
30
34
 
31
35
  <%- attributes_hash.each do |attr, value| -%>
36
+ <%- if boolean?(attr) -%>
37
+ check "<%= attr.humanize %>" if <%= value %>
38
+ <%- else -%>
32
39
  fill_in "<%= attr.humanize %>", with: <%= value %>
33
40
  <%- end -%>
41
+ <%- end -%>
34
42
  click_on "Update <%= human_name %>"
35
43
 
36
44
  assert_text "<%= human_name %> was successfully updated"
@@ -6,8 +6,7 @@ namespace :yarn do
6
6
  # Install only production deps when for not usual envs.
7
7
  valid_node_envs = %w[test development production]
8
8
  node_env = ENV.fetch("NODE_ENV") do
9
- rails_env = ENV["RAILS_ENV"]
10
- valid_node_envs.include?(rails_env) ? rails_env : "production"
9
+ valid_node_envs.include?(Rails.env) ? Rails.env : "production"
11
10
  end
12
11
  system({ "NODE_ENV" => node_env }, "./bin/yarn install --no-progress")
13
12
  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: 5.2.2
4
+ version: 5.2.4
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: 2018-12-04 00:00:00.000000000 Z
11
+ date: 2019-11-27 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: 5.2.2
19
+ version: 5.2.4
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: 5.2.2
26
+ version: 5.2.4
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: 5.2.2
33
+ version: 5.2.4
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: 5.2.2
40
+ version: 5.2.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 5.2.2
95
+ version: 5.2.4
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 5.2.2
102
+ version: 5.2.4
103
103
  description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
104
104
  email: david@loudthinking.com
105
105
  executables:
@@ -143,6 +143,7 @@ files:
143
143
  - lib/rails/commands/credentials/credentials_command.rb
144
144
  - lib/rails/commands/dbconsole/dbconsole_command.rb
145
145
  - lib/rails/commands/destroy/destroy_command.rb
146
+ - lib/rails/commands/encrypted/USAGE
146
147
  - lib/rails/commands/encrypted/encrypted_command.rb
147
148
  - lib/rails/commands/generate/generate_command.rb
148
149
  - lib/rails/commands/help/USAGE
@@ -421,8 +422,8 @@ homepage: http://rubyonrails.org
421
422
  licenses:
422
423
  - MIT
423
424
  metadata:
424
- source_code_uri: https://github.com/rails/rails/tree/v5.2.2/railties
425
- changelog_uri: https://github.com/rails/rails/blob/v5.2.2/railties/CHANGELOG.md
425
+ source_code_uri: https://github.com/rails/rails/tree/v5.2.4/railties
426
+ changelog_uri: https://github.com/rails/rails/blob/v5.2.4/railties/CHANGELOG.md
426
427
  post_install_message:
427
428
  rdoc_options:
428
429
  - "--exclude"
@@ -440,8 +441,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
440
441
  - !ruby/object:Gem::Version
441
442
  version: '0'
442
443
  requirements: []
443
- rubyforge_project:
444
- rubygems_version: 2.7.6
444
+ rubygems_version: 3.0.3
445
445
  signing_key:
446
446
  specification_version: 4
447
447
  summary: Tools for creating, working with, and running Rails applications.