Class: CapistranoDeploy::Multistage::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano-deploy/multistage.rb

Overview

Handles multistage configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Config

Returns a new instance of Config.



50
51
52
53
# File 'lib/capistrano-deploy/multistage.rb', line 50

def initialize(config)
  @config = config
  @stages = []
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



47
48
49
# File 'lib/capistrano-deploy/multistage.rb', line 47

def config
  @config
end

#stagesObject (readonly)

Returns the value of attribute stages.



48
49
50
# File 'lib/capistrano-deploy/multistage.rb', line 48

def stages
  @stages
end

Instance Method Details

#inferred_stageObject



59
60
61
62
63
64
# File 'lib/capistrano-deploy/multistage.rb', line 59

def inferred_stage
  if config.using_recipe?(:git)
    branch = config.local_branch
    stages.find { |stage| stage.options[:branch].to_s == branch }
  end
end

#stage(name, options = {}) ⇒ Object



55
56
57
# File 'lib/capistrano-deploy/multistage.rb', line 55

def stage(name, options={})
  stages << Stage.new(name, options)
end