class Heroploy::Config::DeploymentConfig

Attributes

environments[RW]
remote_configs[RW]
shared_env[RW]
travis_repo[RW]

Public Class Methods

load(filename = 'config/heroploy.yml') click to toggle source
# File lib/heroploy/config/deployment_config.rb, line 29
def self.load(filename = 'config/heroploy.yml')
  DeploymentConfig.new(YAML::load(File.open(filename)))
end
new(attrs = {}) click to toggle source
# File lib/heroploy/config/deployment_config.rb, line 18
def initialize(attrs = {})
  @travis_repo = attrs['travis_repo']
  unless attrs['environments'].nil?
    @environments = attrs['environments'].map { |name, env_attrs| Environment.new(name, env_attrs) }
  end
  unless attrs['load_configs'].nil?
    @remote_configs = attrs['load_configs'].map { |name, remote_config_attrs| RemoteConfig.new(name, remote_config_attrs) }
  end
  @shared_env = SharedEnv.new(attrs['common'])
end

Public Instance Methods

[](env_name) click to toggle source
# File lib/heroploy/config/deployment_config.rb, line 14
def [](env_name)
  environments.select{ |env| env.name == env_name }.first
end
merge_config(deployment_config) click to toggle source
# File lib/heroploy/config/deployment_config.rb, line 33
def merge_config(deployment_config)
  deployment_config.environments.each do |env_config|
    self[env_config.name].variables.merge!(env_config.variables)
  end
end