5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/dot_files/dispatch.rb', line 5
def run(command, args = [])
command = 'help' if command.nil?
command = command.to_sym
if DotFiles::DSL.commands[command]
if args.size < DotFiles::DSL.commands[command][:required_args]
puts "usage: #{DotFiles::DSL.commands[command][:usage]}"
else
DotFiles::DSL.commands[command][:block].call(*args)
end
else
puts "Command not found. Check 'deploy help' for full information."
end
rescue DotFiles::Errors::AccessDenied
puts "Access Denied. The username & API key stored for your account was invalid. Have you run 'dotfiles setup' on this computer?"
Process.exit(1)
rescue DotFiles::Error
puts "An error occured with your request."
Process.exit(1)
end
|