railties 5.2.0.beta2 → 5.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -1
- data/MIT-LICENSE +1 -1
- data/lib/rails/application.rb +2 -1
- data/lib/rails/application/configuration.rb +4 -1
- data/lib/rails/application/default_middleware_stack.rb +1 -0
- data/lib/rails/application/finisher.rb +1 -1
- data/lib/rails/commands/credentials/credentials_command.rb +9 -2
- data/lib/rails/commands/encrypted/encrypted_command.rb +10 -2
- data/lib/rails/commands/secrets/secrets_command.rb +1 -1
- data/lib/rails/commands/server/server_command.rb +1 -1
- data/lib/rails/gem_version.rb +1 -1
- data/lib/rails/generators/app_base.rb +15 -16
- data/lib/rails/generators/generated_attribute.rb +2 -2
- data/lib/rails/generators/rails/app/app_generator.rb +8 -9
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +12 -7
- data/lib/rails/generators/rails/app/templates/bin/yarn.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +3 -2
- data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +2 -0
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +4 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +12 -10
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_2.rb.tt +4 -1
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +1 -23
- data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +1 -0
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +6 -3
- data/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +3 -0
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +1 -1
- data/lib/rails/info.rb +1 -1
- data/lib/rails/mailers_controller.rb +10 -2
- data/lib/rails/railtie/configuration.rb +1 -1
- data/lib/rails/templates/rails/mailers/email.html.erb +36 -10
- data/lib/rails/test_help.rb +0 -4
- data/lib/rails/test_unit/reporter.rb +8 -2
- data/lib/rails/test_unit/runner.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b243e4fd3c66e8a713fdebd1affc6fc463b4f789acf9a0a0396a779b4154f244
|
4
|
+
data.tar.gz: 760cfb30ce563e8514edb03f527dda0765c3f42005f9ec6bbadc0c4a7b409963
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9afaf4b62f456ea46ec9363ff0e1982a6a9b49149f83084a9e56ac68d9298501ec14ba676259a566e9aba9e892459be932c2fce64855e82de5b637efb5c325a3
|
7
|
+
data.tar.gz: 66876b0be9337a67ecafe82eddc834a351405b991dea4651e2d786f64af30ed24ee05ae8780327a76a44b10c7da3ede921ba546fb75b1d9cd9d0de1f33ccbc4e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## Rails 5.2.0.rc1 (January 30, 2018) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
1
6
|
## Rails 5.2.0.beta2 (November 28, 2017) ##
|
2
7
|
|
3
8
|
* No changes.
|
@@ -57,7 +62,7 @@
|
|
57
62
|
|
58
63
|
*bogdanvlviv*
|
59
64
|
|
60
|
-
* Deprecate support
|
65
|
+
* Deprecate support for using a `Rails::Application` subclass to start Rails server.
|
61
66
|
|
62
67
|
*Yuji Yaginuma*
|
63
68
|
|
data/MIT-LICENSE
CHANGED
data/lib/rails/application.rb
CHANGED
@@ -472,7 +472,8 @@ module Rails
|
|
472
472
|
ActiveSupport::EncryptedConfiguration.new(
|
473
473
|
config_path: Rails.root.join(path),
|
474
474
|
key_path: Rails.root.join(key_path),
|
475
|
-
env_key: env_key
|
475
|
+
env_key: env_key,
|
476
|
+
raise_if_missing_key: config.require_master_key
|
476
477
|
)
|
477
478
|
end
|
478
479
|
|
@@ -16,7 +16,8 @@ module Rails
|
|
16
16
|
:ssl_options, :public_file_server,
|
17
17
|
:session_options, :time_zone, :reload_classes_only_on_change,
|
18
18
|
:beginning_of_week, :filter_redirect, :x, :enable_dependency_loading,
|
19
|
-
:read_encrypted_secrets, :log_level, :content_security_policy_report_only
|
19
|
+
:read_encrypted_secrets, :log_level, :content_security_policy_report_only,
|
20
|
+
:require_master_key
|
20
21
|
|
21
22
|
attr_reader :encoding, :api_only
|
22
23
|
|
@@ -56,6 +57,7 @@ module Rails
|
|
56
57
|
@read_encrypted_secrets = false
|
57
58
|
@content_security_policy = nil
|
58
59
|
@content_security_policy_report_only = false
|
60
|
+
@require_master_key = false
|
59
61
|
end
|
60
62
|
|
61
63
|
def load_defaults(target_version)
|
@@ -100,6 +102,7 @@ module Rails
|
|
100
102
|
|
101
103
|
if respond_to?(:active_support)
|
102
104
|
active_support.use_authenticated_message_encryption = true
|
105
|
+
active_support.use_sha1_digests = true
|
103
106
|
end
|
104
107
|
|
105
108
|
if respond_to?(:action_controller)
|
@@ -58,7 +58,7 @@ module Rails
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# This needs to happen before eager load so it happens
|
61
|
-
# in exactly the same point regardless of config.
|
61
|
+
# in exactly the same point regardless of config.eager_load
|
62
62
|
initializer :run_prepare_callbacks do |app|
|
63
63
|
app.reloader.prepare!
|
64
64
|
end
|
@@ -33,8 +33,7 @@ module Rails
|
|
33
33
|
def show
|
34
34
|
require_application_and_environment!
|
35
35
|
|
36
|
-
say Rails.application.credentials.read.presence ||
|
37
|
-
"No credentials have been added yet. Use bin/rails credentials:edit to change that."
|
36
|
+
say Rails.application.credentials.read.presence || missing_credentials_message
|
38
37
|
end
|
39
38
|
|
40
39
|
private
|
@@ -67,6 +66,14 @@ module Rails
|
|
67
66
|
|
68
67
|
Rails::Generators::CredentialsGenerator.new
|
69
68
|
end
|
69
|
+
|
70
|
+
def missing_credentials_message
|
71
|
+
if Rails.application.credentials.key.nil?
|
72
|
+
"Missing master key to decrypt credentials. See bin/rails credentials:help"
|
73
|
+
else
|
74
|
+
"No credentials have been added yet. Use bin/rails credentials:edit to change that."
|
75
|
+
end
|
76
|
+
end
|
70
77
|
end
|
71
78
|
end
|
72
79
|
end
|
@@ -37,9 +37,9 @@ module Rails
|
|
37
37
|
|
38
38
|
def show(file_path)
|
39
39
|
require_application_and_environment!
|
40
|
+
encrypted = Rails.application.encrypted(file_path, key_path: options[:key])
|
40
41
|
|
41
|
-
say
|
42
|
-
"File '#{file_path}' does not exist. Use bin/rails encrypted:edit #{file_path} to change that."
|
42
|
+
say encrypted.read.presence || missing_encrypted_message(key: encrypted.key, key_path: options[:key], file_path: file_path)
|
43
43
|
end
|
44
44
|
|
45
45
|
private
|
@@ -72,6 +72,14 @@ module Rails
|
|
72
72
|
|
73
73
|
Rails::Generators::EncryptedFileGenerator.new
|
74
74
|
end
|
75
|
+
|
76
|
+
def missing_encrypted_message(key:, key_path:, file_path:)
|
77
|
+
if key.nil?
|
78
|
+
"Missing '#{key_path}' to decrypt data. See bin/rails encrypted:help"
|
79
|
+
else
|
80
|
+
"File '#{file_path}' does not exist. Use bin/rails encrypted:edit #{file_path} to change that."
|
81
|
+
end
|
82
|
+
end
|
75
83
|
end
|
76
84
|
end
|
77
85
|
end
|
@@ -27,7 +27,7 @@ module Rails
|
|
27
27
|
app = super
|
28
28
|
if app.is_a?(Class)
|
29
29
|
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
30
|
-
|
30
|
+
Using `Rails::Application` subclass to start the server is deprecated and will be removed in Rails 6.0.
|
31
31
|
Please change `run #{app}` to `run Rails.application` in config.ru.
|
32
32
|
MSG
|
33
33
|
end
|
data/lib/rails/gem_version.rb
CHANGED
@@ -84,6 +84,9 @@ module Rails
|
|
84
84
|
class_option :skip_system_test, type: :boolean, default: false,
|
85
85
|
desc: "Skip system test files"
|
86
86
|
|
87
|
+
class_option :skip_bootsnap, type: :boolean, default: false,
|
88
|
+
desc: "Skip bootsnap gem"
|
89
|
+
|
87
90
|
class_option :dev, type: :boolean, default: false,
|
88
91
|
desc: "Setup the #{name} with Gemfile pointing to your Rails checkout"
|
89
92
|
|
@@ -297,8 +300,8 @@ module Rails
|
|
297
300
|
def gem_for_database
|
298
301
|
# %w( mysql postgresql sqlite3 oracle frontbase ibm_db sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql )
|
299
302
|
case options[:database]
|
300
|
-
when "mysql" then ["mysql2", ["
|
301
|
-
when "postgresql" then ["pg", ["
|
303
|
+
when "mysql" then ["mysql2", ["~> 0.4.4"]]
|
304
|
+
when "postgresql" then ["pg", [">= 0.18", "< 2.0"]]
|
302
305
|
when "oracle" then ["activerecord-oracle_enhanced-adapter", nil]
|
303
306
|
when "frontbase" then ["ruby-frontbase", nil]
|
304
307
|
when "sqlserver" then ["activerecord-sqlserver-adapter", nil]
|
@@ -312,11 +315,13 @@ module Rails
|
|
312
315
|
|
313
316
|
def convert_database_option_for_jruby
|
314
317
|
if defined?(JRUBY_VERSION)
|
315
|
-
|
316
|
-
|
317
|
-
when "
|
318
|
-
when "
|
318
|
+
opt = options.dup
|
319
|
+
case opt[:database]
|
320
|
+
when "postgresql" then opt[:database] = "jdbcpostgresql"
|
321
|
+
when "mysql" then opt[:database] = "jdbcmysql"
|
322
|
+
when "sqlite3" then opt[:database] = "jdbcsqlite3"
|
319
323
|
end
|
324
|
+
self.options = opt.freeze
|
320
325
|
end
|
321
326
|
end
|
322
327
|
|
@@ -435,6 +440,10 @@ module Rails
|
|
435
440
|
!options[:skip_listen] && os_supports_listen_out_of_the_box?
|
436
441
|
end
|
437
442
|
|
443
|
+
def depend_on_bootsnap?
|
444
|
+
!options[:skip_bootsnap] && !options[:dev]
|
445
|
+
end
|
446
|
+
|
438
447
|
def os_supports_listen_out_of_the_box?
|
439
448
|
RbConfig::CONFIG["host_os"] =~ /darwin|linux/
|
440
449
|
end
|
@@ -456,16 +465,6 @@ module Rails
|
|
456
465
|
end
|
457
466
|
end
|
458
467
|
|
459
|
-
def run_active_storage
|
460
|
-
unless skip_active_storage?
|
461
|
-
if bundle_install?
|
462
|
-
rails_command "active_storage:install", capture: options[:quiet]
|
463
|
-
else
|
464
|
-
log("Active Storage installation was skipped. Please run `bin/rails active_storage:install` to install Active Storage files.")
|
465
|
-
end
|
466
|
-
end
|
467
|
-
end
|
468
|
-
|
469
468
|
def empty_directory_with_keep_file(destination, config = {})
|
470
469
|
empty_directory(destination, config)
|
471
470
|
keep_file(destination)
|
@@ -75,7 +75,7 @@ module Rails
|
|
75
75
|
when :date then :date_select
|
76
76
|
when :text then :text_area
|
77
77
|
when :boolean then :check_box
|
78
|
-
|
78
|
+
else
|
79
79
|
:text_field
|
80
80
|
end
|
81
81
|
end
|
@@ -91,7 +91,7 @@ module Rails
|
|
91
91
|
when :text then "MyText"
|
92
92
|
when :boolean then false
|
93
93
|
when :references, :belongs_to then nil
|
94
|
-
|
94
|
+
else
|
95
95
|
""
|
96
96
|
end
|
97
97
|
end
|
@@ -348,6 +348,14 @@ module Rails
|
|
348
348
|
build(:public_directory)
|
349
349
|
end
|
350
350
|
|
351
|
+
def create_tmp_files
|
352
|
+
build(:tmp)
|
353
|
+
end
|
354
|
+
|
355
|
+
def create_vendor_files
|
356
|
+
build(:vendor)
|
357
|
+
end
|
358
|
+
|
351
359
|
def create_test_files
|
352
360
|
build(:test) unless options[:skip_test]
|
353
361
|
end
|
@@ -360,14 +368,6 @@ module Rails
|
|
360
368
|
build(:storage) unless skip_active_storage?
|
361
369
|
end
|
362
370
|
|
363
|
-
def create_tmp_files
|
364
|
-
build(:tmp)
|
365
|
-
end
|
366
|
-
|
367
|
-
def create_vendor_files
|
368
|
-
build(:vendor)
|
369
|
-
end
|
370
|
-
|
371
371
|
def delete_app_assets_if_api_option
|
372
372
|
if options[:api]
|
373
373
|
remove_dir "app/assets"
|
@@ -463,7 +463,6 @@ module Rails
|
|
463
463
|
|
464
464
|
public_task :apply_rails_template, :run_bundle
|
465
465
|
public_task :run_webpack, :generate_spring_binstubs
|
466
|
-
public_task :run_active_storage
|
467
466
|
|
468
467
|
def run_after_bundle_callbacks
|
469
468
|
@after_bundle_callbacks.each(&:call)
|
@@ -29,9 +29,11 @@ ruby <%= "'#{RUBY_VERSION}'" -%>
|
|
29
29
|
# Use Capistrano for deployment
|
30
30
|
# gem 'capistrano-rails', group: :development
|
31
31
|
|
32
|
+
<% if depend_on_bootsnap? -%>
|
32
33
|
# Reduces boot times through caching; required in config/boot.rb
|
33
34
|
gem 'bootsnap', '>= 1.1.0', require: false
|
34
35
|
|
36
|
+
<%- end -%>
|
35
37
|
<%- if options.api? -%>
|
36
38
|
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
|
37
39
|
# gem 'rack-cors'
|
@@ -41,13 +43,6 @@ gem 'bootsnap', '>= 1.1.0', require: false
|
|
41
43
|
group :development, :test do
|
42
44
|
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
43
45
|
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
44
|
-
<%- if depends_on_system_test? -%>
|
45
|
-
# Adds support for Capybara system testing and selenium driver
|
46
|
-
gem 'capybara', '~> 2.15'
|
47
|
-
gem 'selenium-webdriver'
|
48
|
-
# Easy installation and use of chromedriver to run system tests with Chrome
|
49
|
-
gem 'chromedriver-helper'
|
50
|
-
<%- end -%>
|
51
46
|
end
|
52
47
|
|
53
48
|
group :development do
|
@@ -70,6 +65,16 @@ group :development do
|
|
70
65
|
<% end -%>
|
71
66
|
<% end -%>
|
72
67
|
end
|
68
|
+
|
69
|
+
<%- if depends_on_system_test? -%>
|
70
|
+
group :test do
|
71
|
+
# Adds support for Capybara system testing and selenium driver
|
72
|
+
gem 'capybara', '~> 2.15'
|
73
|
+
gem 'selenium-webdriver'
|
74
|
+
# Easy installation and use of chromedriver to run system tests with Chrome
|
75
|
+
gem 'chromedriver-helper'
|
76
|
+
end
|
77
|
+
<%- end -%>
|
73
78
|
<% end -%>
|
74
79
|
|
75
80
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
@@ -1,7 +1,7 @@
|
|
1
1
|
APP_ROOT = File.expand_path('..', __dir__)
|
2
2
|
Dir.chdir(APP_ROOT) do
|
3
3
|
begin
|
4
|
-
exec "yarnpkg
|
4
|
+
exec "yarnpkg", *ARGV
|
5
5
|
rescue Errno::ENOENT
|
6
6
|
$stderr.puts "Yarn executable was not detected in the system."
|
7
7
|
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
@@ -27,8 +27,9 @@ module <%= app_const_base %>
|
|
27
27
|
config.load_defaults <%= Rails::VERSION::STRING.to_f %>
|
28
28
|
|
29
29
|
# Settings in config/environments/* take precedence over those specified here.
|
30
|
-
# Application configuration
|
31
|
-
# -- all .rb files in that directory are automatically loaded
|
30
|
+
# Application configuration can go into files in config/initializers
|
31
|
+
# -- all .rb files in that directory are automatically loaded after loading
|
32
|
+
# the framework and any gems in your application.
|
32
33
|
<%- if options.api? -%>
|
33
34
|
|
34
35
|
# Only loads a smaller set of middleware suitable for API only apps.
|
@@ -14,7 +14,7 @@ Rails.application.configure do
|
|
14
14
|
|
15
15
|
# Enable/disable caching. By default caching is disabled.
|
16
16
|
# Run rails dev:cache to toggle caching.
|
17
|
-
if Rails.root.join('tmp
|
17
|
+
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
18
18
|
config.action_controller.perform_caching = true
|
19
19
|
|
20
20
|
config.cache_store = :memory_store
|
@@ -46,6 +46,9 @@ Rails.application.configure do
|
|
46
46
|
# Raise an error on page load if there are pending migrations.
|
47
47
|
config.active_record.migration_error = :page_load
|
48
48
|
|
49
|
+
# Highlight code that triggered database queries in logs.
|
50
|
+
config.active_record.verbose_query_logs = true
|
51
|
+
|
49
52
|
<%- end -%>
|
50
53
|
<%- unless options.skip_sprockets? -%>
|
51
54
|
# Debug mode disables concatenation and preprocessing of assets.
|
data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt
CHANGED
@@ -1,18 +1,20 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
1
3
|
# Define an application-wide content security policy
|
2
4
|
# For further information see the following documentation
|
3
5
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
4
6
|
|
5
|
-
Rails.application.config.content_security_policy do |
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
# Rails.application.config.content_security_policy do |policy|
|
8
|
+
# policy.default_src :self, :https
|
9
|
+
# policy.font_src :self, :https, :data
|
10
|
+
# policy.img_src :self, :https, :data
|
11
|
+
# policy.object_src :none
|
12
|
+
# policy.script_src :self, :https
|
13
|
+
# policy.style_src :self, :https, :unsafe_inline
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
end
|
15
|
+
# # Specify URI for violation reports
|
16
|
+
# # policy.report_uri "/csp-violation-report-endpoint"
|
17
|
+
# end
|
16
18
|
|
17
19
|
# Report CSP violations to a specified URI
|
18
20
|
# For further information see the following documentation:
|
data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_2.rb.tt
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
# This is needed for recyclable cache keys.
|
11
11
|
# Rails.application.config.active_record.cache_versioning = true
|
12
12
|
|
13
|
-
# Use AES
|
13
|
+
# Use AES-256-GCM authenticated encryption for encrypted cookies.
|
14
14
|
# Existing cookies will be converted on read then written with the new scheme.
|
15
15
|
# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true
|
16
16
|
|
@@ -25,3 +25,6 @@
|
|
25
25
|
# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and
|
26
26
|
# 'f' after migrating old data.
|
27
27
|
# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
|
28
|
+
|
29
|
+
# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header.
|
30
|
+
# Rails.application.config.active_support.use_sha1_digests = true
|
@@ -26,31 +26,9 @@ environment ENV.fetch("RAILS_ENV") { "development" }
|
|
26
26
|
# Use the `preload_app!` method when specifying a `workers` number.
|
27
27
|
# This directive tells Puma to first boot the application and load code
|
28
28
|
# before forking the application. This takes advantage of Copy On Write
|
29
|
-
# process behavior so workers use less memory.
|
30
|
-
# you need to make sure to reconnect any threads in the `on_worker_boot`
|
31
|
-
# block.
|
29
|
+
# process behavior so workers use less memory.
|
32
30
|
#
|
33
31
|
# preload_app!
|
34
32
|
|
35
|
-
# If you are preloading your application and using Active Record, it's
|
36
|
-
# recommended that you close any connections to the database before workers
|
37
|
-
# are forked to prevent connection leakage.
|
38
|
-
#
|
39
|
-
# before_fork do
|
40
|
-
# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
|
41
|
-
# end
|
42
|
-
|
43
|
-
# The code in the `on_worker_boot` will be called if you are using
|
44
|
-
# clustered mode by specifying a number of `workers`. After each worker
|
45
|
-
# process is booted, this block will be run. If you are using the `preload_app!`
|
46
|
-
# option, you will want to use this block to reconnect to any threads
|
47
|
-
# or connections that may have been created at application boot, as Ruby
|
48
|
-
# cannot share connections between processes.
|
49
|
-
#
|
50
|
-
# on_worker_boot do
|
51
|
-
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
52
|
-
# end
|
53
|
-
#
|
54
|
-
|
55
33
|
# Allow puma to be restarted by `rails restart` command.
|
56
34
|
plugin :tmp_restart
|
@@ -18,7 +18,7 @@ local:
|
|
18
18
|
# google:
|
19
19
|
# service: GCS
|
20
20
|
# project: your_project
|
21
|
-
#
|
21
|
+
# credentials: <%%= Rails.root.join("path/to/gcs.keyfile") %>
|
22
22
|
# bucket: your_own_bucket
|
23
23
|
|
24
24
|
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
@@ -8,7 +8,7 @@ module Rails
|
|
8
8
|
module Generators
|
9
9
|
class CredentialsGenerator < Base
|
10
10
|
def add_credentials_file
|
11
|
-
unless credentials.exist?
|
11
|
+
unless credentials.content_path.exist?
|
12
12
|
template = credentials_template
|
13
13
|
|
14
14
|
say "Adding #{credentials.content_path} to store encrypted credentials."
|
@@ -26,7 +26,9 @@ module Rails
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def add_credentials_file_silently(template = nil)
|
29
|
-
credentials.
|
29
|
+
unless credentials.content_path.exist?
|
30
|
+
credentials.write(credentials_template)
|
31
|
+
end
|
30
32
|
end
|
31
33
|
|
32
34
|
private
|
@@ -34,7 +36,8 @@ module Rails
|
|
34
36
|
ActiveSupport::EncryptedConfiguration.new(
|
35
37
|
config_path: "config/credentials.yml.enc",
|
36
38
|
key_path: "config/master.key",
|
37
|
-
env_key: "RAILS_MASTER_KEY"
|
39
|
+
env_key: "RAILS_MASTER_KEY",
|
40
|
+
raise_if_missing_key: true
|
38
41
|
)
|
39
42
|
end
|
40
43
|
|
@@ -24,7 +24,7 @@ module Rails
|
|
24
24
|
|
25
25
|
def add_encrypted_file_silently(file_path, key_path, template = encrypted_file_template)
|
26
26
|
unless File.exist?(file_path)
|
27
|
-
setup = { content_path: file_path, key_path: key_path, env_key: "RAILS_MASTER_KEY" }
|
27
|
+
setup = { content_path: file_path, key_path: key_path, env_key: "RAILS_MASTER_KEY", raise_if_missing_key: true }
|
28
28
|
ActiveSupport::EncryptedFile.new(setup).write(template)
|
29
29
|
end
|
30
30
|
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
1
4
|
require_relative "<%= File.join('..', options[:dummy_path], 'config/environment') -%>"
|
2
5
|
<% unless options[:skip_active_record] -%>
|
3
6
|
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../<%= options[:dummy_path] -%>/db/migrate", __dir__)]
|
@@ -23,7 +23,7 @@ module TestUnit # :nodoc:
|
|
23
23
|
template template_file,
|
24
24
|
File.join("test/controllers", controller_class_path, "#{controller_file_name}_controller_test.rb")
|
25
25
|
|
26
|
-
|
26
|
+
if !options.api? && options[:system_tests]
|
27
27
|
template "system_test.rb", File.join("test/system", class_path, "#{file_name.pluralize}_test.rb")
|
28
28
|
end
|
29
29
|
end
|
data/lib/rails/info.rb
CHANGED
@@ -6,9 +6,9 @@ class Rails::MailersController < Rails::ApplicationController # :nodoc:
|
|
6
6
|
prepend_view_path ActionDispatch::DebugExceptions::RESCUES_TEMPLATE_PATH
|
7
7
|
|
8
8
|
before_action :require_local!, unless: :show_previews?
|
9
|
-
before_action :find_preview, only: :preview
|
9
|
+
before_action :find_preview, :set_locale, only: :preview
|
10
10
|
|
11
|
-
helper_method :part_query
|
11
|
+
helper_method :part_query, :locale_query
|
12
12
|
|
13
13
|
def index
|
14
14
|
@previews = ActionMailer::Preview.all
|
@@ -84,4 +84,12 @@ class Rails::MailersController < Rails::ApplicationController # :nodoc:
|
|
84
84
|
def part_query(mime_type)
|
85
85
|
request.query_parameters.merge(part: mime_type).to_query
|
86
86
|
end
|
87
|
+
|
88
|
+
def locale_query(locale)
|
89
|
+
request.query_parameters.merge(locale: locale).to_query
|
90
|
+
end
|
91
|
+
|
92
|
+
def set_locale
|
93
|
+
I18n.locale = params[:locale] || I18n.default_locale
|
94
|
+
end
|
87
95
|
end
|
@@ -55,7 +55,7 @@ module Rails
|
|
55
55
|
ActiveSupport.on_load(:before_configuration, yield: true, &block)
|
56
56
|
end
|
57
57
|
|
58
|
-
# Third configurable block to run. Does not run if +config.
|
58
|
+
# Third configurable block to run. Does not run if +config.eager_load+
|
59
59
|
# set to false.
|
60
60
|
def before_eager_load(&block)
|
61
61
|
ActiveSupport.on_load(:before_eager_load, yield: true, &block)
|
@@ -95,11 +95,25 @@
|
|
95
95
|
</dd>
|
96
96
|
<% end %>
|
97
97
|
|
98
|
+
<dt>Format:</dt>
|
98
99
|
<% if @email.multipart? %>
|
99
100
|
<dd>
|
100
|
-
<select onchange="
|
101
|
-
<option <%= request.format == Mime[:html] ? 'selected' : '' %> value="
|
102
|
-
<option <%= request.format == Mime[:text] ? 'selected' : '' %> value="
|
101
|
+
<select id="part" onchange="refreshBody();">
|
102
|
+
<option <%= request.format == Mime[:html] ? 'selected' : '' %> value="<%= part_query('text/html') %>">View as HTML email</option>
|
103
|
+
<option <%= request.format == Mime[:text] ? 'selected' : '' %> value="<%= part_query('text/plain') %>">View as plain-text email</option>
|
104
|
+
</select>
|
105
|
+
</dd>
|
106
|
+
<% else %>
|
107
|
+
<dd id="mime_type" data-mime-type="<%= part_query(@email.mime_type) %>"><%= @email.mime_type == 'text/html' ? 'HTML email' : 'plain-text email' %></dd>
|
108
|
+
<% end %>
|
109
|
+
|
110
|
+
<% if I18n.available_locales.count > 1 %>
|
111
|
+
<dt>Locale:</dt>
|
112
|
+
<dd>
|
113
|
+
<select id="locale" onchange="refreshBody();">
|
114
|
+
<% I18n.available_locales.each do |locale| %>
|
115
|
+
<option <%= I18n.locale == locale ? 'selected' : '' %> value="<%= locale_query(locale) %>"><%= locale %></option>
|
116
|
+
<% end %>
|
103
117
|
</select>
|
104
118
|
</dd>
|
105
119
|
<% end %>
|
@@ -116,15 +130,27 @@
|
|
116
130
|
<% end %>
|
117
131
|
|
118
132
|
<script>
|
119
|
-
function
|
120
|
-
var
|
121
|
-
var
|
122
|
-
iframe.
|
133
|
+
function refreshBody() {
|
134
|
+
var part_select = document.querySelector('select#part');
|
135
|
+
var locale_select = document.querySelector('select#locale');
|
136
|
+
var iframe = document.getElementsByName('messageBody')[0];
|
137
|
+
var part_param = part_select ?
|
138
|
+
part_select.options[part_select.selectedIndex].value :
|
139
|
+
document.querySelector('#mime_type').dataset.mimeType;
|
140
|
+
var locale_param = locale_select ? locale_select.options[locale_select.selectedIndex].value : null;
|
141
|
+
var fresh_location;
|
142
|
+
if (locale_param) {
|
143
|
+
fresh_location = '?' + part_param + '&' + locale_param;
|
144
|
+
} else {
|
145
|
+
fresh_location = '?' + part_param;
|
146
|
+
}
|
147
|
+
iframe.contentWindow.location = fresh_location;
|
123
148
|
|
124
149
|
if (history.replaceState) {
|
125
|
-
var url
|
126
|
-
var format = /html/.test(
|
127
|
-
|
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);
|
153
|
+
window.history.replaceState({}, '', state_to_replace);
|
128
154
|
}
|
129
155
|
}
|
130
156
|
</script>
|
data/lib/rails/test_help.rb
CHANGED
@@ -29,10 +29,6 @@ if defined?(ActiveRecord::Base)
|
|
29
29
|
end
|
30
30
|
|
31
31
|
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
32
|
-
|
33
|
-
def create_fixtures(*fixture_set_names, &block)
|
34
|
-
FixtureSet.create_fixtures(ActiveSupport::TestCase.fixture_path, fixture_set_names, {}, &block)
|
35
|
-
end
|
36
32
|
end
|
37
33
|
|
38
34
|
# :enddoc:
|
@@ -64,11 +64,17 @@ module Rails
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def format_line(result)
|
67
|
-
|
67
|
+
klass = result.respond_to?(:klass) ? result.klass : result.class
|
68
|
+
"%s#%s = %.2f s = %s" % [klass, result.name, result.time, result.result_code]
|
68
69
|
end
|
69
70
|
|
70
71
|
def format_rerun_snippet(result)
|
71
|
-
location, line = result.
|
72
|
+
location, line = if result.respond_to?(:source_location)
|
73
|
+
result.source_location
|
74
|
+
else
|
75
|
+
result.method(result.name).source_location
|
76
|
+
end
|
77
|
+
|
72
78
|
"#{executable} #{relative_path_for(location)}:#{line}"
|
73
79
|
end
|
74
80
|
|
@@ -13,7 +13,7 @@ module Rails
|
|
13
13
|
class << self
|
14
14
|
def attach_before_load_options(opts)
|
15
15
|
opts.on("--warnings", "-w", "Run with Ruby warnings enabled") {}
|
16
|
-
opts.on("
|
16
|
+
opts.on("-e", "--environment ENV", "Run tests in the ENV environment") {}
|
17
17
|
end
|
18
18
|
|
19
19
|
def parse_options(argv)
|
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.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:
|
11
|
+
date: 2018-01-30 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.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: 5.2.0.
|
26
|
+
version: 5.2.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: 5.2.0.
|
33
|
+
version: 5.2.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: 5.2.0.
|
40
|
+
version: 5.2.0.rc1
|
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.0.
|
95
|
+
version: 5.2.0.rc1
|
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.0.rc1
|
103
103
|
description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
|
104
104
|
email: david@loudthinking.com
|
105
105
|
executables:
|
@@ -421,8 +421,8 @@ homepage: http://rubyonrails.org
|
|
421
421
|
licenses:
|
422
422
|
- MIT
|
423
423
|
metadata:
|
424
|
-
source_code_uri: https://github.com/rails/rails/tree/v5.2.0.
|
425
|
-
changelog_uri: https://github.com/rails/rails/blob/v5.2.0.
|
424
|
+
source_code_uri: https://github.com/rails/rails/tree/v5.2.0.rc1/railties
|
425
|
+
changelog_uri: https://github.com/rails/rails/blob/v5.2.0.rc1/railties/CHANGELOG.md
|
426
426
|
post_install_message:
|
427
427
|
rdoc_options:
|
428
428
|
- "--exclude"
|
@@ -441,7 +441,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
441
441
|
version: 1.3.1
|
442
442
|
requirements: []
|
443
443
|
rubyforge_project:
|
444
|
-
rubygems_version: 2.
|
444
|
+
rubygems_version: 2.7.3
|
445
445
|
signing_key:
|
446
446
|
specification_version: 4
|
447
447
|
summary: Tools for creating, working with, and running Rails applications.
|