Merge Task::DSL into Task
This commit is contained in:
@@ -4,27 +4,25 @@ module Producer
|
||||
DRY_RUN_WARNING =
|
||||
'running in dry run mode, actions will NOT be applied'.freeze
|
||||
|
||||
attr_accessor :env
|
||||
|
||||
def initialize(env)
|
||||
@env = env
|
||||
end
|
||||
|
||||
def process(tasks)
|
||||
env.log DRY_RUN_WARNING, :warn if env.dry_run?
|
||||
@env.log DRY_RUN_WARNING, :warn if @env.dry_run?
|
||||
|
||||
tasks.each { |t| process_task t }
|
||||
end
|
||||
|
||||
def process_task(task)
|
||||
if task.condition_met?
|
||||
env.log "Task: `#{task}' applying..."
|
||||
@env.log "Task: `#{task}' applying..."
|
||||
task.actions.each do |e|
|
||||
env.log " action: #{e}"
|
||||
e.apply unless env.dry_run?
|
||||
@env.log " action: #{e}"
|
||||
e.apply unless @env.dry_run?
|
||||
end
|
||||
else
|
||||
env.log "Task: `#{task}' skipped"
|
||||
@env.log "Task: `#{task}' skipped"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user