module StackMaster::SparkleFormation::Template

Public Class Methods

render(prefix, file_name, vars) click to toggle source
# File lib/stack_master/sparkle_formation/template_file.rb, line 86
def self.render(prefix, file_name, vars)
  file_path = File.join(::SparkleFormation.sparkle_path, prefix, file_name)
  template = File.read(file_path)
  template_context = TemplateContext.build(vars, prefix)
  compiled_template = SfEruby.new(template).evaluate(template_context)
  CloudFormationLineFormatter.format(compiled_template)
rescue Errno::ENOENT => e
  Kernel.raise TemplateFileNotFound, "Could not find template file at path: #{file_path}"
end