Class: Bosh::Deployer::DeployerRenderer
- Inherits:
-
Object
- Object
- Bosh::Deployer::DeployerRenderer
- Defined in:
- lib/bosh/deployer/deployer_renderer.rb
Instance Method Summary collapse
- #duration ⇒ Object
- #enter_stage(stage, total) ⇒ Object
- #finish(state) ⇒ Object
-
#initialize(event_log_renderer) ⇒ DeployerRenderer
constructor
A new instance of DeployerRenderer.
- #update(state, task) ⇒ Object
Constructor Details
#initialize(event_log_renderer) ⇒ DeployerRenderer
3 4 5 6 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 3 def initialize(event_log_renderer) @event_log_renderer = event_log_renderer @index = 0 end |
Instance Method Details
#duration ⇒ Object
36 37 38 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 36 def duration @event_log_renderer.duration end |
#enter_stage(stage, total) ⇒ Object
12 13 14 15 16 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 12 def enter_stage(stage, total) @stage = stage @total = total @index = 0 end |
#finish(state) ⇒ Object
8 9 10 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 8 def finish(state) @event_log_renderer.finish(state) end |
#update(state, task) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bosh/deployer/deployer_renderer.rb', line 18 def update(state, task) event = { 'time' => Time.now.to_i, 'stage' => @stage, 'task' => task, 'tags' => [], 'index' => @index + 1, 'total' => @total, 'state' => state.to_s, 'progress' => state == :finished ? 100 : 0, } @event_log_renderer.add_output(JSON.generate(event)) @event_log_renderer.refresh @index += 1 if state == :finished end |