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 14require 'rake' 15 16# :stopdoc: 17CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"] 18CLEAN.clear_exclude.exclude { |fn| 19 fn.pathmap("%f").downcase == 'core' && File.directory?(fn) 20} 21 22desc "Remove any temporary products." 23task :clean do 24 CLEAN.each { |fn| rm_r fn rescue nil } 25end 26 27CLOBBER = Rake::FileList.new 28 29desc "Remove any generated file." 30task :clobber => [:clean] do 31 CLOBBER.each { |fn| rm_r fn rescue nil } 32end 33