Rails::Command (original) (raw)
Namespace
- MODULE Rails::Command::Actions
- MODULE Rails::Command::App
- MODULE Rails::Command::Db
- MODULE Rails::Command::Helpers
- CLASS Rails::Command::Base
- CLASS Rails::Command::UnusedRoutesCommand
Methods
C
F
I
L
R
Constants
HELP_MAPPINGS | = | %w(-h -? --help).to_set |
---|---|---|
VERSION_MAPPINGS | = | %w(-v --version).to_set |
Class Public methods
invoke(full_namespace, args = [], **config)Link
Receives a namespace, arguments, and the behavior to invoke the command.
def invoke(full_namespace, args = [], **config) args = ["--help"] if rails_new_with_no_path?(args)
full_namespace = full_namespace.to_s namespace, command_name = split_namespace(full_namespace) command = find_by_namespace(namespace, command_name)
with_argv(args) do if command && command.all_commands[command_name] command.perform(command_name, args, config) else invoke_rake(full_namespace, args, config) end end rescue UnrecognizedCommandError => error if error.name == full_namespace && command && command_name == full_namespace command.perform("help", [], config) else puts error.detailed_message end exit(1) end
root()Link
Returns the root of the Rails engine or app running the command.
def root if defined?(ENGINE_ROOT) Pathname.new(ENGINE_ROOT) else application_root end end
Class Private methods
command_type()Link
def command_type @command_type ||= "command" end
file_lookup_paths()Link
def file_lookup_paths @file_lookup_paths ||= [ "{#{lookup_paths.join(',')}}", "**", "*_command.rb" ] end
lookup_paths()Link
def lookup_paths @lookup_paths ||= %w( rails/commands commands ) end