Module: Relish::Command

Extended by:
Helpers
Defined in:
lib/relish/command.rb,
lib/relish/commands/dsl.rb,
lib/relish/commands/base.rb,
lib/relish/commands/help.rb,
lib/relish/commands/push.rb,
lib/relish/param_methods.rb,
lib/relish/commands/collab.rb,
lib/relish/commands/config.rb,
lib/relish/commands/projects.rb,
lib/relish/commands/versions.rb,
lib/relish/commands/dsl/option.rb,
lib/relish/commands/dsl/command.rb,
lib/relish/commands/dsl/help_text.rb,
lib/relish/commands/dsl/context_class.rb

Defined Under Namespace

Modules: Dsl, ParamMethods Classes: Base, Collab, Config, Help, Projects, Push, Versions

Class Method Summary collapse

Methods included from Helpers

error

Class Method Details

.get_command_and_method(command, args) ⇒ Object



26
27
28
29
30
31
# File 'lib/relish/command.rb', line 26

def get_command_and_method(command, args)
  command_class, method = command.split(':')
  return get_command(command_class.capitalize), get_method(method)
rescue NameError
  error :unknown_command
end

.run(command, args) ⇒ Object



21
22
23
24
# File 'lib/relish/command.rb', line 21

def run(command, args)
  command_class, method = get_command_and_method(command, args)      
  command_class.new(args).send(method)
end