diff --git a/guides/source/configuring.md b/guides/source/configuring.md index b83d25c68397853e3af8b65008fa2b0f453785bd..bcf045b6e055bba8134b856ccb953979862e4d34 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -550,7 +550,7 @@ There are a few configuration options available in Active Support: * `config.active_support.time_precision` sets the precision of JSON encoded time values. Defaults to `3`. -* `ActiveSupport.halt_callback_chains_on_return_false` specifies whether Active Record and Active Model callback chains can be halted by returning `false` in a 'before' callback. When set to `false`, callback chains are halted only when explicitly done so with `throw(:abort)`. When set to `true`, callback chains are halted when a callback returns false (the previous behavior before Rails 5) and a deprecation warning is given. Defaults to `true` during the deprecation period. New Rails 5 apps generate an initializer file called `callback_terminator.rb` which sets the value to `false`. This file is *not* added when running `rake rails:update`, so returning `false` will still work on older apps ported to Rails 5 and display a deprecation warning to prompt users to update their code. +* `ActiveSupport.halt_callback_chains_on_return_false` specifies whether Active Record and Active Model callback chains can be halted by returning `false` in a 'before' callback. When set to `false`, callback chains are halted only when explicitly done so with `throw(:abort)`. When set to `true`, callback chains are halted when a callback returns false (the previous behavior before Rails 5) and a deprecation warning is given. Defaults to `true` during the deprecation period. New Rails 5 apps generate an initializer file called `callback_terminator.rb` which sets the value to `false`. This file is *not* added when running `rails app:update`, so returning `false` will still work on older apps ported to Rails 5 and display a deprecation warning to prompt users to update their code. * `ActiveSupport::Logger.silencer` is set to `false` to disable the ability to silence logging in a block. The default is `true`. diff --git a/guides/source/rails_application_templates.md b/guides/source/rails_application_templates.md index 3bb5d3c8a619ceda2fb7047b19445147e0416a94..3b773d84f8e01bdbed5a6a4bf1d9c9e59c767903 100644 --- a/guides/source/rails_application_templates.md +++ b/guides/source/rails_application_templates.md @@ -22,11 +22,11 @@ $ rails new blog -m ~/template.rb $ rails new blog -m http://example.com/template.rb ``` -You can use the task `rails:template` to apply templates to an existing Rails application. The location of the template needs to be passed in to an environment variable named LOCATION. Again, this can either be path to a file or a URL. +You can use the task `app:template` to apply templates to an existing Rails application. The location of the template needs to be passed in to an environment variable named LOCATION. Again, this can either be path to a file or a URL. ```bash -$ bin/rails rails:template LOCATION=~/template.rb -$ bin/rails rails:template LOCATION=http://example.com/template.rb +$ bin/rails app:template LOCATION=~/template.rb +$ bin/rails app:template LOCATION=http://example.com/template.rb ``` Template API diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 0dfa4f1cb8030f491afa7806afa30f6cd7fc1fa8..7653ea9472cb7d7cdfcb95b403e62517d4492cb5 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -44,13 +44,13 @@ TIP: Ruby 1.8.7 p248 and p249 have marshaling bugs that crash Rails. Ruby Enterp ### The Rake Task -Rails provides the `rails:update` rake task. After updating the Rails version +Rails provides the `app:update` rake task. After updating the Rails version in the Gemfile, run this rake task. This will help you with the creation of new files and changes of old files in an interactive session. ```bash -$ rake rails:update +$ rails app:update identical config/boot.rb exist config conflict config/routes.rb diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 5a4ad2ff99fa79fb3ab1b1c15a31d7fb37c8d3e9..f3da431b091ebb1b4389d9b56c96d163cf765844 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,8 @@ +* The tasks in the rails task namespace is deprecated in favor of app namespace. + (e.g. `rails:update` and `rails:template` tasks is renamed to `app:update` and `app:template`.) + + *Ryo Hashimoto* + * Enable HSTS with IncludeSudomains header for new applications. *Egor Homakov*, *Prathamesh Sonpatki* diff --git a/railties/lib/rails/app_loader.rb b/railties/lib/rails/app_loader.rb index a9fe21824e078323cc59df9dd4a4165b21b9bdbc..af004d85bfdf772baa89051558c10efe6175a11b 100644 --- a/railties/lib/rails/app_loader.rb +++ b/railties/lib/rails/app_loader.rb @@ -16,7 +16,7 @@ module AppLoader # :nodoc: Here's how to upgrade: bundle config --delete bin # Turn off Bundler's stub generator - rake rails:update:bin # Use the new Rails 4 executables + rails app:update:bin # Use the new Rails 5 executables git add bin # Add bin/ to source control You may need to remove bin/ from your .gitignore as well. diff --git a/railties/lib/rails/tasks/framework.rake b/railties/lib/rails/tasks/framework.rake index 76018368094d0c1674dc409ae731c32b6e82aff3..ae928364073293834af4978062bab59ef7607661 100644 --- a/railties/lib/rails/tasks/framework.rake +++ b/railties/lib/rails/tasks/framework.rake @@ -1,4 +1,6 @@ -namespace :rails do +require 'active_support/deprecation' + +namespace :app do desc "Update configs and some other initially generated files (or use just update:configs or update:bin)" task update: [ "update:configs", "update:bin" ] @@ -66,3 +68,15 @@ namespace :rails do end end end + +namespace :rails do + %i(update template templates:copy update:configs update:bin).each do |task_name| + task "#{task_name}" do + ActiveSupport::Deprecation.warn(<<-MSG.squish) + Running #{task_name} with the rails: namespace is deprecated in favor of app. + Run e.g. bin/rails app:#{task_name} instead." + MSG + Rake.application.invoke_task("app:#{task_name}") + end + end +end diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index 3db467256e8ca5789c8837f75fd41d7877d2b824..92ae3edc08f0b1368ee21989feb62636e525ac03 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -369,7 +369,7 @@ def test_rake_clear_schema_cache def test_copy_templates Dir.chdir(app_path) do - `bin/rails rails:templates:copy` + `bin/rails app:templates:copy` %w(controller mailer scaffold).each do |dir| assert File.exist?(File.join(app_path, 'lib', 'templates', 'erb', dir)) end @@ -384,7 +384,7 @@ def test_template_load_initializers app_file "template.rb", "" output = Dir.chdir(app_path) do - `bin/rails rails:template LOCATION=template.rb` + `bin/rails app:template LOCATION=template.rb` end assert_match(/Hello, World!/, output)