41c759d9 by Adam Heath

Fix building of jsChecker file spec lists, so that scripts/*.js isn't

missed, and duplicate scanning doesn't occur.
1 parent f8c9033e
......@@ -251,6 +251,21 @@ module.exports = function (grunt) {
if (!mpConfig[name]) {
return;
}
function makeFilesSpec() {
var items = [];
_.each(arguments, function(item) {
if (_.isArray(item)) {
items = items.concat(item);
} else if (item != null) {
items.push(item);
}
});
return items.map(function(value) {
return {
src: mpConfig.base + '/scripts/' + (value ? value + '/{,**/}' : '') + '*.js',
};
});
}
initConfig[name] = {
options: mpConfig[name].options,
all: [
......@@ -258,27 +273,15 @@ module.exports = function (grunt) {
],
main: {
options: _.extend({}, mpConfig[name].browserOptions, browserOptions),
files: _.map(_.concat([''], mpConfig.mainDirs), function (value) {
return {
src: mpConfig.base + '/scripts/' + value + '/{,**/}*.js',
};
}),
files: makeFilesSpec('', mpConfig.mainDirs),
},
model: {
options: _.extend({}, mpConfig[name].modelOptions, modelOptions, mpConfig[name].browserOptions, browserOptions),
files: _.map(_.concat([mpConfig.modelDir], mpConfig.modelDirs), function (value) {
return {
src: mpConfig.base + '/scripts/' + value + '/{,**/}*.js',
};
}),
files: makeFilesSpec(mpConfig.modelDir, mpConfig.modelDirs),
},
view: {
options: _.extend({}, mpConfig[name].viewOptions, viewOptions, mpConfig[name].browserOptions, browserOptions),
files: _.map(_.concat([mpConfig.viewDir], mpConfig.viewDirs), function (value) {
return {
src: mpConfig.base + '/scripts/' + value + '/{,**/}*.js',
};
}),
files: makeFilesSpec(mpConfig.viewDir, mpConfig.viewDirs),
},
};
jscheckerAddExtra(mpConfig[name].all, initConfig[name], 'all');
......