Class: VzcdnApp
Instance Attribute Summary
Attributes inherited from Command
#desc, #name
Instance Method Summary
collapse
#config_dir, #config_file, #mkdir, #param, #user_file
Methods inherited from Command
#add_arg, #add_cmd, #add_flow, #add_flow_from_usage, #add_input, #add_option, #command_name?, #flow_passes_parse, #flow_passes_preconditions, #get_args_used, #initialize, #option_help_string, #run, #show_help, #show_help_option
Constructor Details
This class inherits a constructor from Command
Instance Method Details
#add_options ⇒ Object
12
13
14
15
|
# File 'lib/vzcdn.rb', line 12
def add_options
add_option({ short_name: 'v', long_name: 'version', method: :print_version, takes_value: false})
add_option({ short_name: 'd', long_name: 'debug', method: :set_debug, takes_value: false})
end
|
#create_args ⇒ Object
39
40
41
42
|
# File 'lib/vzcdn.rb', line 39
def create_args
add_cmd(Zone, "zone", "dns zone command")
add_cmd(ConfigCommand, "config", "configuration control")
end
|
#create_flows ⇒ Object
44
45
46
47
|
# File 'lib/vzcdn.rb', line 44
def create_flows
add_flow_from_usage("zone")
add_flow_from_usage("config")
end
|
#execute(args, subargs) ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'lib/vzcdn.rb', line 49
def execute(args, subargs)
command = args["command"]
if command
command.run(subargs)
else
puts "command is nil"
end
end
|
#init ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/vzcdn.rb', line 17
def init
if param("http-save-file") != ""
$http_save_file = param("http-save-file")
end
if param("mock-env") != ""
$mock_env = param("mock-env")
end
end
|
#print_version ⇒ Object
26
27
28
29
|
# File 'lib/vzcdn.rb', line 26
def print_version
puts "vzcdn Version:" + Vzcdn::VERSION
exit
end
|
#set_debug ⇒ Object
35
36
37
|
# File 'lib/vzcdn.rb', line 35
def set_debug
$debug += 1
end
|
#set_http_file(file) ⇒ Object
31
32
33
|
# File 'lib/vzcdn.rb', line 31
def set_http_file(file)
$http_save_file = file
end
|