Module: StackMaster::SparkleFormation::Template

Defined in:
lib/stack_master/sparkle_formation/template_file.rb

Class Method Summary collapse

Class Method Details

.render(prefix, file_name, vars) ⇒ Object



80
81
82
83
84
85
86
87
88
# File 'lib/stack_master/sparkle_formation/template_file.rb', line 80

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)
  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