Thibault Jouan ace6a4ad2b Implement Task::DSL#evaluate:
So that the env is available from the task DSL.
2013-08-01 00:01:20 +00:00

24 lines
476 B
Ruby

module Producer
module Core
class Recipe
RecipeEvaluationError = Class.new(StandardError)
attr_reader :code, :filepath
def self.from_file(filepath)
new(File.read(filepath), filepath)
end
def initialize(code, filepath = nil)
@code = code
@filepath = filepath
end
def evaluate(env)
dsl = DSL.new(@code).evaluate(env)
dsl.tasks.map { |e| e.evaluate env }
end
end
end
end