Class: LocalCI::ExecContext
- Inherits:
-
Object
- Object
- LocalCI::ExecContext
- Defined in:
- lib/local_ci/exec_context.rb
Instance Attribute Summary collapse
-
#flow ⇒ Object
readonly
Returns the value of attribute flow.
Instance Method Summary collapse
-
#initialize(flow:) ⇒ ExecContext
constructor
A new instance of ExecContext.
- #job(name, *args, &block) ⇒ Object
- #run(command, *args) ⇒ Object
- #setup(heading = nil, parallel: false, &block) ⇒ Object
- #teardown(heading = nil, parallel: false, &block) ⇒ Object
Constructor Details
#initialize(flow:) ⇒ ExecContext
Returns a new instance of ExecContext.
5 6 7 |
# File 'lib/local_ci/exec_context.rb', line 5 def initialize(flow:) @flow = flow end |
Instance Attribute Details
#flow ⇒ Object (readonly)
Returns the value of attribute flow.
3 4 5 |
# File 'lib/local_ci/exec_context.rb', line 3 def flow @flow end |
Instance Method Details
#job(name, *args, &block) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/local_ci/exec_context.rb', line 13 def job(name, *args, &block) LocalCI::Job.new( flow: @flow, name: name, command: args, block: block ) end |
#run(command, *args) ⇒ Object
9 10 11 |
# File 'lib/local_ci/exec_context.rb', line 9 def run(command, *args) LocalCI::Helper.runner.run command, *args end |
#setup(heading = nil, parallel: false, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/local_ci/exec_context.rb', line 22 def setup(heading = nil, parallel: false, &block) heading ||= "#{@flow.heading} - Setup" LocalCI::Flow.new( name: "#{@flow.task}:setup", heading: heading, parallel: parallel, actions: false, block: block ) end |
#teardown(heading = nil, parallel: false, &block) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/local_ci/exec_context.rb', line 33 def teardown(heading = nil, parallel: false, &block) heading ||= "#{@flow.heading} - Teardown" LocalCI::Flow.new( name: "#{@flow.task}:teardown", heading: heading, parallel: parallel, actions: false, block: block ) end |