Test whether externs/olx.js is newer than build/info.json
This commit is contained in:
+21
-2
@@ -34,15 +34,33 @@ function getInfoTime(callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether externs/olx.js is newer than the provided date.
|
||||||
|
* @param {Date} date Modification time of info file.
|
||||||
|
* @param {function(Error, Date, boolen)} callback Called with any
|
||||||
|
* error, the mtime of the info file (zero date if it doesn't exist), and
|
||||||
|
* whether externs/olx.js is newer than that date.
|
||||||
|
*/
|
||||||
|
function getOlxNewer(date, callback) {
|
||||||
|
fs.stat(olxPath, function(err, stats) {
|
||||||
|
if (err) {
|
||||||
|
callback(new Error('Trouble reading ' + olxPath));
|
||||||
|
} else {
|
||||||
|
callback(null, date, stats.mtime > date);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a list of all .js paths in the source directory if any are newer
|
* Generate a list of all .js paths in the source directory if any are newer
|
||||||
* than the provided date.
|
* than the provided date.
|
||||||
* @param {Date} date Modification time of info file.
|
* @param {Date} date Modification time of info file.
|
||||||
|
* @param {boolean} newer Whether externs/olx.js is newer than date.
|
||||||
* @param {function(Error, Array.<string>)} callback Called with any
|
* @param {function(Error, Array.<string>)} callback Called with any
|
||||||
* error and the array of source paths (empty if none newer).
|
* error and the array of source paths (empty if none newer).
|
||||||
*/
|
*/
|
||||||
function getNewer(date, callback) {
|
function getNewer(date, newer, callback) {
|
||||||
var newer = false;
|
|
||||||
var paths = [olxPath];
|
var paths = [olxPath];
|
||||||
|
|
||||||
var walker = walk(sourceDir);
|
var walker = walk(sourceDir);
|
||||||
@@ -220,6 +238,7 @@ function writeInfo(info, callback) {
|
|||||||
function main(callback) {
|
function main(callback) {
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
getInfoTime,
|
getInfoTime,
|
||||||
|
getOlxNewer,
|
||||||
getNewer,
|
getNewer,
|
||||||
spawnJSDoc,
|
spawnJSDoc,
|
||||||
addSymbolProvides,
|
addSymbolProvides,
|
||||||
|
|||||||
Reference in New Issue
Block a user