aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG.md5
-rw-r--r--railties/lib/rails/app_loader.rb2
-rw-r--r--railties/lib/rails/tasks/framework.rake16
-rw-r--r--railties/test/application/rake_test.rb4
4 files changed, 23 insertions, 4 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index 5a4ad2ff99..f3da431b09 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 a9fe21824e..af004d85bf 100644
--- a/railties/lib/rails/app_loader.rb
+++ b/railties/lib/rails/app_loader.rb
@@ -16,7 +16,7 @@ like any other source code, rather than stubs that are generated on demand.
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 7601836809..ae92836407 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 3db467256e..92ae3edc08 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -369,7 +369,7 @@ module ApplicationTests
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 @@ module ApplicationTests
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)