Refactor CLI#run! method

This commit is contained in:
Thibault Jouan
2013-07-30 15:18:27 +00:00
parent 71ef5fcd29
commit a1e92893ad
2 changed files with 45 additions and 25 deletions

View File

@@ -11,8 +11,15 @@ module Producer
end
def run!
print_usage_and_exit(64) unless @arguments.length == 2
check_arguments!
evaluate_recipe_file(@arguments[1])
end
def check_arguments!
print_usage_and_exit(64) unless @arguments.length == 2
end
def evaluate_recipe_file(filepath)
recipe = Recipe.from_file(@arguments[1])
env = Env.new(recipe)
recipe.evaluate env