Sha256: 947c281ded179651e792c545bcdc09c79d3154504cee77e1024c76760ede758c
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require_relative 'context' require_relative 'steps_executor' module Nocode # Manages the lifecycle and executes a job. class JobExecutor PARAMETERS_KEY = 'parameters' REGISTERS_KEY = 'registers' STEPS_KEY = 'steps' attr_reader :yaml, :io def initialize(yaml, io: $stdout) @yaml = yaml.respond_to?(:read) ? yaml.read : yaml @yaml = YAML.safe_load(@yaml) || {} @io = io freeze end def execute steps = yaml[STEPS_KEY] || [] parameters = yaml[PARAMETERS_KEY] || {} registers = yaml[REGISTERS_KEY] || {} context = Context.new( io: io, parameters: parameters, registers: registers ) log_title(context) StepsExecutor.new(context: context, steps: steps).execute context.log("Ended: #{DateTime.now}") context.log_line context end private def log_title(context) context.log_line context.log('Nocode Execution') context.log("Started: #{DateTime.now}") context.log_line end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
nocode-0.0.10 | lib/nocode/job_executor.rb |
nocode-0.0.9 | lib/nocode/job_executor.rb |
nocode-0.0.8 | lib/nocode/job_executor.rb |
nocode-0.0.7 | lib/nocode/job_executor.rb |