Method: ProScribe::Helpers#copy_files

Defined in:
lib/proscribe/helpers.rb

#copy_files(from, to, options = {}) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/proscribe/helpers.rb', line 28

def copy_files(from, to, options={})
  exceptions = options[:except] || []

  Dir["#{from}/**/*"].each do |f|
    next  unless File.file?(f)
    next  if exceptions.include?(File.basename(f))

    target = File.join(to, f.gsub(from, ''))

    FileUtils.mkdir_p File.dirname(target)
    FileUtils.cp f, target
  end
end