Class: StackMaster::TemplateCompiler
- Inherits:
-
Object
- Object
- StackMaster::TemplateCompiler
- Defined in:
- lib/stack_master/template_compiler.rb
Constant Summary collapse
- MAX_TEMPLATE_SIZE =
51200
Class Method Summary collapse
Class Method Details
.compile(template_file_path) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/stack_master/template_compiler.rb', line 6 def self.compile(template_file_path) if template_file_path.ends_with?('.rb') SparkleFormation.sparkle_path = File.dirname(template_file_path) JSON.pretty_generate(SparkleFormation.compile(template_file_path)) else template_body = File.read(template_file_path) if template_body.size > MAX_TEMPLATE_SIZE # Parse the json and rewrite compressed JSON.dump(JSON.parse(template_body)) else template_body end end end |