a421f05b by Adam Heath

Move buildList into build task function.

1 parent b925f472
......@@ -83,16 +83,6 @@ module.exports = function (grunt) {
};
}
var checkList = [];
var buildList = [
'check',
'clean:montyPython',
'post-clean',
];
var postCleanList = [];
grunt.registerTask('post-clean', 'post-clean', function() {
grunt.task.run(postCleanList);
});
function externalMultiTask(name, desc, command, updateOptions) {
grunt.log.writeln('registering multiTask', name);
......@@ -200,7 +190,6 @@ module.exports = function (grunt) {
generate: {
},
};
buildList.push('punch:generate');
htmlSourceDir = '.grunt/holygrail/punch/output-generate';
initConfig.copy.dist.files.push({
expand: true,
......@@ -428,6 +417,46 @@ module.exports = function (grunt) {
};
}
grunt.initConfig(initConfig);
grunt.registerTask('check', checkList);
grunt.registerTask('default', [
'check',
]);
grunt.registerTask('build', 'build the system', function() {
var buildList = [
'check',
'clean:montyPython',
];
var featureFlags = {};
if (arguments.length) {
for (var i in arguments) {
featureFlags['BUILD_' + arguments[i].toUpperCase()] = true;
}
grunt.registerTask('writeFeatureFlags', 'write feature flags', function() {
var lines = [
'(function(container, propName) {',
'container = (container[propName] = container[propName] || {});',
];
for (var flag in featureFlags) {
lines.push('require.config.featureFlags[' + JSON.stringify(flag) + ']=' + JSON.stringify(featureFlags[flag]) + ';');
}
//lines.push('return bundles;');
lines.push('})(require.config, \'featureFlags\');');
if (lines.length == 3) {
lines = [];
}
grunt.file.write('.grunt/holygrail/scripts/featureFlags.js', lines.join('\n'));
});
buildList.add('writeFeatureFlags');
}
if (mpConfig.punch) {
buildList.push('punch:generate');
}
buildList.push('useminPrepare'); // html
//buildList.push('usemin:views'
if (mpConfig.bower) {
......@@ -465,38 +494,6 @@ module.exports = function (grunt) {
buildList.push('usemin:css'); // montyPython
buildList.push('htmlmin'); // montyPython
grunt.initConfig(initConfig);
grunt.registerTask('check', checkList);
grunt.registerTask('default', [
'check',
]);
grunt.registerTask('build', 'build the system', function() {
var featureFlags = {};
if (arguments.length) {
for (var i in arguments) {
featureFlags['BUILD_' + arguments[i].toUpperCase()] = true;
}
grunt.registerTask('writeFeatureFlags', 'write feature flags', function() {
var lines = [
'(function(container, propName) {',
'container = (container[propName] = container[propName] || {});',
];
for (var flag in featureFlags) {
lines.push('require.config.featureFlags[' + JSON.stringify(flag) + ']=' + JSON.stringify(featureFlags[flag]) + ';');
}
//lines.push('return bundles;');
lines.push('})(require.config, \'featureFlags\');');
if (lines.length == 3) {
lines = [];
}
grunt.file.write('.grunt/holygrail/scripts/featureFlags.js', lines.join('\n'));
});
postCleanList.add('writeFeatureFlags');
}
grunt.task.run(buildList);
});
}
......