Class: Heroku::Config

Inherits:
Hash
  • Object
show all
Defined in:
lib/heroku/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



6
7
8
9
# File 'lib/heroku/config.rb', line 6

def initialize(options = {})
  @app = options[:app]
  @logger = options[:logger]
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



4
5
6
# File 'lib/heroku/config.rb', line 4

def app
  @app
end

#loggerObject

Returns the value of attribute logger.



4
5
6
# File 'lib/heroku/config.rb', line 4

def logger
  @logger
end

Instance Method Details

#reload!Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/heroku/config.rb', line 11

def reload!
  clear
  cmd = cmdline
  Heroku::Executor.run cmd, { :logger => logger } do |line|
    logger.debug "< #{line}" if logger
    parts = line.split "=", 2
    raise Heroku::Commander::Errors::UnexpectedOutputError.new({
      :cmd => cmd,
      :line => line
    }) if parts.size != 2
    self[parts[0].strip] = parts[1].strip
  end
  self
end