Builds a new file.
generator | The generator |
name | The name of this file |
source | Full path to the source of this file |
destination | Full path to the destination of this file |
options | Options, including callbacks. |
# File lib/templater/actions/file.rb, line 13 13: def initialize(generator, name, source, destination, options={}) 14: self.generator = generator 15: self.name = name 16: self.source = source 17: self.destination = destination 18: self.options = options 19: end
Checks if the destination file already exists.
Boolean | true if the file exists, false otherwise. |
# File lib/templater/actions/file.rb, line 33 33: def exists? 34: ::File.exists?(destination) 35: end
Checks if the content of the file at the destination is identical to the rendered result.
Boolean | true if it is identical, false otherwise. |
# File lib/templater/actions/file.rb, line 41 41: def identical? 42: exists? && ::FileUtils.identical?(source, destination) 43: end
Renders the template and copies it to the destination.
# File lib/templater/actions/file.rb, line 46 46: def invoke! 47: callback(:before) 48: ::FileUtils.mkdir_p(::File.dirname(destination)) 49: ::FileUtils.cp_r(source, destination) 50: callback(:after) 51: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.