Class: Volley::Dsl::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/volley/dsl/action.rb

Direct Known Subclasses

PullAction, PushAction, VolleyAction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}, &block) ⇒ Action

Returns a new instance of Action.



10
11
12
13
14
15
16
17
18
19
# File 'lib/volley/dsl/action.rb', line 10

def initialize(name, options={}, &block)
  @name = name.to_sym
  @stage = options.delete(:stage)
  @plan = options.delete(:plan)
  @block = block
  @options = {
  }.merge(options)
  raise "stage instance must be set" unless @stage
  raise "plan instance must be set" unless @plan
end

Instance Attribute Details

#planObject (readonly)

Returns the value of attribute plan.



5
6
7
# File 'lib/volley/dsl/action.rb', line 5

def plan
  @plan
end

Instance Method Details

#callObject



21
22
23
24
25
# File 'lib/volley/dsl/action.rb', line 21

def call
  return if @plan.stopped?
  Volley::Log.debug "## #{project.name}:#{@plan.name}[#{@stage}]##@name"
  self.instance_eval &@block if @block
end

#command(cmd) ⇒ Object



27
28
29
# File 'lib/volley/dsl/action.rb', line 27

def command(cmd)
  plan.shellout(cmd)
end