aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/lib/rails/commands.rb15
-rw-r--r--railties/lib/rails/commands/command.rb5
-rw-r--r--railties/lib/rails/commands/commands_tasks.rb4
3 files changed, 14 insertions, 10 deletions
diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb
index d4d8d3ac75..df2ed94654 100644
--- a/railties/lib/rails/commands.rb
+++ b/railties/lib/rails/commands.rb
@@ -1,5 +1,3 @@
-ARGV << '--help' if ARGV.empty?
-
aliases = {
"g" => "generate",
"d" => "destroy",
@@ -10,10 +8,15 @@ aliases = {
"t" => "test",
}
-command = ARGV.shift
-command = aliases[command] || command
+if ARGV.empty?
+ ARGV << '--help'
+ command = ''
+else
+ command = ARGV.shift
+ command = aliases[command] || command
+end
+require 'rails/commands/command'
require 'rails/commands/dev_cache'
-require 'rails/commands/commands_tasks'
-Rails::CommandsTasks.new(ARGV).run_command!(command)
+Rails::Commands::Command.run(command, ARGV)
diff --git a/railties/lib/rails/commands/command.rb b/railties/lib/rails/commands/command.rb
index fe0b77cb96..d2e1cd18b4 100644
--- a/railties/lib/rails/commands/command.rb
+++ b/railties/lib/rails/commands/command.rb
@@ -1,3 +1,5 @@
+require 'rails/commands/commands_tasks'
+
module Rails
module Commands
class Command
@@ -15,7 +17,8 @@ module Rails
if command = command_for(command_name)
command.new(argv).run(command_name)
- true # Indicate command was found and run.
+ else
+ Rails::CommandsTasks.new(argv).run_command!(task_name)
end
end
diff --git a/railties/lib/rails/commands/commands_tasks.rb b/railties/lib/rails/commands/commands_tasks.rb
index c70a2af577..7e6b49e2a3 100644
--- a/railties/lib/rails/commands/commands_tasks.rb
+++ b/railties/lib/rails/commands/commands_tasks.rb
@@ -37,9 +37,7 @@ EOT
def run_command!(command)
command = parse_command(command)
- run_with_command = Rails::Commands::Command.run(command, argv)
-
- if !run_with_command && COMMAND_WHITELIST.include?(command)
+ if COMMAND_WHITELIST.include?(command)
send(command)
end
end