global

def template(src, dst = nil, &block)

Returns:
  • (Pathname) - the Pathname object representing the destination file path

Other tags:
    Yield: - the configuration block for the template compiler

Parameters:
  • dst (String) -- the path to file that will be the product
  • src (String) -- the path to the template file to be processed
def template(src, dst = nil, &block)
  template_src = Pathname.new(src)
  template_dst = dst ? Pathname.new(dst) : template_src
  if template_dst.extname == '.erb'
    template_dst = template_dst.sub_ext('erb')
  end
  template_src == template_dst and raise ArgumentError,
    "pathname #{pathname.inspect} needs to have a file extension"
  file template_dst.to_s => template_src.to_s do
    GemHadar::TemplateCompiler.new(&block).compile(template_src, template_dst)
  end
  template_dst
end