Module: ScriptLocator
- Included in:
- BaseProvision, ScriptExecutor
- Defined in:
- lib/script_executor/script_locator.rb
Instance Method Summary collapse
Instance Method Details
#evaluate_script_body(content, env, type = :erb) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/script_executor/script_locator.rb', line 23 def evaluate_script_body content, env, type=:erb content = content.join("\n") if content.kind_of? Array case type when :erb template = ERB.new content template.result(env).strip else interpolator = TextInterpolator.new result = interpolator.interpolate content, env puts interpolator.errors if interpolator.errors.size > 0 result end end |
#scripts(file) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/script_executor/script_locator.rb', line 9 def scripts file data = extract_data file begin scripts_parser = ScriptsParser.new parsed_content = scripts_parser.parse data transformer = ScriptsTransform.new transformer.transform(parsed_content) rescue Parslet::ParseFailed => failure puts failure.cause.ascii_tree end end |