Class: Summon::CLI::Config

Inherits:
Object show all
Defined in:
lib/summon/cli.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



112
113
114
# File 'lib/summon/cli.rb', line 112

def initialize
  @clients = {}
end

Instance Attribute Details

#access_id(access_id) ⇒ Object (readonly)

Returns the value of attribute access_id.



110
111
112
# File 'lib/summon/cli.rb', line 110

def access_id
  @access_id
end

#secret_key(secret_key) ⇒ Object (readonly)

Returns the value of attribute secret_key.



110
111
112
# File 'lib/summon/cli.rb', line 110

def secret_key
  @secret_key
end

#url(url) ⇒ Object (readonly)

Returns the value of attribute url.



110
111
112
# File 'lib/summon/cli.rb', line 110

def url
  @url
end

Class Method Details

.loadObject



116
117
118
119
120
121
122
# File 'lib/summon/cli.rb', line 116

def self.load
  summonrc = "#{ENV['HOME']}/.summonrc"
  FileUtils.touch summonrc unless File.exists?(summonrc)        
  new.tap do |this|
    this.instance_eval(File.read(summonrc), summonrc, 1)
  end
end

Instance Method Details

#client_key(name) ⇒ Object



140
141
142
# File 'lib/summon/cli.rb', line 140

def client_key(name)              
  @clients[name.to_sym] || name
end

#clients(h) ⇒ Object



136
137
138
# File 'lib/summon/cli.rb', line 136

def clients(h)
  @clients = h
end

#optionsObject



144
145
146
# File 'lib/summon/cli.rb', line 144

def options
  {:url => @url, :access_id => @access_id, :secret_key => @secret_key}
end