Class: Tug::ConfigFile

Inherits:
Object
  • Object
show all
Defined in:
lib/tug/config/config_file.rb

Direct Known Subclasses

MissingConfigFile

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ ConfigFile

Returns a new instance of ConfigFile.



17
18
19
20
21
# File 'lib/tug/config/config_file.rb', line 17

def initialize(path)
  config = YAML::load_file(path)
  @project = Tug::Project.new(config['project'])
  @keychain = Tug::Keychain.keychain(config['keychain'])
end

Instance Attribute Details

#keychainObject (readonly)

Returns the value of attribute keychain.



5
6
7
# File 'lib/tug/config/config_file.rb', line 5

def keychain
  @keychain
end

#projectObject (readonly)

Returns the value of attribute project.



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

def project
  @project
end

Class Method Details

.config_file(path = default_path) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/tug/config/config_file.rb', line 8

def config_file(path=default_path)
  if path and File.file?(path)
    Tug::ConfigFile.new(path)
  else
    Tug::MissingConfigFile.new
  end
end