Allow main method to be called from elsewhere

This commit is contained in:
Tim Schaub
2014-04-09 17:06:49 -06:00
parent e53fde402b
commit d3e477a8df
+13 -1
View File
@@ -145,15 +145,27 @@ function writeSymbols(symbols, output, callback) {
/** /**
* Determine which source files have been changed, run JSDoc against those, * Determine which source files have been changed, run JSDoc against those,
* write out exported symbols, and clean up the build dir. * write out exported symbols, and clean up the build dir.
*
* @param {function(Error)} callback Called when the symbols file has been
* written (or if an error occurs).
*/ */
exports.main = function(callback) {
async.waterfall([ async.waterfall([
readSymbols, readSymbols,
getNewer, getNewer,
spawnJSDoc, spawnJSDoc,
writeSymbols writeSymbols
], function(err) { ], callback);
};
if (require.main === module) {
exports.main(function(err) {
if (err) { if (err) {
console.error(err.message); console.error(err.message);
process.exit(1); process.exit(1);
} else {
process.exit(0);
} }
}); });
}