Class: CopyHelper
- Inherits:
-
Object
- Object
- CopyHelper
- Defined in:
- lib/resourcesCopy.rb
Instance Method Summary collapse
-
#copy(from_dir, to_dir) ⇒ Object
desc “public copy”.
-
#copy_with_path(src, dest) ⇒ Object
desc “private copy”.
-
#initialize ⇒ CopyHelper
constructor
desc “Instance”.
Constructor Details
#initialize ⇒ CopyHelper
desc “Instance”
8 9 |
# File 'lib/resourcesCopy.rb', line 8 def initialize() end |
Instance Method Details
#copy(from_dir, to_dir) ⇒ Object
desc “public copy”
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/resourcesCopy.rb', line 18 def copy(from_dir, to_dir) # specify files which should not be copied dont_copy = ['.xcassets','.bundle'] Dir[from_dir + "/**/*.{xib,storyboard,xcassets,bundle,jsbundle}"].each do |old_dest| new_dest = old_dest.gsub(from_dir, to_dir) should_not_copy = dont_copy.any? { |s| new_dest.end_with?(s) } if !should_not_copy copy_with_path(old_dest, new_dest); else FileUtils.mkdir_p(File.dirname(new_dest)) comd = "cp -R " + old_dest + " " + new_dest system(comd) end end end |
#copy_with_path(src, dest) ⇒ Object
desc “private copy”
12 13 14 15 |
# File 'lib/resourcesCopy.rb', line 12 def copy_with_path(src, dest) FileUtils.mkdir_p(File.dirname(dest)) FileUtils.cp(src, dest) end |