Skip to content

Commit

Permalink
Merge pull request #72 from Page-/master
Browse files Browse the repository at this point in the history
File tasks within a namespace always execute regardless of whether file dependencies have changes.
  • Loading branch information
mde committed Sep 27, 2011
2 parents 1a1723b + e8d62f7 commit a4f5c65
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/jake.js
Expand Up @@ -274,7 +274,7 @@ jake = new function () {


if (task instanceof FileTask) { if (task instanceof FileTask) {
try { try {
stats = fs.statSync(name); stats = fs.statSync(task.name);
modTime = stats.ctime; modTime = stats.ctime;
} }
catch (e) { catch (e) {
Expand All @@ -299,7 +299,7 @@ jake = new function () {
// If there's a valid file at the end of running the task, // If there's a valid file at the end of running the task,
// use its mod-time as last modified // use its mod-time as last modified
try { try {
stats = fs.statSync(name); stats = fs.statSync(task.name);
modTime = stats.ctime; modTime = stats.ctime;
} }
// If there's still no actual file after running the file-task, // If there's still no actual file after running the file-task,
Expand Down
15 changes: 14 additions & 1 deletion tests/Jakefile
Expand Up @@ -40,7 +40,7 @@ task('fonebone', function () {


directory('foo'); 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 () { file({'foo/concat.txt': ['foo', 'foo/src1.txt', 'foo/src2.txt']}, function () {
console.log('doing concat.txt file-task'); console.log('doing concat.txt file-task');
var data1 = fs.readFileSync('foo/src1.txt'); var data1 = fs.readFileSync('foo/src1.txt');
Expand Down Expand Up @@ -138,7 +138,20 @@ namespace('foo', function () {
complete(); complete();
}, 0); }, 0);
}, true); }, 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.