Top Level Namespace

Defined Under Namespace

Modules: Dployr

Instance Method Summary collapse

Instance Method Details

#run(command, options, arg = nil) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/dployr/cli.rb', line 72

def run(command, options, arg = nil)
  begin
    cmd = Dployr::Commands.const_get command
    raise "Command not supported: #{command}" unless cmd
    if arg
      cmd.new options, arg
    else
      cmd.new options
    end
  rescue => e
    puts "Error: #{e}".red
    puts e.backtrace if e.backtrace and options[:debug]
    exit 1
  end
end