Module: Igniter::Contracts::Assembly::StepResultPack

Defined in:
lib/igniter/contracts/assembly/step_result_pack.rb

Class Method Summary collapse

Class Method Details

.install_into(kernel) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/igniter/contracts/assembly/step_result_pack.rb', line 21

def install_into(kernel)
  kernel.nodes.register(:step, NodeType.new(kind: :step, metadata: { category: :pipeline }))
  kernel.dsl_keywords.register(:step, step_keyword)
  kernel.validators.register(:step_dependencies, Execution::StepResultValidators.method(:validate_step_dependencies))
  kernel.validators.register(:step_callables, Execution::StepResultValidators.method(:validate_step_callables))
  kernel.runtime_handlers.register(:step, Execution::StepResultRuntime.method(:handle_step))
  kernel.diagnostics_contributors.register(:step_trace, Execution::StepResultDiagnostics)
  kernel
end

.manifestObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/igniter/contracts/assembly/step_result_pack.rb', line 9

def manifest
  PackManifest.new(
    name: :step_result,
    node_contracts: [PackManifest.node(:step)],
    registry_contracts: [
      PackManifest.validator(:step_dependencies),
      PackManifest.validator(:step_callables),
      PackManifest.diagnostic(:step_trace)
    ]
  )
end

.step_keywordObject



31
32
33
34
35
36
37
38
# File 'lib/igniter/contracts/assembly/step_result_pack.rb', line 31

def step_keyword
  DslKeyword.new(:step, lambda { |name, builder:, **attributes, &block|
    normalized_attributes = attributes.dup
    normalized_attributes[:callable] = normalized_attributes.delete(:call) if normalized_attributes.key?(:call)
    normalized_attributes[:callable] = block if block
    builder.add_operation(kind: :step, name: name, **normalized_attributes)
  })
end