Skip to content

Commit

Permalink
grunt custom saves minified version automattically. Close gh-856, Fix…
Browse files Browse the repository at this point in the history
…es #12059
  • Loading branch information
gnarf authored and rwaldron committed Jul 11, 2012
1 parent 7b5ffcd commit faf2eb4
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions grunt.js
Expand Up @@ -121,16 +121,18 @@ module.exports = function( grunt ) {
grunt.registerTask( "dev", "selector build:*:* lint" ); grunt.registerTask( "dev", "selector build:*:* lint" );


// Load the "compare_size" task from NPM packages // Load the "compare_size" task from NPM packages
grunt.loadNpmTasks("grunt-compare-size"); grunt.loadNpmTasks( "grunt-compare-size" );


grunt.registerTask( "testswarm", function( commit, configFile ) { grunt.registerTask( "testswarm", function( commit, configFile ) {
var testswarm = require( "testswarm" ), var testswarm = require( "testswarm" ),
testUrls = [], testUrls = [],
config = grunt.file.readJSON( configFile ).jquery; config = grunt.file.readJSON( configFile ).jquery,
var tests = "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector support traversing".split( " " ); tests = "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector support traversing".split( " " );

tests.forEach(function( test ) { tests.forEach(function( test ) {
testUrls.push( config.testUrl + commit + "/test/index.html?module=" + test ); testUrls.push( config.testUrl + commit + "/test/index.html?module=" + test );
}); });

testswarm({ testswarm({
url: config.swarmUrl, url: config.swarmUrl,
pollInterval: 10000, pollInterval: 10000,
Expand Down Expand Up @@ -227,7 +229,7 @@ module.exports = function( grunt ) {


grunt.utils.spawn({ grunt.utils.spawn({
cmd: "grunt", cmd: "grunt",
args: [ "build:*:*:" + modules ] args: [ "build:*:*:" + modules, "min" ]
}, function( err, result ) { }, function( err, result ) {
if ( err ) { if ( err ) {
grunt.verbose.error(); grunt.verbose.error();
Expand Down Expand Up @@ -271,6 +273,7 @@ module.exports = function( grunt ) {
} }
}; };


// append commit id to version
if ( process.env.COMMIT ) { if ( process.env.COMMIT ) {
version += " " + process.env.COMMIT; version += " " + process.env.COMMIT;
} }
Expand Down Expand Up @@ -301,6 +304,14 @@ module.exports = function( grunt ) {
} }
}); });


// append excluded modules to version
if ( Object.keys( excluded ).length ) {
version += " -" + Object.keys( excluded ).join( ",-" );
// set pkg.version to version with excludes, so minified file picks it up
grunt.config.set( "pkg.version", version );
}


// conditionally concatenate source // conditionally concatenate source
this.file.src.forEach(function( filepath ) { this.file.src.forEach(function( filepath ) {
var flag = filepath.flag, var flag = filepath.flag,
Expand Down

0 comments on commit faf2eb4

Please sign in to comment.