Class: Henk::Step
- Inherits:
-
Object
- Object
- Henk::Step
- Defined in:
- lib/henk/step.rb
Instance Attribute Summary collapse
-
#image ⇒ Object
readonly
Returns the value of attribute image.
Instance Method Summary collapse
-
#after_wait(&block) ⇒ Object
called with container id (string) and exit code (numeric).
-
#initialize(henk, *args) ⇒ Step
constructor
A new instance of Step.
-
#on_bad_exit(&block) ⇒ Object
called with container id (string) and exit code (numeric).
- #perform! ⇒ Object
Constructor Details
#initialize(henk, *args) ⇒ Step
Returns a new instance of Step.
5 6 7 8 |
# File 'lib/henk/step.rb', line 5 def initialize(henk, *args) @henk = henk @arguments = args end |
Instance Attribute Details
#image ⇒ Object (readonly)
Returns the value of attribute image.
3 4 5 |
# File 'lib/henk/step.rb', line 3 def image @image end |
Instance Method Details
#after_wait(&block) ⇒ Object
called with container id (string) and exit code (numeric)
11 12 13 |
# File 'lib/henk/step.rb', line 11 def after_wait(&block) @after_wait_block = block end |
#on_bad_exit(&block) ⇒ Object
called with container id (string) and exit code (numeric)
16 17 18 |
# File 'lib/henk/step.rb', line 16 def on_bad_exit(&block) @bad_exit_block = block end |
#perform! ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/henk/step.rb', line 20 def perform! container = @henk.execute_for_word(*@arguments) return unless container container_exit = @henk.send(:while_container_running, container) do @henk.wait(container) end @after_wait_block.call(container, container_exit) if @after_wait_block unless container_exit.zero? block = @bad_exit_block || Proc.new do raise "Container #{container} exited with code #{container_exit}" end block.call(container, container_exit) end @image = @henk.commit(container) end |