diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2016-05-29 17:35:51 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2016-05-29 17:35:51 +0200 |
commit | ba8d7fc20d331ff73a59dae0d06736c3538f48b3 (patch) | |
tree | 03b259dabf5ffb175962eed807af5066d92506a7 /railties/lib/rails/generators | |
parent | 9c7f18091d5be02abfa23aff8508d70d5d3b0831 (diff) | |
parent | d58cd128dd2dbf7db80cee1e684533b74dfdd97c (diff) | |
download | rails-ba8d7fc20d331ff73a59dae0d06736c3538f48b3.tar.gz rails-ba8d7fc20d331ff73a59dae0d06736c3538f48b3.tar.bz2 rails-ba8d7fc20d331ff73a59dae0d06736c3538f48b3.zip |
Merge pull request #25184 from prathamesh-sonpatki/move-up-framework-initializers
Move new default initializers into separate directory
Diffstat (limited to 'railties/lib/rails/generators')
8 files changed, 17 insertions, 15 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 1ac6fae908..3bc66f55fb 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -90,11 +90,11 @@ module Rails def config_when_updating cookie_serializer_config_exist = File.exist?('config/initializers/cookies_serializer.rb') - callback_terminator_config_exist = File.exist?('config/initializers/callback_terminator.rb') - active_record_belongs_to_required_by_default_config_exist = File.exist?('config/initializers/active_record_belongs_to_required_by_default.rb') - to_time_preserves_timezone_config_exist = File.exist?('config/initializers/to_time_preserves_timezone.rb') + callback_terminator_config_exist = File.exist?('config/initializers/new_framework_defaults/callback_terminator.rb') + active_record_belongs_to_required_by_default_config_exist = File.exist?('config/initializers/new_framework_defaults/active_record_belongs_to_required_by_default.rb') + to_time_preserves_timezone_config_exist = File.exist?('config/initializers/new_framework_defaults/to_time_preserves_timezone.rb') action_cable_config_exist = File.exist?('config/cable.yml') - ssl_options_exist = File.exist?('config/initializers/ssl_options.rb') + ssl_options_exist = File.exist?('config/initializers/new_framework_defaults/ssl_options.rb') rack_cors_config_exist = File.exist?('config/initializers/cors.rb') config @@ -102,7 +102,7 @@ module Rails gsub_file 'config/environments/development.rb', /^(\s+)config\.file_watcher/, '\1# config.file_watcher' unless callback_terminator_config_exist - remove_file 'config/initializers/callback_terminator.rb' + remove_file 'config/initializers/new_framework_defaults/callback_terminator.rb' end unless cookie_serializer_config_exist @@ -110,11 +110,11 @@ module Rails end unless active_record_belongs_to_required_by_default_config_exist - remove_file 'config/initializers/active_record_belongs_to_required_by_default.rb' + remove_file 'config/initializers/new_framework_defaults/active_record_belongs_to_required_by_default.rb' end unless to_time_preserves_timezone_config_exist - remove_file 'config/initializers/to_time_preserves_timezone.rb' + remove_file 'config/initializers/new_framework_defaults/to_time_preserves_timezone.rb' end unless action_cable_config_exist @@ -122,7 +122,7 @@ module Rails end unless ssl_options_exist - remove_file 'config/initializers/ssl_options.rb' + remove_file 'config/initializers/new_framework_defaults/ssl_options.rb' end unless rack_cors_config_exist @@ -344,7 +344,7 @@ module Rails def delete_active_record_initializers_skipping_active_record if options[:skip_active_record] - remove_file 'config/initializers/active_record_belongs_to_required_by_default.rb' + remove_file 'config/initializers/new_framework_defaults/active_record_belongs_to_required_by_default.rb' end end @@ -360,8 +360,8 @@ module Rails if options[:api] remove_file 'config/initializers/session_store.rb' remove_file 'config/initializers/cookies_serializer.rb' - remove_file 'config/initializers/request_forgery_protection.rb' - remove_file 'config/initializers/per_form_csrf_tokens.rb' + remove_file 'config/initializers/new_framework_defaults/request_forgery_protection.rb' + remove_file 'config/initializers/new_framework_defaults/per_form_csrf_tokens.rb' end end diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/active_record_belongs_to_required_by_default.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/active_record_belongs_to_required_by_default.rb index f613b40f80..f613b40f80 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/active_record_belongs_to_required_by_default.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/active_record_belongs_to_required_by_default.rb diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/callback_terminator.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/callback_terminator.rb index 649e82280e..649e82280e 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/callback_terminator.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/callback_terminator.rb diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/per_form_csrf_tokens.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/per_form_csrf_tokens.rb index 1f569dedfd..1f569dedfd 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/per_form_csrf_tokens.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/per_form_csrf_tokens.rb diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/request_forgery_protection.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/request_forgery_protection.rb index 3eab78a885..3eab78a885 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/request_forgery_protection.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/request_forgery_protection.rb diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/ssl_options.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/ssl_options.rb new file mode 100644 index 0000000000..53dfcd7466 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/ssl_options.rb @@ -0,0 +1,6 @@ +# Be sure to restart your server when you modify this file. + +# Configure SSL options to enable HSTS with subdomains. This is a new +# Rails 5.0 default, so it is introduced as a configuration option to ensure +# that apps made on earlier versions of Rails are not affected when upgrading. +Rails.application.config.ssl_options = { hsts: { subdomains: true } } diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/to_time_preserves_timezone.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/to_time_preserves_timezone.rb index 8674be3227..8674be3227 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/to_time_preserves_timezone.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults/to_time_preserves_timezone.rb diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/ssl_options.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/ssl_options.rb deleted file mode 100644 index 1775dea1e7..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/ssl_options.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Configure SSL options to enable HSTS with subdomains. -Rails.application.config.ssl_options = { hsts: { subdomains: true } } |