module Thor::Actions

def template(source, *args, &block)


template "doc/README"

template "README", "doc/README"

==== Examples

config:: give :verbose => false to not log the status.
destination:: the relative path to the destination root.
source:: the relative path to the source root.
==== Parameters

to be equal to the source removing .tt from the filename.
at the relative destination. If the destination is not given it's assumed
Gets an ERB template at the relative source, executes it and makes a copy
def template(source, *args, &block)
  config = args.last.is_a?(Hash) ? args.pop : {}
  destination = args.first || source.sub(/\.tt$/, '')
  source  = File.expand_path(find_in_source_paths(source.to_s))
  context = instance_eval('binding')
  create_file destination, nil, config do
    content = ERB.new(::File.binread(source), nil, '-', '@output_buffer').result(context)
    content = block.call(content) if block
    content
  end
end