class Pineapples::Actions::CopyFile

Attributes

source[R]

Public Class Methods

new(generator, source, target, options, &block) click to toggle source
Calls superclass method
# File lib/pineapples/actions/copy_file.rb, line 31
def initialize(generator, source, target, options, &block)
  @source  = File.expand_path(generator.find_in_source_paths(source.to_s))
  @content = File.binread(@source)
  @content = block.call(@content) if block
  super(generator, target, @content, options)
end

Public Instance Methods

invoke!() click to toggle source
Calls superclass method
# File lib/pineapples/actions/copy_file.rb, line 38
def invoke!
  super
  if options[:mode] == :preserve
    mode = File.stat(source).mode
    generator.chmod(target.fullpath, mode, options)
  end
end