Sha256: 5a48bcea8f179aa347d5e5edd033ce0c68254bcc338357da2f8923aca169feab
Contents?: true
Size: 642 Bytes
Versions: 7
Compression:
Stored size: 642 Bytes
Contents
# encoding: UTF-8 require "erb" module Gjp # operates on files in template/ class TemplateManager include Logger attr_reader :template_path def initialize @template_path = File.join(File.dirname(__FILE__), "..", "template") end def copy(template_name, destination_dir) FileUtils.cp_r(File.join(template_path, template_name), destination_dir) end def generate(template_name, object_binding, destination_path) erb = ERB.new File.read(File.join(template_path, template_name)), nil, "<>" File.open(destination_path, "w") { |io| io.write erb.result(object_binding) } end end end
Version data entries
7 entries across 7 versions & 1 rubygems