Refactor CLI

This commit is contained in:
Thibault Jouan
2014-09-22 12:30:50 +00:00
parent 9cefb62f15
commit ea6875e9ee
2 changed files with 19 additions and 63 deletions

View File

@@ -52,17 +52,13 @@ module Producer
fail ArgumentError unless arguments.any?
end
def run
worker.process load_recipe.tasks
env.cleanup
def run(worker: Worker.new(@env))
worker.process recipe.tasks
@env.cleanup
end
def load_recipe
Recipe.evaluate_from_file(@arguments.first, env)
end
def worker
Worker.new(env)
def recipe
@recipe ||= Recipe.evaluate_from_file(@arguments.first, env)
end
end
end