Class: Trickster::FileCopier
- Defined in:
- lib/trickster/file_copier.rb
Instance Method Summary collapse
-
#copy_files(from, extension, options = {}) ⇒ Object
Shallow copies all files from
from
with the given extension.
Methods inherited from Copier
Constructor Details
This class inherits a constructor from Trickster::Copier
Instance Method Details
#copy_files(from, extension, options = {}) ⇒ Object
Shallow copies all files from from
with the given extension
- from
-
location, relative to @install_root where files are copied from
- extension
-
extension of files to copy
- options
-
options to control the copy. Currently recognized keys:
- :except
-
array of filenames to skip
9 10 11 12 13 14 15 16 |
# File 'lib/trickster/file_copier.rb', line 9 def copy_files(from,extension,={}) dest_dir = File.join(@destination_root,from) FileUtils.mkdir(dest_dir) unless File.exists?(dest_dir) Dir["#{@install_root}/#{from}/*.#{extension}"].each do |file| next if Array([:except]).include?(File.basename(file)) FileUtils.cp file,dest_dir end end |