aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands/common_commands_tasks.rb
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-09-12 21:59:26 +0200
committerKasper Timm Hansen <kaspth@gmail.com>2016-09-25 21:31:45 +0200
commit03c982fa3417fc49a380eeb88fdd26fdd4bae46b (patch)
treebf60ebe8bd609876bc381893d20b450b3a023917 /railties/lib/rails/commands/common_commands_tasks.rb
parent4e106ee08b36c2047a6af3829f3497459590c98a (diff)
downloadrails-03c982fa3417fc49a380eeb88fdd26fdd4bae46b.tar.gz
rails-03c982fa3417fc49a380eeb88fdd26fdd4bae46b.tar.bz2
rails-03c982fa3417fc49a380eeb88fdd26fdd4bae46b.zip
Remove the old command files.
Wash out your old! These adhoc scripts are replaced by the new commands.
Diffstat (limited to 'railties/lib/rails/commands/common_commands_tasks.rb')
-rw-r--r--railties/lib/rails/commands/common_commands_tasks.rb68
1 files changed, 0 insertions, 68 deletions
diff --git a/railties/lib/rails/commands/common_commands_tasks.rb b/railties/lib/rails/commands/common_commands_tasks.rb
deleted file mode 100644
index c1484d7ae2..0000000000
--- a/railties/lib/rails/commands/common_commands_tasks.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-module Rails
- module CommonCommandsTasks # :nodoc:
- def run_command!(command)
- command = parse_command(command)
-
- if command_whitelist.include?(command)
- send(command)
- else
- run_rake_task(command)
- end
- end
-
- def generate
- generate_or_destroy(:generate)
- end
-
- def destroy
- generate_or_destroy(:destroy)
- end
-
- def test
- require_command!("test")
- end
-
- def version
- argv.unshift "--version"
- require_command!("application")
- end
-
- def help
- write_help_message
- write_commands(commands)
- end
-
- private
-
- def generate_or_destroy(command)
- require "rails/generators"
- require_application_and_environment!
- load_generators
- require_command!(command)
- end
-
- def require_command!(command)
- require "rails/commands/#{command}"
- end
-
- def write_help_message
- puts help_message
- end
-
- def write_commands(commands)
- width = commands.map { |name, _| name.size }.max || 10
- commands.each { |command| printf(" %-#{width}s %s\n", *command) }
- end
-
- def parse_command(command)
- case command
- when "--version", "-v"
- "version"
- when "--help", "-h"
- "help"
- else
- command
- end
- end
- end
-end