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



86
87
88
89
90
91
92
93
94
# 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