Class: DeploymentTask::Runner
- Inherits:
-
Object
- Object
- DeploymentTask::Runner
- Defined in:
- lib/deployment_task/runner.rb
Instance Attribute Summary collapse
-
#dry_run ⇒ Object
readonly
Returns the value of attribute dry_run.
-
#execution_id ⇒ Object
readonly
Returns the value of attribute execution_id.
-
#phase ⇒ Object
readonly
Returns the value of attribute phase.
Instance Method Summary collapse
-
#initialize(phase:, dry_run: false) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(phase:, dry_run: false) ⇒ Runner
Returns a new instance of Runner.
9 10 11 12 13 14 |
# File 'lib/deployment_task/runner.rb', line 9 def initialize(phase:, dry_run: false) @phase = phase.to_sym @execution_id = SecureRandom.uuid @dry_run = dry_run @results = { total: 0, succeeded: 0, failed: 0, skipped: 0 } end |
Instance Attribute Details
#dry_run ⇒ Object (readonly)
Returns the value of attribute dry_run.
7 8 9 |
# File 'lib/deployment_task/runner.rb', line 7 def dry_run @dry_run end |
#execution_id ⇒ Object (readonly)
Returns the value of attribute execution_id.
7 8 9 |
# File 'lib/deployment_task/runner.rb', line 7 def execution_id @execution_id end |
#phase ⇒ Object (readonly)
Returns the value of attribute phase.
7 8 9 |
# File 'lib/deployment_task/runner.rb', line 7 def phase @phase end |
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/deployment_task/runner.rb', line 16 def run task_classes = Registry.tasks_for_phase(phase) logger = DeploymentTask::TaskLogger.new(execution_id: execution_id) logger.log_phase_start(phase: phase, task_count: task_classes.size, dry_run: dry_run) if dry_run run_dry(task_classes, logger) else run_live(task_classes, logger) end logger.log_phase_summary(phase: phase, results: @results) @results[:failed].zero? end |