Temp fixes to reproducing a proper gulp serve

This commit is contained in:
Avery Magnotti 2017-02-05 17:53:21 -05:00
parent 2f99eb4e2c
commit 027cd49afb
2 changed files with 73 additions and 26 deletions

34
tasks/ensure-files.js Normal file
View file

@ -0,0 +1,34 @@
var fs = require('fs');
/**
* @param {Array<string>} files
* @param {Function} cb
*/
function ensureFiles(files, cb) {
var missingFiles = files.reduce(function(prev, filePath) {
var fileFound = false;
try {
fileFound = fs.statSync(filePath).isFile();
} catch (e) { }
if (!fileFound) {
prev.push(filePath + ' Not Found');
}
return prev;
}, []);
if (missingFiles.length) {
var err = new Error('Missing Required Files\n' + missingFiles.join('\n'));
}
if (cb) {
cb(err);
} else if (err) {
throw err;
}
}
module.exports = ensureFiles;