/tools/Rake/filelist.rb

http://github.com/agross/netopenspace · Ruby · 23 lines · 21 code · 2 blank · 0 comment · 1 complexity · 6d772dbd890f5013b7a702aff692bdb6 MD5 · raw file

  1. class FileList
  2. def copy_hierarchy(attributes)
  3. self.each do |source|
  4. target = source.pathmap("%{^#{attributes[:source_dir]},#{attributes[:target_dir]}}p")
  5. if File.directory? source
  6. FileUtils.cp_r \
  7. source,
  8. target.dirname,
  9. :verbose => false,
  10. :preserve => true
  11. next
  12. end
  13. FileUtils.mkdir_p target.dirname
  14. FileUtils.cp \
  15. source,
  16. target,
  17. :verbose => false,
  18. :preserve => true
  19. end
  20. end
  21. end