Remove most of recipe evaluation code in Recipe class, and rely on Recipe::DSL to get evaluated recipes. * Remove Recipe#evaluate call from CLI, rely on Recipe.evaluate_from_file to get the evaluated recipe; * Implement Recipe.evaluate_from_file(filepath, env); * Implement Recipe::DSL.evaluate(code, env); * Remove code and filepath accessor on Recipe; * Remove Recipe.from_file and Recipe#evaluate methods; * Move task evaluations in Recipe::DSL#evaluate; * Modify Recipe constructor so that it accepts tasks as argument.
16 lines
266 B
Ruby
16 lines
266 B
Ruby
module Producer
|
|
module Core
|
|
class Recipe
|
|
attr_accessor :tasks
|
|
|
|
def self.evaluate_from_file(filepath, env)
|
|
DSL.evaluate(File.read(filepath), env)
|
|
end
|
|
|
|
def initialize(tasks = [])
|
|
@tasks = tasks
|
|
end
|
|
end
|
|
end
|
|
end
|