Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

145 lines (119 sloc) 4.046 kb
var sys = require('sys'),
fs = require('fs')
proc = require('child_process');
desc('This is the default task.');
task('default', function () {
console.log('doing default task.');
console.log(sys.inspect(arguments));
console.log(process.env.foo);
});
desc('This is the asdf task. It depends on both qwer and the default');
task({'asdf': ['qwer', 'default']}, function (a, b, c) {
console.log('doing asdf task.');
console.log(a, b, c);
});
desc('This is the qwer task. It depends on zxcv, uiop, and the default');
task({'qwer': ['zxcv', 'uiop', 'default']}, function () {
console.log('doing qwer task.');
console.log(sys.inspect(arguments));
});
desc('This is the zxcv task. It depends on the default');
task({'zxcv': ['default', 'uiop']}, function () {
console.log('doing zxcv task.');
console.log(sys.inspect(arguments));
});
desc('This is the uiop task. It has no action.');
task({'uiop': ['default']});
desc('This is the frang task. It has no action, no prereqs.');
task('frang');
desc('This is the fonebone task.');
task('fonebone', function () {
console.log('doing fonebone task.');
});
directory('foo');
desc('File task, concating 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');
var data2 = fs.readFileSync('foo/src2.txt');
fs.writeFileSync('foo/concat.txt', data1 + data2);
});
desc('File task, don\'t run unless the prereq file changes');
file({'foo/src2-foo.txt': ['foo', 'foo/src2.txt']}, function () {
console.log('doing src2-foo.txt file-task');
var data2 = fs.readFileSync('foo/src2.txt');
fs.writeFileSync('foo/src2-foo.txt', data2);
});
desc('File task, async creation with child_process.exec');
file('foo/src1.txt', function () {
console.log('running src1.txt file-task');
proc.exec('touch foo/src1.txt', function (err, stdout, stderr) {
console.log('src1.txt complete');
complete();
});
}, true);
desc('File task, sync creation with writeFileSync');
file({'foo/src2.txt': 'fonebone'}, function () {
console.log('doing src2.txt file-task');
fs.writeFileSync('foo/src2.txt', '');
});
desc('Failing task.');
task('failure', function () {
fail('Holy shit.', 42);
});
desc('Jake task lookup by name.');
task('lookup', function () {
console.dir(jake.Task['foo:bar']);
});
namespace('foo', function () {
desc('This the foo:bar task');
task({'bar': ['default', 'foo:qux', 'foo:baz']}, function () {
console.log('doing foo:bar task');
console.log(sys.inspect(arguments));
});
desc('This the foo:baz task');
task({'baz': ['default']}, function () {
console.log('doing foo:baz task');
console.log(sys.inspect(arguments));
});
desc('This tests the legacy string+array syntax');
task('legacy', ['foo:baz', 'default'], function () {
console.log('doing foo:legacy task');
console.log(sys.inspect(arguments));
});
desc('This the foo:zoobie task');
task('zoobie', function () {
var t;
console.log('doing foo:zoobie task');
console.log(sys.inspect(arguments));
t = jake.Task.qwer;
t.invoke.apply(t, arguments);
t.invoke.apply(t, arguments);
});
desc('This the foo:frang task');
task('frang', function () {
console.log('doing foo:frang task');
console.log(sys.inspect(arguments));
t = jake.Task.qwer;
t.execute.apply(t, arguments);
t.execute.apply(t, arguments);
});
desc('This the foo:fonebone task');
task('fonebone', function () {
console.log('doing foo:fonebone task');
console.log(sys.inspect(arguments));
t = jake.Task.qwer;
t.invoke.apply(t, arguments);
t.reenable(true);
t.invoke.apply(t, arguments);
});
desc('This the foo:qux task');
task('qux', function () {
console.log('starting async foo:qux task');
console.log(sys.inspect(arguments));
setTimeout(function () {
console.log('completing async foo:qux task');
complete();
}, 0);
}, true);
});
Jump to Line
Something went wrong with that request. Please try again.