Class: DeployConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/heroploy/config/deploy_config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#environmentsObject

Returns the value of attribute environments.



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

def environments
  @environments
end

Class Method Details

.loadObject



21
22
23
# File 'lib/heroploy/config/deploy_config.rb', line 21

def self.load
  DeployConfig.parse(YAML::load(File.open('config/heroploy.yml')))
end

.parse(attrs) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/heroploy/config/deploy_config.rb', line 10

def self.parse(attrs)
  config = DeployConfig.new
  
  config.environments = [] 
  attrs['environments'].each do |name, attrs|
    config.environments << EnvConfig.parse(name, attrs)
  end
  
  config
end

Instance Method Details

#[](env_name) ⇒ Object



6
7
8
# File 'lib/heroploy/config/deploy_config.rb', line 6

def [](env_name)
  environments.select{ |env_config| env_config.name == env_name}.first
end