Implement nested tasks
This commit is contained in:
@@ -43,6 +43,10 @@ module Producer
|
||||
@condition
|
||||
end
|
||||
|
||||
def task(name, *args, &block)
|
||||
@actions << self.class.evaluate(@env, name, *args, &block)
|
||||
end
|
||||
|
||||
def ask(question, choices, prompter: Prompter.new(@env.input, @env.output))
|
||||
prompter.prompt(question, choices)
|
||||
end
|
||||
|
@@ -18,8 +18,12 @@ module Producer
|
||||
if task.condition_met?
|
||||
@env.log "Task: `#{task}' applying..."
|
||||
task.actions.each do |e|
|
||||
@env.log " action: #{e}"
|
||||
e.apply unless @env.dry_run?
|
||||
case e
|
||||
when Task then process_task e
|
||||
else
|
||||
@env.log " action: #{e}"
|
||||
e.apply unless @env.dry_run?
|
||||
end
|
||||
end
|
||||
else
|
||||
@env.log "Task: `#{task}' skipped"
|
||||
|
Reference in New Issue
Block a user