Sha256: 20590924c244cab5793ba0e60d815017a269a6d94366ddd94ada60b6567e2e80
Contents?: true
Size: 991 Bytes
Versions: 14
Compression:
Stored size: 991 Bytes
Contents
module Lono class OutputTemplate def initialize(blueprint, template) @blueprint, @template = blueprint, template end def data template_path = "#{Lono.config.output_path}/#{@blueprint}/templates/#{@template}.yml" check_template_exists(template_path) YAML.load(IO.read(template_path)) end # Check if the template exists and print friendly error message. Exits if it # does not exist. def check_template_exists(template_path) unless File.exist?(template_path) puts "The template #{template_path} does not exist. Are you sure you use the right template name? The template name does not require the extension.".color(:red) exit 1 end end def required_parameters parameters.select { |logical_id, p| p["Default"].nil? } end def optional_parameters parameters.reject { |logical_id, p| p["Default"].nil? } end def parameters data["Parameters"] || [] end end end
Version data entries
14 entries across 14 versions & 1 rubygems