Class: ConfigInit
- Includes:
- ConfigReader
- Defined in:
- lib/clui_config.rb
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
Methods included from ConfigReader
#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, #add_options, #command_name?, #flow_passes_parse, #flow_passes_preconditions, #get_args_used, #init, #initialize, #option_help_string, #run, #show_help, #show_help_option
Constructor Details
This class inherits a constructor from Command
Instance Method Details
#create_args ⇒ Object
9 10 11 12 |
# File 'lib/clui_config.rb', line 9 def create_args add_arg("acct-num", "EdgeCast account number", /[[:alnum:]]+/) add_arg("token", "Web Services REST API Token (see my.edgecast.com)", /.*/) end |
#create_flows ⇒ Object
14 15 16 |
# File 'lib/clui_config.rb', line 14 def create_flows add_flow_from_usage("<acct-num> <token>") end |
#execute(args, ignore) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/clui_config.rb', line 18 def execute(args, ignore) handler = ConfigHandler.new handler.set("acct-num", args["acct-num"]) handler.set("token", args["token"]) handler.set("rest_base_url", "https://api.edgecast.com/v2/") print_cfg = { "zone" => ["ZoneId", "DomainName", "ZoneType", "Status", "Version", "Records", "FailoverGroups", "LoadBalancingGroups"], "zonelist" => ["DomainName", "ZoneId", "Status"] } File.open(config_file("print.cfg"), "w").write(JSON.pretty_generate print_cfg) end |