Sha256: c833c065b6d3e1c7908a9bf7cfa0bd003ce7999a6a9d8fe35d19c8ade787b398
Contents?: true
Size: 982 Bytes
Versions: 3
Compression:
Stored size: 982 Bytes
Contents
require 'relish' require 'relish/helpers' require 'relish/commands/base' require 'relish/commands/collab' require 'relish/commands/config' require 'relish/commands/help' require 'relish/commands/projects' require 'relish/commands/push' module Relish module Command class << self include Relish::Helpers def run(command, args) command_class, method = get_command_and_method(command, args) command_class.new(args).send(method) end 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. Run 'relish help' for usage information." end private def get_command(command) Relish::Command.const_get(command) end def get_method(method) method || :default end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
relish-0.1.2 | lib/relish/command.rb |
relish-0.1.1 | lib/relish/command.rb |
relish-0.1.0 | lib/relish/command.rb |