Class: Templater::Actions::File

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

Direct Known Subclasses

Directory

Instance Method Summary (collapse)

Instance Method Details

- (Object) invoke!

Renders the template and copies it to the destination.



25
26
27
28
29
30
31
# File 'merb-gen/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

- (Object) revoke!

removes the destination file



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

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