Sha256: 5161028dae193843f887553874b6cab92ab4ab9198bdf20ca358ebda03f7d8fe

Contents?: true

Size: 508 Bytes

Versions: 12

Compression:

Stored size: 508 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)

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)
else
  $stdout.print template.render_to_string(context)
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sablon-0.0.17 exe/sablon
sablon-0.0.16 exe/sablon
sablon-0.0.15 exe/sablon
sablon-0.0.14 exe/sablon
sablon-0.0.13 exe/sablon
sablon-0.0.12 exe/sablon
sablon-0.0.11 exe/sablon
sablon-0.0.10 exe/sablon
sablon-0.0.9 bin/sablon
sablon-0.0.8 bin/sablon
sablon-0.0.7 bin/sablon
sablon-0.0.6 bin/sablon