Class: Templater::Actions::File

Inherits:
Action
  • Object
show all
Defined in:
lib/merb-gen/templater.rb

Direct Known Subclasses

Directory

Instance Method Summary collapse

Instance Method Details

#invoke!Object

Renders the template and copies it to the destination.



25
26
27
28
29
30
31
# File 'lib/merb-gen/templater.rb', line 25

def invoke!
  callback(:before)
  ::FileUtils.mkdir_p(::File.dirname(destination))
  ::FileUtils.rm_rf(destination)
  ::FileUtils.cp_r(source, destination)
  callback(:after)
end

#revoke!Object

removes the destination file



34
35
36
# File 'lib/merb-gen/templater.rb', line 34

def revoke!
  ::FileUtils.rm_r(destination, :force => true)
end