Class: Textus::Workflow::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/workflow/runner.rb

Defined Under Namespace

Classes: Context

Instance Method Summary collapse

Constructor Details

#initialize(definition, container:, call:) ⇒ Runner

Returns a new instance of Runner.



25
26
27
28
29
30
31
# File 'lib/textus/workflow/runner.rb', line 25

def initialize(definition, container:, call:)
  @definition = definition
  @container  = container
  @call       = call
  @publisher  = Publisher.new(container: container, call: call)
  @step_executor = StepExecutor.new
end

Instance Method Details

#run(key) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/textus/workflow/runner.rb', line 33

def run(key)
  res = @container.manifest.resolver.resolve(key)
  ctx = Context.new(
    key: key,
    entry: res.entry,
    config: {}.freeze,
    lane: res.entry.lane.to_s,
    container: @container,
    call: @call,
  )
  data = @step_executor.execute(@definition.steps, ctx)
  @publisher.publish(key, data, ctx, @definition) if data
  data
end