lib/eco/cli/config/default/workflow.rb in eco-helpers-1.5.1 vs lib/eco/cli/config/default/workflow.rb in eco-helpers-1.5.2
- old
+ new
@@ -2,52 +2,56 @@
ASSETS.config.workflow do |wf|
io = nil
# default rescue
wf.rescue do |exception, io|
- io.session.logger.error(exception.patch_full_message)
+ io.session.logger.debug(exception.patch_full_message)
wf.run(:close, io: io)
io
end
wf.on(:options) do |wf_options, io|
io = io.new(options: config.options_set.process(io: io))
end
wf.for(:load) do |wf_load|
- active_cases = nil
+ wf_load.for(:input) do |wf_input|
+ wf_input.on(:get) do |wf_input_get, io|
+ cases_with_input = config.usecases.active(io: io).select do |usecase, data|
+ io.class.input_required?(usecase.type)
+ end
+ next io unless (!io.input || io.input.empty?) && !cases_with_input.empty?
- wf_load.on(:input) do |wf_input, io|
- active_cases = config.usecases.active(io: io)
-
- cases_with_input = active_cases.select do |usecase, data|
- io.class.input_required?(usecase.type)
+ if io.options.dig(:input, :entries_from)
+ io = io.new(input: config.input.get(io: io))
+ else
+ opt_case = cases_with_input.values.first[:option]
+ io = io.new(input: config.input.get(io: io, option: opt_case))
+ end
+ io
end
- next io unless (!io.input || io.input.empty?) && !cases_with_input.empty?
-
- if io.options.dig(:input, :entries_from)
- io = io.new(input: config.input.get(io: io))
- else
- opt_case = cases_with_input.values.first[:option]
- io = io.new(input: config.input.get(io: io, option: opt_case))
+ wf_input.on(:filter) do |wf_input_filter, io|
+ next io unless io.input && !io.input.empty?
+ io = io.new(input: config.input_filters.process(io: io))
end
- io
end
- wf_load.on(:people) do |wf_people, io|
- cases_with_people = active_cases.select do |usecase, data|
- io.class.people_required?(usecase.type)
+ wf_load.for(:people) do |wf_people|
+ wf_people.on(:get) do |wf_people_get, io|
+ cases_with_people = config.usecases.active(io: io).select do |usecase, data|
+ io.class.people_required?(usecase.type)
+ end
+ get_people = io.options.dig(:people, :get, :from) == :remote
+ next io unless !cases_with_people.empty? || get_people
+ io = io.new(people: config.people(io: io))
end
- get_people = io.options.dig(:people, :get, :from) == :remote
- next io unless !cases_with_people.empty? || get_people
- io = io.new(people: config.people(io: io))
- end
- wf_load.on(:filter) do |wf_filter, io|
- next io unless io.people && !io.people.empty?
- io = io.new(people: config.people_filters.process(io: io))
+ wf_people.on(:filter) do |wf_people_filter, io|
+ next io unless io.people && !io.people.empty?
+ io = io.new(people: config.people_filters.process(io: io))
+ end
end
end
wf.before(:usecases) do |wf_cases, io|
# save partial entries -> should be native to session.workflow
@@ -83,11 +87,11 @@
wf_post.skip!
else
partial_update = io.options.dig(:people, :get, :type) == :partial
if !io.options[:dry_run] && partial_update
# get target people afresh
- people = io.session.do.people_refresh(people: io.people, include_created: true)
+ people = io.session.micro.people_refresh(people: io.people, include_created: true)
io = io.new(people: people)
else
wf_post.skip!
msg = "Although there are post_launch cases, they will NOT be RUN"
if io.options[:dry_run]
@@ -114,13 +118,19 @@
io.session.jobs_launch(simulate: io.options[:dry_run])
io
end
end
+ wf.on(:report) do |wf_report, io|
+ #config.reports.active(io: io)
+ #io.session.reports
+ io
+ end
+
wf.on(:end) do |wf_end, io|
partial_update = io.options.dig(:people, :get, :type) == :partial
unless !io.options[:end_get] || io.options[:dry_run] || partial_update
- people = io.session.do.file_people
+ people = io.session.micro.people_cache
io = io.new(people: people)
end
io
end