Permalink
Browse files

Merge pull request #72 from Page-/master

File tasks within a namespace always execute regardless of whether file dependencies have changes.
  • Loading branch information...
2 parents 1a1723b + e8d62f7 commit a4f5c65516667c462dc684262fa7658cd2b7d9c2 @mde mde committed Sep 27, 2011
Showing with 16 additions and 3 deletions.
  1. +2 −2 lib/jake.js
  2. +14 −1 tests/Jakefile
View
@@ -274,7 +274,7 @@ jake = new function () {
if (task instanceof FileTask) {
try {
- stats = fs.statSync(name);
+ stats = fs.statSync(task.name);
modTime = stats.ctime;
}
catch (e) {
@@ -299,7 +299,7 @@ jake = new function () {
// If there's a valid file at the end of running the task,
// use its mod-time as last modified
try {
- stats = fs.statSync(name);
+ stats = fs.statSync(task.name);
modTime = stats.ctime;
}
// If there's still no actual file after running the file-task,
View
@@ -40,7 +40,7 @@ task('fonebone', function () {
directory('foo');
-desc('File task, concating two files together');
+desc('File task, concatenating two files together');
file({'foo/concat.txt': ['foo', 'foo/src1.txt', 'foo/src2.txt']}, function () {
console.log('doing concat.txt file-task');
var data1 = fs.readFileSync('foo/src1.txt');
@@ -138,7 +138,20 @@ namespace('foo', function () {
complete();
}, 0);
}, true);
+});
+
+namespace('bar', function() {
+ directory('bar');
+
+ task({'setup': 'bar:bar'}, function() {
+ fs.writeFileSync('bar/test.txt', 'test');
+ });
+ desc('Namespaced file task, don\'t run unless the prereq file changes');
+ file({'bar/src2.txt': 'bar/test.txt'}, function () {
+ console.log('doing src2.txt file-task');
+ fs.writeFileSync('bar/src2.txt', '');
+ });
});

0 comments on commit a4f5c65

Please sign in to comment.