railties 5.2.0 → 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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +108 -0
  3. data/lib/minitest/rails_plugin.rb +1 -1
  4. data/lib/rails/app_updater.rb +1 -0
  5. data/lib/rails/application/configuration.rb +1 -1
  6. data/lib/rails/application/finisher.rb +1 -1
  7. data/lib/rails/application/routes_reloader.rb +3 -19
  8. data/lib/rails/application.rb +18 -2
  9. data/lib/rails/command/actions.rb +10 -0
  10. data/lib/rails/command/base.rb +4 -0
  11. data/lib/rails/commands/credentials/credentials_command.rb +2 -2
  12. data/lib/rails/commands/encrypted/USAGE +28 -0
  13. data/lib/rails/commands/encrypted/encrypted_command.rb +1 -0
  14. data/lib/rails/engine.rb +21 -3
  15. data/lib/rails/gem_version.rb +1 -1
  16. data/lib/rails/generators/app_base.rb +12 -10
  17. data/lib/rails/generators/base.rb +4 -0
  18. data/lib/rails/generators/rails/app/app_generator.rb +5 -0
  19. data/lib/rails/generators/rails/app/templates/Gemfile.tt +2 -2
  20. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_2.rb.tt +3 -0
  21. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +3 -0
  22. data/lib/rails/generators/rails/app/templates/gitignore.tt +4 -1
  23. data/lib/rails/generators/rails/app/templates/ruby-version.tt +1 -1
  24. data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -0
  25. data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +21 -12
  26. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +5 -0
  27. data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +10 -2
  28. data/lib/rails/mailers_controller.rb +2 -0
  29. data/lib/rails/rack/logger.rb +4 -4
  30. data/lib/rails/tasks/framework.rake +1 -1
  31. data/lib/rails/tasks/yarn.rake +6 -1
  32. data/lib/rails/templates/rails/mailers/email.html.erb +10 -7
  33. metadata +14 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25be2ea21e6618d4a5c4925a8e2bc17a1085268558eddf1fbac80bfe19c08b08
4
- data.tar.gz: 1ff96ab5e5d5822bbbc11b87e3acd71ae326fc18e24c1f8173c9393cd61a8746
3
+ metadata.gz: d29e86115edab9c724ecc2189e576d536126a9b3cf39998b757d34f8e8814ba0
4
+ data.tar.gz: 65762e159387158b43097135022127ef0f1941d30468aec108dc3768258e4cf6
5
5
  SHA512:
6
- metadata.gz: 1585f8b3b3ea57f8350b894e6129b09bdfc518c4bbce249ca048fa832585334d4238e654bec9c6eecb4c3c6f9459299e70f2ea0a07704d8118e2c508eac9176c
7
- data.tar.gz: 73b84a73871f51ae45113565928eec4321119c0aa8260498cee99c534d35325c94197033d5a8f0451fdd859e4a2c43f8a20119e72b2586ddb56b465da0516380
6
+ metadata.gz: fd08ee427f2b6b305de5c3cc07d553569861687395e18364488e70e0dc6e03c59a097f657f97838f5f1cd8db4a8babd405872a5a89b2ed9e1bcb67beeaddb959
7
+ data.tar.gz: 6bc043ce2a55cb46e2b0643e8f6826fbcd7ec172684847ca1097b3c65de3bc5b65d53685908b70a05ebafba33169ef611a2f7d598e6a76675282bb1bca90949f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,111 @@
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
+
43
+ ## Rails 5.2.2 (December 04, 2018) ##
44
+
45
+ * Disable content security policy for mailer previews.
46
+
47
+ *Dylan Reile*
48
+
49
+ * Log the remote IP address of clients behind a proxy.
50
+
51
+ *Atul Bhosale*
52
+
53
+
54
+ ## Rails 5.2.1.1 (November 27, 2018) ##
55
+
56
+ * No changes.
57
+
58
+
59
+ ## Rails 5.2.1 (August 07, 2018) ##
60
+
61
+ * Respect `NODE_ENV` when running `rails yarn:install`.
62
+
63
+ *Max Melentiev*
64
+
65
+ * Don't generate unused files in `app:update` task
66
+
67
+ Skip the assets' initializer when sprockets isn't loaded.
68
+
69
+ Skip `config/spring.rb` when spring isn't loaded.
70
+
71
+ *Tsukuru Tanimichi*
72
+
73
+ * Don't include `bootsnap` by default in apps generated under JRuby.
74
+
75
+ Fixes #32641.
76
+
77
+ *Guillermo Iguaran*
78
+
79
+ * Create the `.ruby-version` file compatible with MRI/JRuby by default.
80
+
81
+ Fixes #32639.
82
+
83
+ *Guillermo Iguaran*
84
+
85
+ * Make the master.key file read-only for the owner upon generation on
86
+ POSIX-compliant systems.
87
+
88
+ Previously:
89
+
90
+ $ ls -l config/master.key
91
+ -rw-r--r-- 1 owner group 32 Jan 1 00:00 master.key
92
+
93
+ Now:
94
+
95
+ $ ls -l config/master.key
96
+ -rw------- 1 owner group 32 Jan 1 00:00 master.key
97
+
98
+ Fixes #32604.
99
+
100
+ *Jose Luis Duran*
101
+
102
+ * Allow use of `minitest-rails` gem with Rails test runner.
103
+
104
+ Fixes #31324.
105
+
106
+ *Yuji Yaginuma*
107
+
108
+
1
109
  ## Rails 5.2.0 (April 09, 2018) ##
2
110
 
3
111
  * Fix minitest rails plugin.
@@ -13,7 +13,7 @@ module Minitest
13
13
  end
14
14
 
15
15
  def self.plugin_rails_options(opts, options)
16
- Rails::TestUnit::Runner.attach_before_load_options(opts)
16
+ ::Rails::TestUnit::Runner.attach_before_load_options(opts)
17
17
 
18
18
  opts.on("-b", "--backtrace", "Show the complete backtrace") do
19
19
  options[:full_backtrace] = true
@@ -27,6 +27,7 @@ module Rails
27
27
  options[:skip_action_cable] = !defined?(ActionCable::Engine)
28
28
  options[:skip_sprockets] = !defined?(Sprockets::Railtie)
29
29
  options[:skip_puma] = !defined?(Puma)
30
+ options[:skip_spring] = !defined?(Spring)
30
31
  options
31
32
  end
32
33
  end
@@ -191,7 +191,7 @@ module Rails
191
191
  "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \
192
192
  "Error: #{e.message}"
193
193
  rescue => e
194
- raise e, "Cannot load `Rails.application.database_configuration`:\n#{e.message}", e.backtrace
194
+ raise e, "Cannot load database configuration:\n#{e.message}", e.backtrace
195
195
  end
196
196
 
197
197
  def colorize_logging
@@ -127,7 +127,7 @@ module Rails
127
127
  initializer :set_routes_reloader_hook do |app|
128
128
  reloader = routes_reloader
129
129
  reloader.eager_load = app.config.eager_load
130
- reloader.execute_if_updated
130
+ reloader.execute
131
131
  reloaders << reloader
132
132
  app.reloader.to_run do
133
133
  # We configure #execute rather than #execute_if_updated because if
@@ -7,7 +7,7 @@ module Rails
7
7
  class RoutesReloader
8
8
  attr_reader :route_sets, :paths
9
9
  attr_accessor :eager_load
10
- delegate :updated?, to: :updater
10
+ delegate :execute_if_updated, :execute, :updated?, to: :updater
11
11
 
12
12
  def initialize
13
13
  @paths = []
@@ -19,31 +19,15 @@ module Rails
19
19
  clear!
20
20
  load_paths
21
21
  finalize!
22
+ route_sets.each(&:eager_load!) if eager_load
22
23
  ensure
23
24
  revert
24
25
  end
25
26
 
26
- def execute
27
- ret = updater.execute
28
- route_sets.each(&:eager_load!) if eager_load
29
- ret
30
- end
31
-
32
- def execute_if_updated
33
- if updated = updater.execute_if_updated
34
- route_sets.each(&:eager_load!) if eager_load
35
- end
36
- updated
37
- end
38
-
39
27
  private
40
28
 
41
29
  def updater
42
- @updater ||= begin
43
- updater = ActiveSupport::FileUpdateChecker.new(paths) { reload! }
44
- updater.execute
45
- updater
46
- end
30
+ @updater ||= ActiveSupport::FileUpdateChecker.new(paths) { reload! }
47
31
  end
48
32
 
49
33
  def clear!
@@ -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
- 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
 
data/lib/rails/engine.rb CHANGED
@@ -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 = 0
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
 
@@ -441,7 +443,7 @@ module Rails
441
443
  end
442
444
 
443
445
  def depend_on_bootsnap?
444
- !options[:skip_bootsnap] && !options[:dev]
446
+ !options[:skip_bootsnap] && !options[:dev] && !defined?(JRUBY_VERSION)
445
447
  end
446
448
 
447
449
  def os_supports_listen_out_of_the_box?
@@ -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
@@ -146,6 +146,10 @@ module Rails
146
146
  template "config/storage.yml"
147
147
  end
148
148
 
149
+ if options[:skip_sprockets] && !assets_config_exist
150
+ remove_file "config/initializers/assets.rb"
151
+ end
152
+
149
153
  unless rack_cors_config_exist
150
154
  remove_file "config/initializers/cors.rb"
151
155
  end
@@ -228,6 +232,7 @@ module Rails
228
232
 
229
233
  def tmp
230
234
  empty_directory_with_keep_file "tmp"
235
+ empty_directory_with_keep_file "tmp/pids"
231
236
  empty_directory "tmp/cache"
232
237
  empty_directory "tmp/cache/assets"
233
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.
@@ -69,13 +70,12 @@ end
69
70
  <%- if depends_on_system_test? -%>
70
71
  group :test do
71
72
  # Adds support for Capybara system testing and selenium driver
72
- gem 'capybara', '>= 2.15', '< 4.0'
73
+ gem 'capybara', '>= 2.15'
73
74
  gem 'selenium-webdriver'
74
75
  # Easy installation and use of chromedriver to run system tests with Chrome
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]
@@ -33,3 +33,6 @@
33
33
 
34
34
  # Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header.
35
35
  # Rails.application.config.active_support.use_sha1_digests = true
36
+
37
+ # Make `form_with` generate id attributes for any generated HTML tags.
38
+ # Rails.application.config.action_view.form_with_generates_ids = true
@@ -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`.
@@ -24,8 +24,11 @@
24
24
  <% unless skip_active_storage? -%>
25
25
  # Ignore uploaded files in development
26
26
  /storage/*
27
-
27
+ <% if keeps? -%>
28
+ !/storage/.keep
28
29
  <% end -%>
30
+ <% end -%>
31
+
29
32
  <% unless options.skip_yarn? -%>
30
33
  /node_modules
31
34
  /yarn-error.log
@@ -1 +1 @@
1
- <%= RUBY_VERSION -%>
1
+ <%= ENV["RBENV_VERSION"] || ENV["rvm_ruby_string"] || "#{RUBY_ENGINE}-#{defined?(JRUBY_VERSION) ? JRUBY_VERSION : RUBY_VERSION}" -%>
@@ -27,6 +27,7 @@ module Rails
27
27
 
28
28
  def add_key_file_silently(key_path, key = nil)
29
29
  create_file key_path, key || ActiveSupport::EncryptedFile.generate_key
30
+ key_path.chmod 0600
30
31
  end
31
32
 
32
33
  def ignore_key_file(key_path, ignore: key_ignore(key_path))
@@ -4,21 +4,30 @@ $:.push File.expand_path("lib", __dir__)
4
4
  require "<%= namespaced_name %>/version"
5
5
 
6
6
  # Describe your gem and declare its dependencies:
7
- Gem::Specification.new do |s|
8
- s.name = "<%= name %>"
9
- s.version = <%= camelized_modules %>::VERSION
10
- s.authors = ["<%= author %>"]
11
- s.email = ["<%= email %>"]
12
- s.homepage = "TODO"
13
- s.summary = "TODO: Summary of <%= camelized_modules %>."
14
- s.description = "TODO: Description of <%= camelized_modules %>."
15
- s.license = "MIT"
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "<%= name %>"
9
+ spec.version = <%= camelized_modules %>::VERSION
10
+ spec.authors = ["<%= author %>"]
11
+ spec.email = ["<%= email %>"]
12
+ spec.homepage = "TODO"
13
+ spec.summary = "TODO: Summary of <%= camelized_modules %>."
14
+ spec.description = "TODO: Description of <%= camelized_modules %>."
15
+ spec.license = "MIT"
16
16
 
17
- s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
18
25
 
19
- <%= '# ' if options.dev? || options.edge? -%>s.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>"
26
+ spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
27
+
28
+ <%= '# ' if options.dev? || options.edge? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>"
20
29
  <% unless options[:skip_active_record] -%>
21
30
 
22
- s.add_development_dependency "<%= gem_for_database[0] %>"
31
+ spec.add_development_dependency "<%= gem_for_database[0] %>"
23
32
  <% end -%>
24
33
  end
@@ -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,7 +16,11 @@ 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
- fill_in "<%= attr.humanize.titleize %>", with: <%= value %>
19
+ <%- if boolean?(attr) -%>
20
+ check "<%= attr.humanize %>" if <%= value %>
21
+ <%- else -%>
22
+ fill_in "<%= attr.humanize %>", with: <%= value %>
23
+ <%- end -%>
20
24
  <%- end -%>
21
25
  click_on "Create <%= human_name %>"
22
26
 
@@ -29,7 +33,11 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase
29
33
  click_on "Edit", match: :first
30
34
 
31
35
  <%- attributes_hash.each do |attr, value| -%>
32
- fill_in "<%= attr.humanize.titleize %>", with: <%= value %>
36
+ <%- if boolean?(attr) -%>
37
+ check "<%= attr.humanize %>" if <%= value %>
38
+ <%- else -%>
39
+ fill_in "<%= attr.humanize %>", with: <%= value %>
40
+ <%- end -%>
33
41
  <%- end -%>
34
42
  click_on "Update <%= human_name %>"
35
43
 
@@ -10,6 +10,8 @@ class Rails::MailersController < Rails::ApplicationController # :nodoc:
10
10
 
11
11
  helper_method :part_query, :locale_query
12
12
 
13
+ content_security_policy(false)
14
+
13
15
  def index
14
16
  @previews = ActionMailer::Preview.all
15
17
  @page_title = "Mailer Previews"
@@ -35,9 +35,9 @@ module Rails
35
35
  instrumenter = ActiveSupport::Notifications.instrumenter
36
36
  instrumenter.start "request.action_dispatch", request: request
37
37
  logger.info { started_request_message(request) }
38
- resp = @app.call(env)
39
- resp[2] = ::Rack::BodyProxy.new(resp[2]) { finish(request) }
40
- resp
38
+ status, headers, body = @app.call(env)
39
+ body = ::Rack::BodyProxy.new(body) { finish(request) }
40
+ [status, headers, body]
41
41
  rescue Exception
42
42
  finish(request)
43
43
  raise
@@ -50,7 +50,7 @@ module Rails
50
50
  'Started %s "%s" for %s at %s' % [
51
51
  request.request_method,
52
52
  request.filtered_path,
53
- request.ip,
53
+ request.remote_ip,
54
54
  Time.now.to_default_s ]
55
55
  end
56
56
 
@@ -40,7 +40,7 @@ namespace :app do
40
40
  namespace :update do
41
41
  require "rails/app_updater"
42
42
 
43
- # desc "Update config/boot.rb from your current rails install"
43
+ # desc "Update config files from your current rails install"
44
44
  task :configs do
45
45
  Rails::AppUpdater.invoke_from_app_generator :create_boot_file
46
46
  Rails::AppUpdater.invoke_from_app_generator :update_config_files
@@ -3,7 +3,12 @@
3
3
  namespace :yarn do
4
4
  desc "Install all JavaScript dependencies as specified via Yarn"
5
5
  task :install do
6
- system("./bin/yarn install --no-progress --production")
6
+ # Install only production deps when for not usual envs.
7
+ valid_node_envs = %w[test development production]
8
+ node_env = ENV.fetch("NODE_ENV") do
9
+ valid_node_envs.include?(Rails.env) ? Rails.env : "production"
10
+ end
11
+ system({ "NODE_ENV" => node_env }, "./bin/yarn install --no-progress")
7
12
  end
8
13
  end
9
14
 
@@ -98,7 +98,7 @@
98
98
  <dt>Format:</dt>
99
99
  <% if @email.multipart? %>
100
100
  <dd>
101
- <select id="part" onchange="refreshBody();">
101
+ <select id="part" onchange="refreshBody(false);">
102
102
  <option <%= request.format == Mime[:html] ? 'selected' : '' %> value="<%= part_query('text/html') %>">View as HTML email</option>
103
103
  <option <%= request.format == Mime[:text] ? 'selected' : '' %> value="<%= part_query('text/plain') %>">View as plain-text email</option>
104
104
  </select>
@@ -110,7 +110,7 @@
110
110
  <% if I18n.available_locales.count > 1 %>
111
111
  <dt>Locale:</dt>
112
112
  <dd>
113
- <select id="locale" onchange="refreshBody();">
113
+ <select id="locale" onchange="refreshBody(true);">
114
114
  <% I18n.available_locales.each do |locale| %>
115
115
  <option <%= I18n.locale == locale ? 'selected' : '' %> value="<%= locale_query(locale) %>"><%= locale %></option>
116
116
  <% end %>
@@ -130,7 +130,7 @@
130
130
  <% end %>
131
131
 
132
132
  <script>
133
- function refreshBody() {
133
+ function refreshBody(reload) {
134
134
  var part_select = document.querySelector('select#part');
135
135
  var locale_select = document.querySelector('select#locale');
136
136
  var iframe = document.getElementsByName('messageBody')[0];
@@ -146,10 +146,13 @@
146
146
  }
147
147
  iframe.contentWindow.location = fresh_location;
148
148
 
149
- if (history.replaceState) {
150
- var url = location.pathname.replace(/\.(txt|html)$/, '');
151
- var format = /html/.test(part_param) ? '.html' : '.txt';
152
- var state_to_replace = locale_param ? (url + format + '?' + locale_param) : (url + format);
149
+ var url = location.pathname.replace(/\.(txt|html)$/, '');
150
+ var format = /html/.test(part_param) ? '.html' : '.txt';
151
+ var state_to_replace = locale_param ? (url + format + '?' + locale_param) : (url + format);
152
+
153
+ if (reload) {
154
+ location.href = state_to_replace;
155
+ } else if (history.replaceState) {
153
156
  window.history.replaceState({}, '', state_to_replace);
154
157
  }
155
158
  }
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.0
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-04-09 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.0
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.0
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.0
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.0
40
+ version: 5.2.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 0.18.1
61
+ version: 0.19.0
62
62
  - - "<"
63
63
  - !ruby/object:Gem::Version
64
64
  version: '2.0'
@@ -68,7 +68,7 @@ dependencies:
68
68
  requirements:
69
69
  - - ">="
70
70
  - !ruby/object:Gem::Version
71
- version: 0.18.1
71
+ version: 0.19.0
72
72
  - - "<"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '2.0'
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 5.2.0
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.0
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.0/railties
425
- changelog_uri: https://github.com/rails/rails/blob/v5.2.0/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.