Sha256: db135ccbacbcf4201a2b34d6fbf586bdb823b2e7488415d8f8ca20fb00bdc413
Contents?: true
Size: 641 Bytes
Versions: 19
Compression:
Stored size: 641 Bytes
Contents
#!/usr/bin/env ruby require 'sablon' require 'json' if ARGV.size < 1 puts <<-HELP cat <context path> | sablon <template path> [<output path>] HELP exit end template_path = File.expand_path(ARGV[0]) context_json = STDIN.readlines.join context = JSON.parse(context_json) config = context.delete("_sablon") || {} section_properties = config.fetch("properties", {}) template = Sablon.template(template_path) if !ARGV[1].nil? && !ARGV[1].empty? output_path = File.expand_path(ARGV[1]) template.render_to_file(output_path, context, section_properties) else $stdout.print template.render_to_string(context, section_properties) end
Version data entries
19 entries across 19 versions & 1 rubygems