clean.rb 1016 B

1234567891011121314151617181920212223242526272829303132
  1. # The 'rake/clean' file defines two file lists (CLEAN and CLOBBER) and
  2. # two rake tasks (:clean and :clobber).
  3. #
  4. # [:clean] Clean up the project by deleting scratch files and backup
  5. # files. Add files to the CLEAN file list to have the :clean
  6. # target handle them.
  7. #
  8. # [:clobber] Clobber all generated and non-source files in a project.
  9. # The task depends on :clean, so all the clean files will
  10. # be deleted as well as files in the CLOBBER file list.
  11. # The intent of this task is to return a project to its
  12. # pristine, just unpacked state.
  13. require 'rake'
  14. # :stopdoc:
  15. CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
  16. CLEAN.clear_exclude.exclude { |fn|
  17. fn.pathmap("%f") == 'core' && File.directory?(fn)
  18. }
  19. desc "Remove any temporary products."
  20. task :clean do
  21. CLEAN.each { |fn| rm_r fn rescue nil }
  22. end
  23. CLOBBER = Rake::FileList.new
  24. desc "Remove any generated file."
  25. task :clobber => [:clean] do
  26. CLOBBER.each { |fn| rm_r fn rescue nil }
  27. end