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