Class: Borg::Configuration::Stages::Stage
- Inherits:
-
Object
- Object
- Borg::Configuration::Stages::Stage
- Defined in:
- lib/borg/configuration/stages.rb
Instance Attribute Summary collapse
-
#execution_blocks ⇒ Object
Returns the value of attribute execution_blocks.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(name, parent) ⇒ Stage
constructor
A new instance of Stage.
- #load_into(config) ⇒ Object
-
#name ⇒ Object
TODO: We might want to name this differently.
Constructor Details
#initialize(name, parent) ⇒ Stage
Returns a new instance of Stage.
28 29 30 31 32 |
# File 'lib/borg/configuration/stages.rb', line 28 def initialize(name, parent) @execution_blocks = [] @name = name @parent = parent end |
Instance Attribute Details
#execution_blocks ⇒ Object
Returns the value of attribute execution_blocks.
20 21 22 |
# File 'lib/borg/configuration/stages.rb', line 20 def execution_blocks @execution_blocks end |
#parent ⇒ Object
Returns the value of attribute parent.
21 22 23 |
# File 'lib/borg/configuration/stages.rb', line 21 def parent @parent end |
Instance Method Details
#load_into(config) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/borg/configuration/stages.rb', line 34 def load_into(config) if config.respond_to?(:stage) # Undefine the stage method now that the app:stage config is created = class << config; self; end .send(:undef_method, 'stage') # Create a capistrano variable for stage config.instance_exec(@name, &(lambda { |name| set :stage, name })) end parent.load_into(config) @execution_blocks.each { |blk| config.load(&blk) } end |
#name ⇒ Object
TODO: We might want to name this differently
24 25 26 |
# File 'lib/borg/configuration/stages.rb', line 24 def name "#{parent.name}:#{@name}" end |