Class: Travis::Deploy::Config::Builder
- Inherits:
-
Object
- Object
- Travis::Deploy::Config::Builder
- Defined in:
- lib/travis/deploy/config/builder.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#keychain ⇒ Object
readonly
Returns the value of attribute keychain.
Instance Method Summary collapse
- #build ⇒ Object
- #env_config ⇒ Object
-
#initialize(keychain, env) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(keychain, env) ⇒ Builder
Returns a new instance of Builder.
5 6 7 8 9 |
# File 'lib/travis/deploy/config/builder.rb', line 5 def initialize(keychain, env) @keychain = keychain @config = YAML.load(keychain.source) @env = env end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/travis/deploy/config/builder.rb', line 3 def config @config end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
3 4 5 |
# File 'lib/travis/deploy/config/builder.rb', line 3 def env @env end |
#keychain ⇒ Object (readonly)
Returns the value of attribute keychain.
3 4 5 |
# File 'lib/travis/deploy/config/builder.rb', line 3 def keychain @keychain end |
Instance Method Details
#build ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/travis/deploy/config/builder.rb', line 11 def build includes = [] includes << config.delete('includes') if config['includes'] includes << env_config.delete('includes') if env_config['includes'] includes.flatten! result = env_config includes.each do |name| include_config = keychain.includes(name) result.merge! include_config['all'] || {} result.merge! include_config[env] || {} end result end |
#env_config ⇒ Object
29 30 31 |
# File 'lib/travis/deploy/config/builder.rb', line 29 def env_config config.fetch env, {} end |