Top Level Namespace

Defined Under Namespace

Modules: Dployr

Instance Method Summary collapse

Instance Method Details

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



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dployr/cli.rb', line 8

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