Make "jake clean" and "jake distclean" check deleted directory existence

Closes GH-52.
redux
David Majda 13 years ago
parent 211a1116e4
commit 5013f79e8d

@ -88,6 +88,16 @@ function copyDir(src, dest) {
});
}
function dirExists(dir) {
try {
var stats = fs.statSync(file);
} catch (e) {
return false;
}
return stats.isDirectory();
}
function removeDir(dir) {
fs.readdirSync(dir).every(function(file) {
var file = dir + "/" + file;
@ -151,7 +161,9 @@ task("build", [], function() {
desc("Remove built peg.js file (created by \"build\")");
task("clean", [], function() {
if (dirExists(LIB_DIR)) {
removeDir(LIB_DIR);
}
});
desc("Prepare the distribution files");
@ -189,7 +201,9 @@ task("dist", ["build"], function() {
desc("Remove the distribution files (created by \"dist\")");
task("distclean", [], function() {
if (dirExists(DIST_DIR)) {
removeDir(DIST_DIR);
}
});
desc("Run the test suite");

Loading…
Cancel
Save