diff options
author | Alex Johnson <notalexjohnson@gmail.com> | 2013-11-08 15:07:38 +0530 |
---|---|---|
committer | Alex Johnson <notalexjohnson@gmail.com> | 2013-11-08 15:07:39 +0530 |
commit | 3d449dee5ed60b4d6c688c919c527dd70f528043 (patch) | |
tree | 84bf213641dfe3ba207c0b7bb27352f09016e74b /guides/source | |
parent | a1f1e6d9e20a8d527eff900a865a270be2c0d794 (diff) | |
download | rails-3d449dee5ed60b4d6c688c919c527dd70f528043.tar.gz rails-3d449dee5ed60b4d6c688c919c527dd70f528043.tar.bz2 rails-3d449dee5ed60b4d6c688c919c527dd70f528043.zip |
Update commands.rb content in initialization guide
[ci skip]
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/initialization.md | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/guides/source/initialization.md b/guides/source/initialization.md index 33eb74dcd9..29c7294145 100644 --- a/guides/source/initialization.md +++ b/guides/source/initialization.md @@ -126,7 +126,7 @@ A standard Rails application depends on several gems, specifically: ### `rails/commands.rb` -Once `config/boot.rb` has finished, the next file that is required is `rails/commands` which will execute a command based on the arguments passed in. In this case, the `ARGV` array simply contains `server` which is extracted into the `command` variable using these lines: +Once `config/boot.rb` has finished, the next file that is required is `rails/commands`, which helps in expanding aliases. In the current case, the `ARGV` array simply contains `server` which will be passed over to `rails/commands_tasks`. ```ruby ARGV << '--help' if ARGV.empty? @@ -142,12 +142,18 @@ aliases = { command = ARGV.shift command = aliases[command] || command + +require 'rails/commands/commands_tasks' + +Rails::CommandsTasks.new(ARGV).run_command!(command) ``` TIP: As you can see, an empty ARGV list will make Rails show the help snippet. -If we used `s` rather than `server`, Rails will use the `aliases` defined in the file and match them to their respective commands. With the `server` command, Rails will run this code: +If we had used `s` rather than `server`, Rails would have used the `aliases` defined here to find the matching command. + +With the `server` command, Rails will run this code: ```ruby when 'server' |