Class: Kitsune::Kit::Workflows::BuildPlan
- Defined in:
- lib/kitsune/kit/workflows/build_plan.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(config:, operations:, event_bus: Events::NullBus.new, clock: Clock.new) ⇒ BuildPlan
constructor
A new instance of BuildPlan.
Constructor Details
#initialize(config:, operations:, event_bus: Events::NullBus.new, clock: Clock.new) ⇒ BuildPlan
Returns a new instance of BuildPlan.
11 12 13 14 |
# File 'lib/kitsune/kit/workflows/build_plan.rb', line 11 def initialize(config:, operations:, event_bus: Events::NullBus.new, clock: Clock.new) super(config: config, event_bus: event_bus, clock: clock) @operations = operations end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/kitsune/kit/workflows/build_plan.rb', line 16 def call started_at = monotonic_time emit("run_started", command: "plan", environment: config.environment) changes = @operations.map(&:plan) plan = Plan.new(environment: config.environment, changes: changes) emit( "plan_built", changed_count: plan.changed_count, unchanged_count: plan.changes.length - plan.changed_count, destructive: plan.destructive? ) emit("run_finished", status: "success", duration_ms: elapsed_ms(started_at)) Result.success(plan, metadata: { run_id: run_id }) end |