a421f05b by Adam Heath

Move buildList into build task function.

1 parent b925f472
...@@ -83,16 +83,6 @@ module.exports = function (grunt) { ...@@ -83,16 +83,6 @@ module.exports = function (grunt) {
83 }; 83 };
84 } 84 }
85 var checkList = []; 85 var checkList = [];
86 var buildList = [
87 'check',
88 'clean:montyPython',
89 'post-clean',
90 ];
91 var postCleanList = [];
92
93 grunt.registerTask('post-clean', 'post-clean', function() {
94 grunt.task.run(postCleanList);
95 });
96 86
97 function externalMultiTask(name, desc, command, updateOptions) { 87 function externalMultiTask(name, desc, command, updateOptions) {
98 grunt.log.writeln('registering multiTask', name); 88 grunt.log.writeln('registering multiTask', name);
...@@ -200,7 +190,6 @@ module.exports = function (grunt) { ...@@ -200,7 +190,6 @@ module.exports = function (grunt) {
200 generate: { 190 generate: {
201 }, 191 },
202 }; 192 };
203 buildList.push('punch:generate');
204 htmlSourceDir = '.grunt/holygrail/punch/output-generate'; 193 htmlSourceDir = '.grunt/holygrail/punch/output-generate';
205 initConfig.copy.dist.files.push({ 194 initConfig.copy.dist.files.push({
206 expand: true, 195 expand: true,
...@@ -428,6 +417,46 @@ module.exports = function (grunt) { ...@@ -428,6 +417,46 @@ module.exports = function (grunt) {
428 }; 417 };
429 } 418 }
430 419
420
421 grunt.initConfig(initConfig);
422
423 grunt.registerTask('check', checkList);
424
425 grunt.registerTask('default', [
426 'check',
427 ]);
428
429 grunt.registerTask('build', 'build the system', function() {
430 var buildList = [
431 'check',
432 'clean:montyPython',
433 ];
434 var featureFlags = {};
435 if (arguments.length) {
436 for (var i in arguments) {
437 featureFlags['BUILD_' + arguments[i].toUpperCase()] = true;
438 }
439 grunt.registerTask('writeFeatureFlags', 'write feature flags', function() {
440 var lines = [
441 '(function(container, propName) {',
442 'container = (container[propName] = container[propName] || {});',
443 ];
444 for (var flag in featureFlags) {
445 lines.push('require.config.featureFlags[' + JSON.stringify(flag) + ']=' + JSON.stringify(featureFlags[flag]) + ';');
446 }
447 //lines.push('return bundles;');
448 lines.push('})(require.config, \'featureFlags\');');
449 if (lines.length == 3) {
450 lines = [];
451 }
452 grunt.file.write('.grunt/holygrail/scripts/featureFlags.js', lines.join('\n'));
453 });
454 buildList.add('writeFeatureFlags');
455 }
456
457 if (mpConfig.punch) {
458 buildList.push('punch:generate');
459 }
431 buildList.push('useminPrepare'); // html 460 buildList.push('useminPrepare'); // html
432 //buildList.push('usemin:views' 461 //buildList.push('usemin:views'
433 if (mpConfig.bower) { 462 if (mpConfig.bower) {
...@@ -465,38 +494,6 @@ module.exports = function (grunt) { ...@@ -465,38 +494,6 @@ module.exports = function (grunt) {
465 buildList.push('usemin:css'); // montyPython 494 buildList.push('usemin:css'); // montyPython
466 buildList.push('htmlmin'); // montyPython 495 buildList.push('htmlmin'); // montyPython
467 496
468 grunt.initConfig(initConfig);
469
470 grunt.registerTask('check', checkList);
471
472 grunt.registerTask('default', [
473 'check',
474 ]);
475
476 grunt.registerTask('build', 'build the system', function() {
477 var featureFlags = {};
478 if (arguments.length) {
479 for (var i in arguments) {
480 featureFlags['BUILD_' + arguments[i].toUpperCase()] = true;
481 }
482 grunt.registerTask('writeFeatureFlags', 'write feature flags', function() {
483 var lines = [
484 '(function(container, propName) {',
485 'container = (container[propName] = container[propName] || {});',
486 ];
487 for (var flag in featureFlags) {
488 lines.push('require.config.featureFlags[' + JSON.stringify(flag) + ']=' + JSON.stringify(featureFlags[flag]) + ';');
489 }
490 //lines.push('return bundles;');
491 lines.push('})(require.config, \'featureFlags\');');
492 if (lines.length == 3) {
493 lines = [];
494 }
495 grunt.file.write('.grunt/holygrail/scripts/featureFlags.js', lines.join('\n'));
496 });
497 postCleanList.add('writeFeatureFlags');
498 }
499
500 grunt.task.run(buildList); 497 grunt.task.run(buildList);
501 }); 498 });
502 } 499 }
......