Class: Rundock::CLI

Inherits:
Thor show all
Defined in:
lib/rundock/cli.rb

Constant Summary collapse

DEFAULT_SCENARIO_FILE_PATH =
'./scenario.yml'
DEFAULT_SSH_OPTIONS_DEFAULT_FILE_PATH =
'./default_ssh.yml'
DEFAULT_HOSTGROUP_FILE_PATH =
'./hostgroup.yml'

Instance Method Summary collapse

Constructor Details

#initialize(args, opts, config) ⇒ CLI



14
15
16
17
18
19
20
# File 'lib/rundock/cli.rb', line 14

def initialize(args, opts, config)
  super(args, opts, config)

  Rundock::Logger.level = ::Logger.const_get(options[:log_level].upcase)
  Rundock::Logger.formatter.colored = options[:color]
  Rundock::Logger.formatter.show_header = options[:header]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(command, *args) ⇒ Object



60
61
62
# File 'lib/rundock/cli.rb', line 60

def method_missing(command, *args)
  help
end

Instance Method Details

#do(*scenario_file_path) ⇒ Object



33
34
35
36
37
38
# File 'lib/rundock/cli.rb', line 33

def do(*scenario_file_path)
  scenario_file_path = [DEFAULT_SCENARIO_FILE_PATH] if scenario_file_path.empty?
  opts = { :scenario => scenario_file_path[0] }

  Runner.run(opts.merge(options.deep_symbolize_keys))
end

#sshObject



54
55
56
57
58
# File 'lib/rundock/cli.rb', line 54

def ssh
  opts = {}

  Runner.run(opts.merge(options.deep_symbolize_keys))
end

#versionObject



23
24
25
# File 'lib/rundock/cli.rb', line 23

def version
  puts "#{Rundock::VERSION}"
end