Class: Heroploy::Config::DeploymentConfig
- Inherits:
-
Object
- Object
- Heroploy::Config::DeploymentConfig
- Defined in:
- lib/heroploy/config/deployment_config.rb
Instance Attribute Summary collapse
-
#environments ⇒ Object
Returns the value of attribute environments.
-
#remote_configs ⇒ Object
Returns the value of attribute remote_configs.
-
#shared_env ⇒ Object
Returns the value of attribute shared_env.
-
#travis_repo ⇒ Object
Returns the value of attribute travis_repo.
Class Method Summary collapse
Instance Method Summary collapse
- #[](env_name) ⇒ Object
-
#initialize(attrs = {}) ⇒ DeploymentConfig
constructor
A new instance of DeploymentConfig.
- #merge_config(deployment_config) ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ DeploymentConfig
Returns a new instance of DeploymentConfig.
18 19 20 21 22 23 24 25 26 27 |
# 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 |
Instance Attribute Details
#environments ⇒ Object
Returns the value of attribute environments.
10 11 12 |
# File 'lib/heroploy/config/deployment_config.rb', line 10 def environments @environments end |
#remote_configs ⇒ Object
Returns the value of attribute remote_configs.
12 13 14 |
# File 'lib/heroploy/config/deployment_config.rb', line 12 def remote_configs @remote_configs end |
#shared_env ⇒ Object
Returns the value of attribute shared_env.
11 12 13 |
# File 'lib/heroploy/config/deployment_config.rb', line 11 def shared_env @shared_env end |
#travis_repo ⇒ Object
Returns the value of attribute travis_repo.
9 10 11 |
# File 'lib/heroploy/config/deployment_config.rb', line 9 def travis_repo @travis_repo end |
Class Method Details
.load(filename = 'config/heroploy.yml') ⇒ Object
29 30 31 |
# File 'lib/heroploy/config/deployment_config.rb', line 29 def self.load(filename = 'config/heroploy.yml') DeploymentConfig.new(YAML::load(File.open(filename))) end |
Instance Method Details
#[](env_name) ⇒ Object
14 15 16 |
# 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) ⇒ Object
33 34 35 36 37 |
# 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 |