Skip to content

Commit

Permalink
Build process fixes (grunt-lodashbuilder still needs to be updated fo…
Browse files Browse the repository at this point in the history
…r this to work)
  • Loading branch information
asciidisco committed Feb 25, 2013
1 parent 9afd4a3 commit 5518533
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 58 deletions.
85 changes: 30 additions & 55 deletions Gruntfile.js
Expand Up @@ -16,10 +16,10 @@ module.exports = function(grunt) {
},

copy: {
dist: {
files: {
'tmp/doNotKillAlmond/': 'test/fixtures/*.js'
}
main: {
files: [
{src: ['test/fixtures/*.js'], dest: 'tmp/doNotKillAlmond/', flatten: true, filter: 'isFile'}, // includes files in path
]
}
},

Expand All @@ -34,7 +34,7 @@ module.exports = function(grunt) {
},
rmCombined: {
options: {
baseUrl: 'tmp/doNotKillAlmond',
baseUrl: 'tmp/doNotKillAlmond/test/fixtures',
name: 'project',
out: 'tmp/requirejs-killed.js',
almond: true,
Expand Down Expand Up @@ -104,58 +104,33 @@ module.exports = function(grunt) {
// build all the projects from the ´examples´ folder
// to run some tests against them
grunt.registerTask('buildExampleProjects', function () {
var done = this.async(),
util = grunt.utils || grunt.util,
preparation = [false, false, false, false],
checkForPreparation = function () {
if (util._.all(preparation, util._.identity)) {
grunt.log.ok('all examples build');
done();
}
};

// build libglobal example
util.spawn({
cmd: 'grunt',
args: ['build', '--force'],
opts: {cwd: 'examples/libglobal'}
}, function () {
grunt.log.writeln('> "libglobal" example build');
preparation[0] = true;
checkForPreparation();
});

// build libglobal-hybrid example
util.spawn({
cmd: 'grunt',
args: ['build', '--force'],
opts: {cwd: 'examples/libglobal-hybrid'}
}, function () {
grunt.log.writeln('> "libglobal-hybrid" example build');
preparation[3] = true;
checkForPreparation();
});
var done = this.async();
var util = grunt.util;
var examples = 'libglobal libglobal-hybrid multipage multipage-shim'.split(' ');
var preparation = [];

var checkForPreparation = function () {
if (util._.all(preparation, util._.identity)) {
grunt.log.ok('all examples build');
done();
}
};

// build multipage example
util.spawn({
cmd: 'grunt',
args: ['build', '--force'],
opts: {cwd: 'examples/multipage'}
}, function () {
grunt.log.writeln('> "multipage" example build');
preparation[1] = true;
checkForPreparation();
examples.forEach(function () {
preparation.push(false);
});

// build multipage-shim example
util.spawn({
cmd: 'grunt',
args: ['build', '--force'],
opts: {cwd: 'examples/multipage-shim'}
}, function () {
grunt.log.writeln('> "multipage-shim" example build');
preparation[2] = true;
checkForPreparation();
// build examples
examples.forEach(function (example, idx) {
util.spawn({
cmd: 'grunt',
args: ['build', '--force'],
opts: {cwd: 'examples/' + example}
}, function () {
grunt.log.writeln('> "' + example + '" example build');
preparation[idx] = true;
checkForPreparation();
});
});

});
Expand All @@ -172,5 +147,5 @@ module.exports = function(grunt) {
grunt.registerTask('setUp', ['buildExampleProjects', 'copy', 'requirejs']);

// Default task.
grunt.registerTask('default', ['setUp', 'jshint', 'nodeunit', 'clean']);
grunt.registerTask('default', ['setUp', 'jshint', 'nodeunit', 'qunit', 'clean']);
};
4 changes: 2 additions & 2 deletions examples/libglobal-hybrid/dist/principium.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion test/require_test.js
Expand Up @@ -80,7 +80,7 @@ exports['require'] = {
var isCustom = rjsversion.isCustomLibrary();

test.equal((typeof rjs === 'function'), true, 'Default library is used if no config given');
test.equal(version, '2.1.2', 'Version is current');
test.equal(version, '2.1.4', 'Version is current');
test.equal(isCustom, false, 'Default library is used if no config given');

test.done();
Expand Down Expand Up @@ -150,6 +150,9 @@ exports['require'] = {
};

Q.fcall(jqueryCustomBuilder, config)
.fail(function () {
console.log(arguments);
})
.then(function(modifiedConfig) {
test.equal((typeof modifiedConfig.__builderOutput === 'object'), true, 'Builder output has been generated');
test.equal(modifiedConfig.__builderOutput[0].name, 'jquery', 'Builder output has been named correctly');
Expand Down

0 comments on commit 5518533

Please sign in to comment.