Class: Producer::Core::Recipe::FileEvaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/producer/core/recipe/file_evaluator.rb

Class Method Summary collapse

Class Method Details

.evaluate(file_path, env) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/producer/core/recipe/file_evaluator.rb', line 6

def evaluate file_path, env
  content = File.read(file_path)
  begin
    Recipe.new(env).tap { |o| o.instance_eval content, file_path }
  rescue ::StandardError, ::ScriptError => e
    raise RecipeEvaluationError, e.message, [
      '%s (recipe)' % file_path,
      *e.backtrace
    ]
  end
end