Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (34 sloc) 1021 Bytes
/*globals CLEAN, CLOBBER, desc, task, directory, write, fileSync, log, sh, read */
require('sake/clobber');
desc('Generate the README.md documentation');
fileSync(
'README.md',
['README.ejs', 'package.json', 'Sakefile'],
function (t) {
var ejs = require('ejs'),
pkgInfo = JSON.parse(read('package.json', 'utf8')),
tmpl = ejs.compile(read(t.prerequisites[0], 'utf8')),
tmplParams = {
pkg: pkgInfo,
license: read('./LICENSE', 'utf8')
}
;
write(t.name, tmpl(tmplParams), 'utf8');
log.info(t.name + ' generated');
}
);
CLEAN.include('README.md');
task('build', ['README.md']);
desc('Run the mocha test suites');
task('test', function (t) {
sh('mocha', function (err, txt) {
if (err) {
t.abort('tests failed', err);
}
else {
log.info('tests passed');
t.done();
}
});
});
task('default', ['test', 'build']);