Module: Rung::Definition::StepsDSL

Included in:
Operation
Defined in:
lib/rung/definition/steps_dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#steps_definitionArray<Rung::Definition::Step> (readonly)

List of steps definitions

Returns:


8
9
10
# File 'lib/rung/definition/steps_dsl.rb', line 8

def steps_definition
  @steps_definition ||= []
end

Instance Method Details

#add_generic_step(action, options = {}, &block) ⇒ Object

Generic method of creating a step. Shouldn't be used directly. Instead use more precise methods like #step or #failure.

Requires:

  • action or block - simple steps

  • both action and block - nested steps

Examples:

Simple step

add_generic_step MyStep.new
add_generic_step { ... }

Nested step

add_generic_step Wrapper do
  add_generic_step :inner_step
end

Step options

add_generic_step :my_step, fail_fast: true, run_on: :failure

Parameters:


30
31
32
33
# File 'lib/rung/definition/steps_dsl.rb', line 30

def add_generic_step(action, options = {}, &block)
  step = step_from_definition action, **options, &block
  steps_definition.push step
end

#always(*args, &block) ⇒ Object

Defines a step with run_on: :any, ignore_result: true

See Also:


54
55
56
# File 'lib/rung/definition/steps_dsl.rb', line 54

def always(*args, &block)
  add_step_from_args args, run_on: :any, ignore_result: true, &block
end

#failure(*args, &block) ⇒ Object

Defines a step with run_on: :failure, ignore_result: true

See Also:


48
49
50
# File 'lib/rung/definition/steps_dsl.rb', line 48

def failure(*args, &block)
  add_step_from_args args, run_on: :failure, ignore_result: true, &block
end

#step(*args, &block) ⇒ Object

See Also:


36
37
38
# File 'lib/rung/definition/steps_dsl.rb', line 36

def step(*args, &block)
  add_step_from_args args, &block
end

#tee(*args, &block) ⇒ Object

Defines a step with ignore_result: true

See Also:


42
43
44
# File 'lib/rung/definition/steps_dsl.rb', line 42

def tee(*args, &block)
  add_step_from_args args, ignore_result: true, &block
end