railties 5.2.0.rc1 → 5.2.0.rc2
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 +4 -4
- data/CHANGELOG.md +11 -0
- data/README.rdoc +1 -1
- data/lib/minitest/rails_plugin.rb +12 -3
- data/lib/rails/app_updater.rb +1 -1
- data/lib/rails/application.rb +2 -1
- data/lib/rails/application/configuration.rb +46 -38
- data/lib/rails/application/default_middleware_stack.rb +2 -1
- data/lib/rails/application_controller.rb +11 -0
- data/lib/rails/commands/credentials/credentials_command.rb +1 -1
- data/lib/rails/commands/encrypted/encrypted_command.rb +2 -1
- data/lib/rails/gem_version.rb +1 -1
- data/lib/rails/generators.rb +3 -0
- data/lib/rails/generators/app_base.rb +1 -1
- data/lib/rails/generators/migration.rb +6 -1
- data/lib/rails/generators/rails/app/app_generator.rb +14 -4
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +1 -0
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +4 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_2.rb.tt +5 -0
- data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +0 -1
- data/lib/rails/generators/rails/controller/controller_generator.rb +1 -0
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +10 -4
- data/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb +8 -18
- data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -1
- data/lib/rails/generators/rails/master_key/master_key_generator.rb +4 -2
- data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +5 -1
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/rails/javascripts.js.tt +1 -0
- metadata +11 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 44e4c3f1c366f4f50752adfed105de5f3a7898fb23c918f3075cdcd8669ca884
|
|
4
|
+
data.tar.gz: 41bb653c78ecbbbf6ac3da439856247886048498ef765ceba501670ab53f0b3a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a68429a879f4aa51fe3fbbb962bd2914a2ed40f0f23e083a07f2caaf9aa4f257a182b716d44809121ed0b524154b0386b05c4be46b0ae8a46372f68b58d0c286
|
|
7
|
+
data.tar.gz: 57dba9542934177aa400a3511f7ff6b83f250bba9f6973646e92a51d7066abb2106139efe7b0d22bc23469cbdb65e530f7fccc051303aa030d70a0f0a84864c4
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## Rails 5.2.0.rc2 (March 20, 2018) ##
|
|
2
|
+
|
|
3
|
+
* Fix minitest rails plugin.
|
|
4
|
+
|
|
5
|
+
The custom reporters are added only if needed.
|
|
6
|
+
|
|
7
|
+
This will fix conflicts with others plugins.
|
|
8
|
+
|
|
9
|
+
*Kevin Robatel*
|
|
10
|
+
|
|
11
|
+
|
|
1
12
|
## Rails 5.2.0.rc1 (January 30, 2018) ##
|
|
2
13
|
|
|
3
14
|
* No changes.
|
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/
|
|
20
|
+
* https://github.com/rails/rails/tree/5-2-stable/railties
|
|
21
21
|
|
|
22
22
|
== License
|
|
23
23
|
|
|
@@ -43,10 +43,19 @@ module Minitest
|
|
|
43
43
|
Minitest.backtrace_filter = ::Rails.backtrace_cleaner if ::Rails.respond_to?(:backtrace_cleaner)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
self.plugin_rails_replace_reporters(reporter, options)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def self.plugin_rails_replace_reporters(minitest_reporter, options)
|
|
50
|
+
return unless minitest_reporter.kind_of?(Minitest::CompositeReporter)
|
|
51
|
+
|
|
46
52
|
# Replace progress reporter for colors.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
if minitest_reporter.reporters.reject! { |reporter| reporter.kind_of?(SummaryReporter) } != nil
|
|
54
|
+
minitest_reporter << SuppressedSummaryReporter.new(options[:io], options)
|
|
55
|
+
end
|
|
56
|
+
if minitest_reporter.reporters.reject! { |reporter| reporter.kind_of?(ProgressReporter) } != nil
|
|
57
|
+
minitest_reporter << ::Rails::TestUnitReporter.new(options[:io], options)
|
|
58
|
+
end
|
|
50
59
|
end
|
|
51
60
|
|
|
52
61
|
# Backwardscompatibility with Rails 5.0 generated plugin test scripts
|
data/lib/rails/app_updater.rb
CHANGED
|
@@ -22,7 +22,7 @@ module Rails
|
|
|
22
22
|
def generator_options
|
|
23
23
|
options = { api: !!Rails.application.config.api_only, update: true }
|
|
24
24
|
options[:skip_active_record] = !defined?(ActiveRecord::Railtie)
|
|
25
|
-
options[:skip_active_storage] = !defined?(
|
|
25
|
+
options[:skip_active_storage] = !defined?(ActiveRecord::Railtie)
|
|
26
26
|
options[:skip_action_mailer] = !defined?(ActionMailer::Railtie)
|
|
27
27
|
options[:skip_action_cable] = !defined?(ActionCable::Engine)
|
|
28
28
|
options[:skip_sprockets] = !defined?(Sprockets::Railtie)
|
data/lib/rails/application.rb
CHANGED
|
@@ -268,7 +268,8 @@ module Rails
|
|
|
268
268
|
"action_dispatch.cookies_digest" => config.action_dispatch.cookies_digest,
|
|
269
269
|
"action_dispatch.cookies_rotations" => config.action_dispatch.cookies_rotations,
|
|
270
270
|
"action_dispatch.content_security_policy" => config.content_security_policy,
|
|
271
|
-
"action_dispatch.content_security_policy_report_only" => config.content_security_policy_report_only
|
|
271
|
+
"action_dispatch.content_security_policy_report_only" => config.content_security_policy_report_only,
|
|
272
|
+
"action_dispatch.content_security_policy_nonce_generator" => config.content_security_policy_nonce_generator
|
|
272
273
|
)
|
|
273
274
|
end
|
|
274
275
|
end
|
|
@@ -17,47 +17,49 @@ module Rails
|
|
|
17
17
|
:session_options, :time_zone, :reload_classes_only_on_change,
|
|
18
18
|
:beginning_of_week, :filter_redirect, :x, :enable_dependency_loading,
|
|
19
19
|
:read_encrypted_secrets, :log_level, :content_security_policy_report_only,
|
|
20
|
-
:require_master_key
|
|
20
|
+
:content_security_policy_nonce_generator, :require_master_key
|
|
21
21
|
|
|
22
|
-
attr_reader :encoding, :api_only
|
|
22
|
+
attr_reader :encoding, :api_only, :loaded_config_version
|
|
23
23
|
|
|
24
24
|
def initialize(*)
|
|
25
25
|
super
|
|
26
|
-
self.encoding
|
|
27
|
-
@allow_concurrency
|
|
28
|
-
@consider_all_requests_local
|
|
29
|
-
@filter_parameters
|
|
30
|
-
@filter_redirect
|
|
31
|
-
@helpers_paths
|
|
32
|
-
@public_file_server
|
|
33
|
-
@public_file_server.enabled
|
|
34
|
-
@public_file_server.index_name
|
|
35
|
-
@force_ssl
|
|
36
|
-
@ssl_options
|
|
37
|
-
@session_store
|
|
38
|
-
@time_zone
|
|
39
|
-
@beginning_of_week
|
|
40
|
-
@log_level
|
|
41
|
-
@generators
|
|
42
|
-
@cache_store
|
|
43
|
-
@railties_order
|
|
44
|
-
@relative_url_root
|
|
45
|
-
@reload_classes_only_on_change
|
|
46
|
-
@file_watcher
|
|
47
|
-
@exceptions_app
|
|
48
|
-
@autoflush_log
|
|
49
|
-
@log_formatter
|
|
50
|
-
@eager_load
|
|
51
|
-
@secret_token
|
|
52
|
-
@secret_key_base
|
|
53
|
-
@api_only
|
|
54
|
-
@debug_exception_response_format
|
|
55
|
-
@x
|
|
56
|
-
@enable_dependency_loading
|
|
57
|
-
@read_encrypted_secrets
|
|
58
|
-
@content_security_policy
|
|
59
|
-
@content_security_policy_report_only
|
|
60
|
-
@
|
|
26
|
+
self.encoding = Encoding::UTF_8
|
|
27
|
+
@allow_concurrency = nil
|
|
28
|
+
@consider_all_requests_local = false
|
|
29
|
+
@filter_parameters = []
|
|
30
|
+
@filter_redirect = []
|
|
31
|
+
@helpers_paths = []
|
|
32
|
+
@public_file_server = ActiveSupport::OrderedOptions.new
|
|
33
|
+
@public_file_server.enabled = true
|
|
34
|
+
@public_file_server.index_name = "index"
|
|
35
|
+
@force_ssl = false
|
|
36
|
+
@ssl_options = {}
|
|
37
|
+
@session_store = nil
|
|
38
|
+
@time_zone = "UTC"
|
|
39
|
+
@beginning_of_week = :monday
|
|
40
|
+
@log_level = :debug
|
|
41
|
+
@generators = app_generators
|
|
42
|
+
@cache_store = [ :file_store, "#{root}/tmp/cache/" ]
|
|
43
|
+
@railties_order = [:all]
|
|
44
|
+
@relative_url_root = ENV["RAILS_RELATIVE_URL_ROOT"]
|
|
45
|
+
@reload_classes_only_on_change = true
|
|
46
|
+
@file_watcher = ActiveSupport::FileUpdateChecker
|
|
47
|
+
@exceptions_app = nil
|
|
48
|
+
@autoflush_log = true
|
|
49
|
+
@log_formatter = ActiveSupport::Logger::SimpleFormatter.new
|
|
50
|
+
@eager_load = nil
|
|
51
|
+
@secret_token = nil
|
|
52
|
+
@secret_key_base = nil
|
|
53
|
+
@api_only = false
|
|
54
|
+
@debug_exception_response_format = nil
|
|
55
|
+
@x = Custom.new
|
|
56
|
+
@enable_dependency_loading = false
|
|
57
|
+
@read_encrypted_secrets = false
|
|
58
|
+
@content_security_policy = nil
|
|
59
|
+
@content_security_policy_report_only = false
|
|
60
|
+
@content_security_policy_nonce_generator = nil
|
|
61
|
+
@require_master_key = false
|
|
62
|
+
@loaded_config_version = nil
|
|
61
63
|
end
|
|
62
64
|
|
|
63
65
|
def load_defaults(target_version)
|
|
@@ -115,6 +117,8 @@ module Rails
|
|
|
115
117
|
else
|
|
116
118
|
raise "Unknown version #{target_version.to_s.inspect}"
|
|
117
119
|
end
|
|
120
|
+
|
|
121
|
+
@loaded_config_version = target_version
|
|
118
122
|
end
|
|
119
123
|
|
|
120
124
|
def encoding=(value)
|
|
@@ -235,7 +239,11 @@ module Rails
|
|
|
235
239
|
end
|
|
236
240
|
|
|
237
241
|
def content_security_policy(&block)
|
|
238
|
-
|
|
242
|
+
if block_given?
|
|
243
|
+
@content_security_policy = ActionDispatch::ContentSecurityPolicy.new(&block)
|
|
244
|
+
else
|
|
245
|
+
@content_security_policy
|
|
246
|
+
end
|
|
239
247
|
end
|
|
240
248
|
|
|
241
249
|
class Custom #:nodoc:
|
|
@@ -4,6 +4,13 @@ class Rails::ApplicationController < ActionController::Base # :nodoc:
|
|
|
4
4
|
self.view_paths = File.expand_path("templates", __dir__)
|
|
5
5
|
layout "application"
|
|
6
6
|
|
|
7
|
+
before_action :disable_content_security_policy_nonce!
|
|
8
|
+
|
|
9
|
+
content_security_policy do |policy|
|
|
10
|
+
policy.script_src :unsafe_inline
|
|
11
|
+
policy.style_src :unsafe_inline
|
|
12
|
+
end
|
|
13
|
+
|
|
7
14
|
private
|
|
8
15
|
|
|
9
16
|
def require_local!
|
|
@@ -15,4 +22,8 @@ class Rails::ApplicationController < ActionController::Base # :nodoc:
|
|
|
15
22
|
def local_request?
|
|
16
23
|
Rails.application.config.consider_all_requests_local || request.local?
|
|
17
24
|
end
|
|
25
|
+
|
|
26
|
+
def disable_content_security_policy_nonce!
|
|
27
|
+
request.content_security_policy_nonce_generator = nil
|
|
28
|
+
end
|
|
18
29
|
end
|
|
@@ -20,7 +20,7 @@ module Rails
|
|
|
20
20
|
require_application_and_environment!
|
|
21
21
|
|
|
22
22
|
ensure_editor_available(command: "bin/rails credentials:edit") || (return)
|
|
23
|
-
ensure_master_key_has_been_added
|
|
23
|
+
ensure_master_key_has_been_added if Rails.application.credentials.key.nil?
|
|
24
24
|
ensure_credentials_have_been_added
|
|
25
25
|
|
|
26
26
|
catch_editing_exceptions do
|
|
@@ -21,9 +21,10 @@ module Rails
|
|
|
21
21
|
|
|
22
22
|
def edit(file_path)
|
|
23
23
|
require_application_and_environment!
|
|
24
|
+
encrypted = Rails.application.encrypted(file_path, key_path: options[:key])
|
|
24
25
|
|
|
25
26
|
ensure_editor_available(command: "bin/rails encrypted:edit") || (return)
|
|
26
|
-
ensure_encryption_key_has_been_added(options[:key])
|
|
27
|
+
ensure_encryption_key_has_been_added(options[:key]) if encrypted.key.nil?
|
|
27
28
|
ensure_encrypted_file_has_been_added(file_path, options[:key])
|
|
28
29
|
|
|
29
30
|
catch_editing_exceptions do
|
data/lib/rails/gem_version.rb
CHANGED
data/lib/rails/generators.rb
CHANGED
|
@@ -218,6 +218,9 @@ module Rails
|
|
|
218
218
|
rails.delete("app")
|
|
219
219
|
rails.delete("plugin")
|
|
220
220
|
rails.delete("encrypted_secrets")
|
|
221
|
+
rails.delete("encrypted_file")
|
|
222
|
+
rails.delete("encryption_key_file")
|
|
223
|
+
rails.delete("master_key")
|
|
221
224
|
rails.delete("credentials")
|
|
222
225
|
|
|
223
226
|
hidden_namespaces.each { |n| groups.delete(n.to_s) }
|
|
@@ -63,7 +63,12 @@ module Rails
|
|
|
63
63
|
numbered_destination = File.join(dir, ["%migration_number%", base].join("_"))
|
|
64
64
|
|
|
65
65
|
create_migration numbered_destination, nil, config do
|
|
66
|
-
ERB.
|
|
66
|
+
match = ERB.version.match(/\Aerb\.rb \[(?<version>[^ ]+) /)
|
|
67
|
+
if match && match[:version] >= "2.2.0" # Ruby 2.6+
|
|
68
|
+
ERB.new(::File.binread(source), trim_mode: "-", eoutvar: "@output_buffer").result(context)
|
|
69
|
+
else
|
|
70
|
+
ERB.new(::File.binread(source), nil, "-", "@output_buffer").result(context)
|
|
71
|
+
end
|
|
67
72
|
end
|
|
68
73
|
end
|
|
69
74
|
end
|
|
@@ -130,6 +130,8 @@ module Rails
|
|
|
130
130
|
assets_config_exist = File.exist?("config/initializers/assets.rb")
|
|
131
131
|
csp_config_exist = File.exist?("config/initializers/content_security_policy.rb")
|
|
132
132
|
|
|
133
|
+
@config_target_version = Rails.application.config.loaded_config_version || "5.0"
|
|
134
|
+
|
|
133
135
|
config
|
|
134
136
|
|
|
135
137
|
unless cookie_serializer_config_exist
|
|
@@ -167,7 +169,7 @@ module Rails
|
|
|
167
169
|
return if options[:pretend] || options[:dummy_app]
|
|
168
170
|
|
|
169
171
|
require "rails/generators/rails/master_key/master_key_generator"
|
|
170
|
-
master_key_generator = Rails::Generators::MasterKeyGenerator.new([], quiet: options[:quiet])
|
|
172
|
+
master_key_generator = Rails::Generators::MasterKeyGenerator.new([], quiet: options[:quiet], force: options[:force])
|
|
171
173
|
master_key_generator.add_master_key_file_silently
|
|
172
174
|
master_key_generator.ignore_master_key_file_silently
|
|
173
175
|
end
|
|
@@ -233,6 +235,10 @@ module Rails
|
|
|
233
235
|
def vendor
|
|
234
236
|
empty_directory_with_keep_file "vendor"
|
|
235
237
|
end
|
|
238
|
+
|
|
239
|
+
def config_target_version
|
|
240
|
+
defined?(@config_target_version) ? @config_target_version : Rails::VERSION::STRING.to_f
|
|
241
|
+
end
|
|
236
242
|
end
|
|
237
243
|
|
|
238
244
|
module Generators
|
|
@@ -242,7 +248,7 @@ module Rails
|
|
|
242
248
|
RESERVED_NAMES = %w[application destroy plugin runner test]
|
|
243
249
|
|
|
244
250
|
class AppGenerator < AppBase # :nodoc:
|
|
245
|
-
WEBPACKS = %w( react vue angular elm )
|
|
251
|
+
WEBPACKS = %w( react vue angular elm stimulus )
|
|
246
252
|
|
|
247
253
|
add_shared_options_for "application"
|
|
248
254
|
|
|
@@ -383,9 +389,13 @@ module Rails
|
|
|
383
389
|
end
|
|
384
390
|
end
|
|
385
391
|
|
|
386
|
-
def
|
|
392
|
+
def delete_app_views_if_api_option
|
|
387
393
|
if options[:api]
|
|
388
|
-
|
|
394
|
+
if options[:skip_action_mailer]
|
|
395
|
+
remove_dir "app/views"
|
|
396
|
+
else
|
|
397
|
+
remove_file "app/views/layouts/application.html.erb"
|
|
398
|
+
end
|
|
389
399
|
end
|
|
390
400
|
end
|
|
391
401
|
|
|
@@ -69,7 +69,7 @@ end
|
|
|
69
69
|
<%- if depends_on_system_test? -%>
|
|
70
70
|
group :test do
|
|
71
71
|
# Adds support for Capybara system testing and selenium driver
|
|
72
|
-
gem 'capybara', '
|
|
72
|
+
gem 'capybara', '>= 2.15', '< 4.0'
|
|
73
73
|
gem 'selenium-webdriver'
|
|
74
74
|
# Easy installation and use of chromedriver to run system tests with Chrome
|
|
75
75
|
gem 'chromedriver-helper'
|
|
@@ -24,7 +24,7 @@ Bundler.require(*Rails.groups)
|
|
|
24
24
|
module <%= app_const_base %>
|
|
25
25
|
class Application < Rails::Application
|
|
26
26
|
# Initialize configuration defaults for originally generated Rails version.
|
|
27
|
-
config.load_defaults <%=
|
|
27
|
+
config.load_defaults <%= build(:config_target_version) %>
|
|
28
28
|
|
|
29
29
|
# Settings in config/environments/* take precedence over those specified here.
|
|
30
30
|
# Application configuration can go into files in config/initializers
|
data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt
CHANGED
|
@@ -10,12 +10,15 @@
|
|
|
10
10
|
# policy.img_src :self, :https, :data
|
|
11
11
|
# policy.object_src :none
|
|
12
12
|
# policy.script_src :self, :https
|
|
13
|
-
# policy.style_src :self, :https
|
|
13
|
+
# policy.style_src :self, :https
|
|
14
14
|
|
|
15
15
|
# # Specify URI for violation reports
|
|
16
16
|
# # policy.report_uri "/csp-violation-report-endpoint"
|
|
17
17
|
# end
|
|
18
18
|
|
|
19
|
+
# If you are using UJS then enable automatic nonce generation
|
|
20
|
+
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
|
21
|
+
|
|
19
22
|
# Report CSP violations to a specified URI
|
|
20
23
|
# For further information see the following documentation:
|
|
21
24
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_2.rb.tt
CHANGED
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
# Rails.application.config.active_record.cache_versioning = true
|
|
12
12
|
|
|
13
13
|
# Use AES-256-GCM authenticated encryption for encrypted cookies.
|
|
14
|
+
# Also, embed cookie expiry in signed or encrypted cookies for increased security.
|
|
15
|
+
#
|
|
16
|
+
# This option is not backwards compatible with earlier Rails versions.
|
|
17
|
+
# It's best enabled when your entire app is migrated and stable on 5.2.
|
|
18
|
+
#
|
|
14
19
|
# Existing cookies will be converted on read then written with the new scheme.
|
|
15
20
|
# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true
|
|
16
21
|
|
|
@@ -24,7 +24,6 @@ local:
|
|
|
24
24
|
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
|
25
25
|
# microsoft:
|
|
26
26
|
# service: AzureStorage
|
|
27
|
-
# path: your_azure_storage_path
|
|
28
27
|
# storage_account_name: your_account_name
|
|
29
28
|
# storage_access_key: <%%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
|
30
29
|
# container: your_container_name
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
require "rails/generators/base"
|
|
4
4
|
require "rails/generators/rails/master_key/master_key_generator"
|
|
5
|
+
require "active_support/core_ext/string/strip"
|
|
5
6
|
require "active_support/encrypted_configuration"
|
|
6
7
|
|
|
7
8
|
module Rails
|
|
8
9
|
module Generators
|
|
9
|
-
class CredentialsGenerator < Base
|
|
10
|
+
class CredentialsGenerator < Base # :nodoc:
|
|
10
11
|
def add_credentials_file
|
|
11
12
|
unless credentials.content_path.exist?
|
|
12
13
|
template = credentials_template
|
|
@@ -42,9 +43,14 @@ module Rails
|
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
def credentials_template
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
<<-YAML.strip_heredoc
|
|
47
|
+
# aws:
|
|
48
|
+
# access_key_id: 123
|
|
49
|
+
# secret_access_key: 345
|
|
50
|
+
|
|
51
|
+
# Used as the base secret for all MessageVerifiers in Rails, including the one protecting cookies.
|
|
52
|
+
secret_key_base: #{SecureRandom.hex(64)}
|
|
53
|
+
YAML
|
|
48
54
|
end
|
|
49
55
|
end
|
|
50
56
|
end
|
|
@@ -1,27 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "rails/generators/base"
|
|
4
|
+
require "active_support/core_ext/string/strip"
|
|
4
5
|
require "active_support/encrypted_file"
|
|
5
6
|
|
|
6
7
|
module Rails
|
|
7
8
|
module Generators
|
|
8
|
-
class EncryptedFileGenerator < Base
|
|
9
|
-
def add_encrypted_file(file_path, key_path)
|
|
10
|
-
unless File.exist?(file_path)
|
|
11
|
-
say "Adding #{file_path} to store encrypted content."
|
|
12
|
-
say ""
|
|
13
|
-
say "The following content has been encrypted with the encryption key:"
|
|
14
|
-
say ""
|
|
15
|
-
say template, :on_green
|
|
16
|
-
say ""
|
|
17
|
-
|
|
18
|
-
add_encrypted_file_silently(file_path, key_path)
|
|
19
|
-
|
|
20
|
-
say "You can edit encrypted file with `bin/rails encrypted:edit #{file_path}`."
|
|
21
|
-
say ""
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
9
|
+
class EncryptedFileGenerator < Base # :nodoc:
|
|
25
10
|
def add_encrypted_file_silently(file_path, key_path, template = encrypted_file_template)
|
|
26
11
|
unless File.exist?(file_path)
|
|
27
12
|
setup = { content_path: file_path, key_path: key_path, env_key: "RAILS_MASTER_KEY", raise_if_missing_key: true }
|
|
@@ -31,7 +16,12 @@ module Rails
|
|
|
31
16
|
|
|
32
17
|
private
|
|
33
18
|
def encrypted_file_template
|
|
34
|
-
|
|
19
|
+
<<-YAML.strip_heredoc
|
|
20
|
+
# aws:
|
|
21
|
+
# access_key_id: 123
|
|
22
|
+
# secret_access_key: 345
|
|
23
|
+
|
|
24
|
+
YAML
|
|
35
25
|
end
|
|
36
26
|
end
|
|
37
27
|
end
|
|
@@ -7,7 +7,7 @@ require "active_support/encrypted_file"
|
|
|
7
7
|
|
|
8
8
|
module Rails
|
|
9
9
|
module Generators
|
|
10
|
-
class MasterKeyGenerator < Base
|
|
10
|
+
class MasterKeyGenerator < Base # :nodoc:
|
|
11
11
|
MASTER_KEY_PATH = Pathname.new("config/master.key")
|
|
12
12
|
|
|
13
13
|
def add_master_key_file
|
|
@@ -27,7 +27,9 @@ module Rails
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def add_master_key_file_silently(key = nil)
|
|
30
|
-
|
|
30
|
+
unless MASTER_KEY_PATH.exist?
|
|
31
|
+
key_file_generator.add_key_file_silently(MASTER_KEY_PATH, key)
|
|
32
|
+
end
|
|
31
33
|
end
|
|
32
34
|
|
|
33
35
|
def ignore_master_key_file
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<title><%= humanized %></title>
|
|
5
|
+
<%%= csrf_meta_tags %>
|
|
6
|
+
<%%= csp_meta_tag %>
|
|
7
|
+
|
|
5
8
|
<%%= stylesheet_link_tag "<%= namespaced_name %>/application", media: "all" %>
|
|
9
|
+
<%- unless options[:skip_javascript] -%>
|
|
6
10
|
<%%= javascript_include_tag "<%= namespaced_name %>/application" %>
|
|
7
|
-
|
|
11
|
+
<%- end -%>
|
|
8
12
|
</head>
|
|
9
13
|
<body>
|
|
10
14
|
|
|
@@ -19,10 +19,10 @@ require "rails"
|
|
|
19
19
|
require "active_model/railtie"
|
|
20
20
|
require "active_job/railtie"
|
|
21
21
|
<%= comment_if :skip_active_record %>require "active_record/railtie"
|
|
22
|
+
<%= comment_if :skip_active_storage %>require "active_storage/engine"
|
|
22
23
|
require "action_controller/railtie"
|
|
23
24
|
<%= comment_if :skip_action_mailer %>require "action_mailer/railtie"
|
|
24
25
|
require "action_view/railtie"
|
|
25
|
-
require "active_storage/engine"
|
|
26
26
|
<%= comment_if :skip_action_cable %>require "action_cable/engine"
|
|
27
27
|
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
|
|
28
28
|
<%= comment_if :skip_test %>require "rails/test_unit/railtie"
|
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.rc2
|
|
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-
|
|
11
|
+
date: 2018-03-20 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.rc2
|
|
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.rc2
|
|
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.rc2
|
|
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.rc2
|
|
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.rc2
|
|
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.rc2
|
|
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.rc2/railties
|
|
425
|
+
changelog_uri: https://github.com/rails/rails/blob/v5.2.0.rc2/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.7.
|
|
444
|
+
rubygems_version: 2.7.6
|
|
445
445
|
signing_key:
|
|
446
446
|
specification_version: 4
|
|
447
447
|
summary: Tools for creating, working with, and running Rails applications.
|