Permalink
Browse files

Issue #130 Nested directory-task

  • Loading branch information...
1 parent 2932a4d commit 8c6fb574a32d8184b7f9f30d865c2fa2d6a19570 mde committed Jun 9, 2012
Showing with 17 additions and 3 deletions.
  1. +1 −3 lib/jake.js
  2. +7 −0 tests/Jakefile
  3. +9 −0 tests/file_task.js
View
@@ -187,9 +187,7 @@ jake = new function () {
switch (type) {
case 'directory':
action = function () {
- if (!path.existsSync(name)) {
- fs.mkdirSync(name, 0755);
- }
+ jake.mkdirP(name);
};
task = new DirectoryTask(name, prereqs, action, opts);
break;
View
@@ -166,6 +166,13 @@ namespace('fileTest', function () {
console.log('fileTest:foo/from-prereq.txt task');
});
+ directory('foo/bar/baz');
+
+ desc('Write a file in a nested subdirectory');
+ file('foo/bar/baz/bamf.txt', ['foo/bar/baz'], function () {
+ fs.writeFileSync('foo/bar/baz/bamf.txt', 'w00t');
+ });
+
});
task('blammo');
View
@@ -1,5 +1,6 @@
var assert = require('assert')
, fs = require('fs')
+ , path = require('path')
, exec = require('child_process').exec
, h = require('./helpers');
@@ -87,6 +88,14 @@ var tests = {
});
}
+, 'test nested directory-task': function () {
+ h.exec('../bin/cli.js fileTest:foo/bar/baz/bamf.txt', function (out) {
+ data = fs.readFileSync(process.cwd() + '/foo/bar/baz/bamf.txt');
+ assert.equal('w00t', data);
+ cleanUpAndNext();
+ });
+ }
+
};
h.run(tests, function () {

0 comments on commit 8c6fb57

Please sign in to comment.