Class: Borg::Configuration::Applications::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/borg/configuration/applications.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, namespace) ⇒ Application

Returns a new instance of Application.



33
34
35
36
37
38
# File 'lib/borg/configuration/applications.rb', line 33

def initialize(name, namespace)
  @execution_blocks = []
  @name = name
  @namespace = namespace
  @stages = {}
end

Instance Attribute Details

#execution_blocksObject

Returns the value of attribute execution_blocks.



29
30
31
# File 'lib/borg/configuration/applications.rb', line 29

def execution_blocks
  @execution_blocks
end

#nameObject (readonly)

Returns the value of attribute name.



31
32
33
# File 'lib/borg/configuration/applications.rb', line 31

def name
  @name
end

#stagesObject

Returns the value of attribute stages.



30
31
32
# File 'lib/borg/configuration/applications.rb', line 30

def stages
  @stages
end

Instance Method Details

#load_into(config) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/borg/configuration/applications.rb', line 40

def load_into(config)
  if config.respond_to?(:application)
    # Undefine the stage method now that the app:stage config is created
    config_metaclass = class << config; self; end
    config_metaclass.send(:undef_method, 'application')

    # Create a capistrano variable for stage
    config.instance_exec(@name, &(lambda { |name| set :application, name }))
  end
  @execution_blocks.each { |blk| config.load &blk }
end