Sha256: 9649023b3160283e4edf50d7c36ee8586f314aa239d555504876383e66d0d125

Contents?: true

Size: 402 Bytes

Versions: 2

Compression:

Stored size: 402 Bytes

Contents

#!/usr/bin/env ruby

require 'erb'
require 'ostruct'

class ErbBinding < OpenStruct
	def render(template)
		ERB.new(template).result(binding)
	end
end

if ARGV.length <= 0
	puts "Usage: generator.rb <template-file> [key=value]*"
else
	template = File.read(ARGV.shift)
	data = {}
	ARGV.each do |arg|
		key, value = arg.split('=')
		data[key] = value
	end
	puts ErbBinding.new(data).render(template)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nuri-0.5.4 examples/mockcloud/generator.rb
nuri-0.5.3 examples/mockcloud/generator.rb