aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2016-02-03 08:16:18 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2016-02-03 08:17:25 +0900
commitfae17243984965b152d8212be6405ce840887018 (patch)
tree09e5f277fb26f6607aeb7bbfc94ca754123da65d
parent49e0c4e8642a0160bd01c4490b4babe89108da48 (diff)
downloadrails-fae17243984965b152d8212be6405ce840887018.tar.gz
rails-fae17243984965b152d8212be6405ce840887018.tar.bz2
rails-fae17243984965b152d8212be6405ce840887018.zip
use rails command in routes task
For other task has become to use the rails command at doc and test, I think that routes task also it is better to use the rails command.
-rw-r--r--guides/source/routing.md14
-rw-r--r--railties/lib/rails/tasks/routes.rake6
-rw-r--r--railties/test/application/rake_test.rb14
3 files changed, 17 insertions, 17 deletions
diff --git a/guides/source/routing.md b/guides/source/routing.md
index d9e64d56ac..777d1d24b6 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -1139,18 +1139,18 @@ edit_user GET /users/:id/edit(.:format) users#edit
You can search through your routes with the --grep option (-g for short). This outputs any routes that partially match the URL helper method name, the HTTP verb, or the URL path.
```
-$ bin/rake routes --grep new_comment
-$ bin/rake routes -g POST
-$ bin/rake routes -g admin
+$ bin/rails routes --grep new_comment
+$ bin/rails routes -g POST
+$ bin/rails routes -g admin
```
If you only want to see the routes that map to a specific controller, there's the --controller option (-c for short).
```
-$ bin/rake routes --controller users
-$ bin/rake routes --controller admin/users
-$ bin/rake routes -c Comments
-$ bin/rake routes -c Articles::CommentsController
+$ bin/rails routes --controller users
+$ bin/rails routes --controller admin/users
+$ bin/rails routes -c Comments
+$ bin/rails routes -c Articles::CommentsController
```
TIP: You'll find that the output from `rails routes` is much more readable if you widen your terminal window until the output lines don't wrap.
diff --git a/railties/lib/rails/tasks/routes.rake b/railties/lib/rails/tasks/routes.rake
index 353b8b4e72..939fa59c75 100644
--- a/railties/lib/rails/tasks/routes.rake
+++ b/railties/lib/rails/tasks/routes.rake
@@ -9,8 +9,8 @@ task routes: :environment do
inspector = ActionDispatch::Routing::RoutesInspector.new(all_routes)
if ARGV.any?{ |argv| argv.start_with? 'CONTROLLER' }
puts <<-eow.strip_heredoc
- Passing `CONTROLLER` to `bin/rake routes` is deprecated and will be removed in Rails 5.1.
- Please use `bin/rake routes -c controller_name` instead.
+ Passing `CONTROLLER` to `bin/rails routes` is deprecated and will be removed in Rails 5.1.
+ Please use `bin/rails routes -c controller_name` instead.
eow
end
@@ -18,7 +18,7 @@ task routes: :environment do
routes_filter = { controller: ENV['CONTROLLER'] } if ENV['CONTROLLER']
OptionParser.new do |opts|
- opts.banner = "Usage: rake routes [options]"
+ opts.banner = "Usage: rails routes [options]"
opts.on("-c", "--controller [CONTROLLER]") do |controller|
routes_filter = { controller: controller }
end
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb
index 7171aa6e1a..745a3e3ec5 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -141,9 +141,9 @@ module ApplicationTests
end
RUBY
- output = Dir.chdir(app_path){ `bin/rake routes CONTROLLER=cart` }
- assert_equal ["Passing `CONTROLLER` to `bin/rake routes` is deprecated and will be removed in Rails 5.1.",
- "Please use `bin/rake routes -c controller_name` instead.",
+ output = Dir.chdir(app_path){ `bin/rails routes CONTROLLER=cart` }
+ assert_equal ["Passing `CONTROLLER` to `bin/rails routes` is deprecated and will be removed in Rails 5.1.",
+ "Please use `bin/rails routes -c controller_name` instead.",
"Prefix Verb URI Pattern Controller#Action",
" cart GET /cart(.:format) cart#show\n"].join("\n"), output
@@ -183,7 +183,7 @@ module ApplicationTests
end
RUBY
- output = Dir.chdir(app_path){ `bin/rake routes -g show` }
+ output = Dir.chdir(app_path){ `bin/rails routes -g show` }
assert_equal "Prefix Verb URI Pattern Controller#Action\n cart GET /cart(.:format) cart#show\n", output
end
@@ -195,13 +195,13 @@ module ApplicationTests
end
RUBY
- output = Dir.chdir(app_path){ `bin/rake routes -c cart` }
+ output = Dir.chdir(app_path){ `bin/rails routes -c cart` }
assert_equal "Prefix Verb URI Pattern Controller#Action\n cart GET /cart(.:format) cart#show\n", output
- output = Dir.chdir(app_path){ `bin/rake routes -c Cart` }
+ output = Dir.chdir(app_path){ `bin/rails routes -c Cart` }
assert_equal "Prefix Verb URI Pattern Controller#Action\n cart GET /cart(.:format) cart#show\n", output
- output = Dir.chdir(app_path){ `bin/rake routes -c CartController` }
+ output = Dir.chdir(app_path){ `bin/rails routes -c CartController` }
assert_equal "Prefix Verb URI Pattern Controller#Action\n cart GET /cart(.:format) cart#show\n", output
end