Class: Bard::CI::Runner
- Inherits:
-
Struct
- Object
- Struct
- Bard::CI::Runner
- Includes:
- Retryable
- Defined in:
- lib/bard/plugins/deploy/ci/runner.rb
Direct Known Subclasses
Constant Summary
Constants included from Retryable
Retryable::INITIAL_DELAY, Retryable::MAX_RETRIES
Class Attribute Summary collapse
-
.runners ⇒ Object
readonly
Returns the value of attribute runners.
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#sha ⇒ Object
Returns the value of attribute sha.
Class Method Summary collapse
- .[](name) ⇒ Object
-
.default ⇒ Object
Returns the last registered runner (most recently loaded wins).
- .inherited(subclass) ⇒ Object
Instance Method Summary collapse
Methods included from Retryable
Class Attribute Details
.runners ⇒ Object (readonly)
Returns the value of attribute runners.
12 13 14 |
# File 'lib/bard/plugins/deploy/ci/runner.rb', line 12 def runners @runners end |
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch
6 7 8 |
# File 'lib/bard/plugins/deploy/ci/runner.rb', line 6 def branch @branch end |
#project_name ⇒ Object
Returns the value of attribute project_name
6 7 8 |
# File 'lib/bard/plugins/deploy/ci/runner.rb', line 6 def project_name @project_name end |
#sha ⇒ Object
Returns the value of attribute sha
6 7 8 |
# File 'lib/bard/plugins/deploy/ci/runner.rb', line 6 def sha @sha end |
Class Method Details
.[](name) ⇒ Object
20 21 22 |
# File 'lib/bard/plugins/deploy/ci/runner.rb', line 20 def [](name) runners[name.to_sym] end |
.default ⇒ Object
Returns the last registered runner (most recently loaded wins)
25 26 27 |
# File 'lib/bard/plugins/deploy/ci/runner.rb', line 25 def default runners.values.last end |
.inherited(subclass) ⇒ Object
14 15 16 17 18 |
# File 'lib/bard/plugins/deploy/ci/runner.rb', line 14 def inherited(subclass) super name = extract_runner_name(subclass) runners[name] = subclass if name end |
Instance Method Details
#resume ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/bard/plugins/deploy/ci/runner.rb', line 53 def resume saved_state = state.load raise "No saved CI state found for #{project_name}. Start a new build with 'bard ci'." if saved_state.nil? restore_state(saved_state) poll_until_complete { |elapsed, last_time| yield elapsed, last_time } state.delete success? end |
#run ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/bard/plugins/deploy/ci/runner.rb', line 40 def run start @start_time = Time.new.to_i @last_time_elapsed = get_last_time_elapsed save_state wait_until_started poll_until_complete { |elapsed, last_time| yield elapsed, last_time } state.delete success? end |