Module: SSC::Handler::Helper::ClassMethods

Defined in:
lib/handlers/helper.rb

Instance Method Summary collapse

Instance Method Details

#allow_remote_optionObject



39
40
41
# File 'lib/handlers/helper.rb', line 39

def allow_remote_option
  method_option :remote, :type => :boolean, :default => false
end

#get_configObject



43
44
45
46
47
48
49
# File 'lib/handlers/helper.rb', line 43

def get_config
  begin
    YAML::load File.read(File.join('.', '.sscrc'))
  rescue Errno::ENOENT
    return {'username' => nil, 'password' => nil, 'appliance_id' => nil}
  end
end

#require_appliance_idObject



26
27
28
29
30
31
# File 'lib/handlers/helper.rb', line 26

def require_appliance_id
  require_authorization
  config= get_config
  method_option :appliance_id, :type => :numeric, :required => true,
    :default => config["appliance_id"]
end

#require_authorizationObject



16
17
18
19
20
21
22
23
24
# File 'lib/handlers/helper.rb', line 16

def require_authorization
  config= get_config
  method_option :username, :type => :string, :required => true, 
    :default => config["username"], :aliases => "-u"
  method_option :password, :type => :string, :required => true, 
    :default => config["password"], :aliases => "-p"
  method_option :proxy, :type => :string
  method_option :timeout, :type => :string
end

#require_build_idObject



33
34
35
36
37
# File 'lib/handlers/helper.rb', line 33

def require_build_id
  config= get_config
  method_option :build_id, :type => :numeric, :required => true,
    :default => config["latest_build_id"]
end