diff options
author | Dharam Gollapudi <dharam.gollapudi@gmail.com> | 2015-11-13 16:58:51 -0800 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-12-13 20:59:41 +0100 |
commit | 52f2f9810eaf3d385ca3eef8ed6fc62e4fd1f7d3 (patch) | |
tree | abce7a1ac3bf7799bf52b19ec43c8d6adf1a15ac /guides | |
parent | 02eef9459a19f263b30d8d032017c05bfc97d00b (diff) | |
download | rails-52f2f9810eaf3d385ca3eef8ed6fc62e4fd1f7d3.tar.gz rails-52f2f9810eaf3d385ca3eef8ed6fc62e4fd1f7d3.tar.bz2 rails-52f2f9810eaf3d385ca3eef8ed6fc62e4fd1f7d3.zip |
Implement Rake proxy for Rails' command line interface.
Allows any Rake task to be run through `bin/rails` such as `bin/rails db:migrate`,
`bin/rails notes` etc.
The Rake tasks are appended to Rails' help output, and blend in as standard commands.
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/initialization.md | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/guides/source/initialization.md b/guides/source/initialization.md index ebe1cb206a..1215931465 100644 --- a/guides/source/initialization.md +++ b/guides/source/initialization.md @@ -139,7 +139,8 @@ aliases = { "c" => "console", "s" => "server", "db" => "dbconsole", - "r" => "runner" + "r" => "runner", + "t" => "test" } command = ARGV.shift @@ -158,19 +159,20 @@ defined here to find the matching command. ### `rails/commands/command_tasks.rb` -When one types an incorrect rails command, the `run_command` is responsible for -throwing an error message. If the command is valid, a method of the same name -is called. +If the command is part of the COMMAND_WHITELIST, a method of the same name is called, +if not we proxy it to rake. ```ruby COMMAND_WHITELIST = %w(plugin generate destroy console server dbconsole application runner new version help) def run_command!(command) command = parse_command(command) + if COMMAND_WHITELIST.include?(command) send(command) else - write_error_message(command) + ARGV.unshift(command) + send(:rake) end end ``` |