Thibault Jouan c4fc9828db Improve error reporting during recipe evaluation
* Report invalid action usages from tasks;
* Implement backtrace cleaning in CLI;
* Extract error class declarations in a new errors file;
* Replace raise with fail keyword in task DSL class.
2013-08-01 20:31:39 +00:00

22 lines
420 B
Ruby

module Producer
module Core
class Recipe
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