aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/initialization.md
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2015-12-13 21:25:40 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2015-12-13 21:44:03 +0100
commit3e65c3d3886336e9145438cdeacaf4ebec6a48b8 (patch)
tree0ce086f68620530149c11946470201c8bdf6603f /guides/source/initialization.md
parent02eef9459a19f263b30d8d032017c05bfc97d00b (diff)
parent52f2f9810eaf3d385ca3eef8ed6fc62e4fd1f7d3 (diff)
downloadrails-3e65c3d3886336e9145438cdeacaf4ebec6a48b8.tar.gz
rails-3e65c3d3886336e9145438cdeacaf4ebec6a48b8.tar.bz2
rails-3e65c3d3886336e9145438cdeacaf4ebec6a48b8.zip
Merge branch 'rails-rake-proxy'
Diffstat (limited to 'guides/source/initialization.md')
-rw-r--r--guides/source/initialization.md12
1 files changed, 7 insertions, 5 deletions
diff --git a/guides/source/initialization.md b/guides/source/initialization.md
index ebe1cb206a..7bf7eebb62 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.
+When one types a valid Rails command, `run_command!` a method of the same name
+is called. If Rails doesn't recognize the command, it tries to run a Rake task
+of the same name.
```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)
+ run_rake_task(command)
end
end
```