Class: Cukedep::CopyAction
- Inherits:
-
FileAction
- Object
- FileAction
- Cukedep::CopyAction
- Defined in:
- lib/cukedep/file-action.rb
Overview
A copy action object has for purpose to copy files matching one of its file patterns. These file are copied from a given 'source' directory and are placed in a target directory or a specific subdirectory of the target directory.
Instance Attribute Summary
Attributes inherited from FileAction
Instance Method Summary collapse
Methods inherited from FileAction
Constructor Details
This class inherits a constructor from Cukedep::FileAction
Instance Method Details
#run!(sourceDir, targetDir) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/cukedep/file-action.rb', line 117 def run!(sourceDir, targetDir) return if patterns.empty? orig_dir = Dir.getwd # Store current work directory begin Dir.chdir(sourceDir) destination = full_path(targetDir) patterns.each do |pattern| Dir.glob(pattern) { |fname| single_action(fname, destination) } end ensure Dir.chdir(orig_dir) # Restore original work directory end end |