Class: EY::EYRC

Inherits:
Object
  • Object
show all
Defined in:
lib/engineyard/eyrc.rb

Constant Summary collapse

DEFAULT_PATH =
"~/.eyrc"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ EYRC

Returns a new instance of EYRC.



11
12
13
# File 'lib/engineyard/eyrc.rb', line 11

def initialize(path)
  @path = Pathname.new(path).expand_path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/engineyard/eyrc.rb', line 3

def path
  @path
end

Class Method Details

.loadObject



7
8
9
# File 'lib/engineyard/eyrc.rb', line 7

def self.load
  new(ENV['EYRC'] || DEFAULT_PATH)
end

Instance Method Details

#api_tokenObject



23
24
25
# File 'lib/engineyard/eyrc.rb', line 23

def api_token
  self['api_token']
end

#api_token=(token) ⇒ Object



27
28
29
# File 'lib/engineyard/eyrc.rb', line 27

def api_token=(token)
  self['api_token'] = token
end

#delete_api_tokenObject



19
20
21
# File 'lib/engineyard/eyrc.rb', line 19

def delete_api_token
  delete('api_token')
end

#exist?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/engineyard/eyrc.rb', line 15

def exist?
  path.exist?
end