Class: Volley::Dsl::VolleyAction

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

Instance Attribute Summary

Attributes inherited from Action

#plan

Instance Method Summary collapse

Methods inherited from Action

#call, #command

Constructor Details

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

Returns a new instance of VolleyAction.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/volley/dsl/volley_action.rb', line 6

def initialize(name, options={}, &block)
  @name = name.to_sym
  @stage = options.delete(:stage)
  @plan = options.delete(:plan)
  @run  = options.delete(:run)
  @desc = options.delete(:descriptor)
  @desc ||= @plan.args.descriptor
  @args = options.delete(:args)

  @options = {
  }.merge(options)

  raise "stage instance must be set" unless @stage
  raise "plan instance must be set" unless @plan

  @block = Proc.new do
    desc = @desc || @plan.args.descriptor
    plan = @run
    (runpr, plan) = plan.split(/\:/) if @run =~ /\:/
    (project, branch, version) = desc.get
    Volley.process("#{runpr}:#{plan}", "#{project}@#{branch}:#{version}", args.marshal_dump)
  end
end