Class: Vagabond::Commands

Inherits:
Object
  • Object
show all
Includes:
Mixlib::CLI
Defined in:
lib/vagabond/commands.rb

Constant Summary collapse

DEFAULT_ACTIONS =
Actions.constants.map do |konst|
  const = Actions.const_get(konst)
  const.public_instance_methods(false) if const.is_a?(Module)
end.flatten.sort

Instance Method Summary collapse

Instance Method Details

#run!(argv) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/vagabond/commands.rb', line 69

def run!(argv)
  # Turn off Chef logging since we will deal with
  # our own output
  Chef::Log.init('/dev/null')
  parse_options
  name_args = parse_options(argv)
  Config.merge!(config)
  Config[:debug] = STDOUT if Config[:debug]
  case name_args.first.to_s
  when 'server'
    Server.new(name_args.shift, name_args).send(:execute)
  when 'knife'
    Knife.new(name_args.shift, name_args).send(:execute)
  else
    Vagabond.new(name_args.shift, name_args).send(:execute)
  end
end