Skip to content

Commit

Permalink
extract create_workflow to reduce Cli#run complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrock committed Oct 8, 2024
1 parent a5b1006 commit f05c3cb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/floe/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def run(args = ARGV)

workflows =
workflows_inputs.each_slice(2).map do |workflow, input|
context = Floe::Workflow::Context.new(opts[:context], :input => input, :credentials => credentials)
Floe::Workflow.load(workflow, context)
create_workflow(workflow, opts[:context], input, credentials)
end

output_streams = create_loggers(workflows, opts[:segment_output])
Expand Down Expand Up @@ -92,6 +91,11 @@ def parse_options!(args)
return workflows_inputs, opts
end

def create_workflow(workflow, context_payload, input, credentials)
context = Floe::Workflow::Context.new(context_payload, :input => input, :credentials => credentials)
Floe::Workflow.load(workflow, context)
end

def create_loggers(workflows, segment_output)
if workflows.size == 1 || !segment_output
# no extra work necessary
Expand Down

0 comments on commit f05c3cb

Please sign in to comment.