diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-09-26 20:28:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-26 20:28:40 +0200 |
commit | c994a893c18c0456fd2a30efe4debfc2b18e2508 (patch) | |
tree | 0253b1343a1760dc4701f7d2ee2ff8cdd1d1b290 /railties/lib/rails/engine | |
parent | a6da7938017647dd6e19e23d3d47126cb7a3e1fe (diff) | |
parent | c0c73738bd04c86fbcf6d22c961fec0d33aa2bf6 (diff) | |
download | rails-c994a893c18c0456fd2a30efe4debfc2b18e2508.tar.gz rails-c994a893c18c0456fd2a30efe4debfc2b18e2508.tar.bz2 rails-c994a893c18c0456fd2a30efe4debfc2b18e2508.zip |
Merge pull request #26414 from rails/rails-commands
Initial Rails Commands Infrastructure
Diffstat (limited to 'railties/lib/rails/engine')
-rw-r--r-- | railties/lib/rails/engine/commands.rb | 6 | ||||
-rw-r--r-- | railties/lib/rails/engine/commands_tasks.rb | 62 |
2 files changed, 2 insertions, 66 deletions
diff --git a/railties/lib/rails/engine/commands.rb b/railties/lib/rails/engine/commands.rb index dfbeea36b8..a23ae44b0b 100644 --- a/railties/lib/rails/engine/commands.rb +++ b/railties/lib/rails/engine/commands.rb @@ -1,6 +1,4 @@ -require "rails/engine/commands_tasks" - -ARGV << "--help" if ARGV.empty? +require "rails/command" aliases = { "g" => "generate", @@ -11,4 +9,4 @@ aliases = { command = ARGV.shift command = aliases[command] || command -Rails::Engine::CommandsTasks.new(ARGV).run_command!(command) +Rails::Command.invoke command, ARGV diff --git a/railties/lib/rails/engine/commands_tasks.rb b/railties/lib/rails/engine/commands_tasks.rb deleted file mode 100644 index d6effdb732..0000000000 --- a/railties/lib/rails/engine/commands_tasks.rb +++ /dev/null @@ -1,62 +0,0 @@ -require "rails/commands/rake_proxy" -require "rails/commands/common_commands_tasks" -require "active_support/core_ext/string/strip" - -module Rails - class Engine - class CommandsTasks # :nodoc: - include Rails::RakeProxy - include Rails::CommonCommandsTasks - - attr_reader :argv - - def initialize(argv) - @argv = argv - end - - private - - def commands - formatted_rake_tasks - end - - def command_whitelist - %w(generate destroy version help test) - end - - def help_message - <<-EOT.strip_heredoc - Usage: rails COMMAND [ARGS] - - The common Rails commands available for engines are: - generate Generate new code (short-cut alias: "g") - destroy Undo code generated with "generate" (short-cut alias: "d") - test Run tests (short-cut alias: "t") - - All commands can be run with -h for more information. - - If you want to run any commands that need to be run in context - of the application, like `rails server` or `rails console`, - you should do it from application's directory (typically test/dummy). - - In addition to those commands, there are: - EOT - end - - def require_application_and_environment! - require ENGINE_PATH - end - - def load_tasks - Rake.application.init("rails") - Rake.application.load_rakefile - end - - def load_generators - engine = ::Rails::Engine.find(ENGINE_ROOT) - Rails::Generators.namespace = engine.railtie_namespace - engine.load_generators - end - end - end -end |