Release: Instantiate a zip archiver, run archivers async

This commit is contained in:
Timmy Willison 2014-01-23 15:45:23 -05:00
parent a20494228d
commit de7702ac59

View File

@ -74,15 +74,15 @@ module.exports = function( Release ) {
}); });
} }
function buildGoogleCDN( next ) { function buildGoogleCDN() {
makeArchive( "googlecdn", googleFilesCDN, next ); makeArchive( "googlecdn", googleFilesCDN );
} }
function buildMicrosoftCDN( next ) { function buildMicrosoftCDN() {
makeArchive( "mscdn", msFilesCDN, next ); makeArchive( "mscdn", msFilesCDN );
} }
function makeArchive( cdn, files, next ) { function makeArchive( cdn, files ) {
if ( Release.preRelease ) { if ( Release.preRelease ) {
console.log( "Skipping archive creation for " + cdn + "; this is a beta release." ); console.log( "Skipping archive creation for " + cdn + "; this is a beta release." );
return; return;
@ -90,7 +90,7 @@ module.exports = function( Release ) {
console.log( "Creating production archive for " + cdn ); console.log( "Creating production archive for " + cdn );
var archiver = require( "archiver" ), var archiver = require( "archiver" )( "zip" ),
md5file = cdnFolder + "/" + cdn + "-md5.txt", md5file = cdnFolder + "/" + cdn + "-md5.txt",
output = fs.createWriteStream( cdnFolder + "/" + cdn + "-jquery-" + Release.newVersion + ".zip" ); output = fs.createWriteStream( cdnFolder + "/" + cdn + "-jquery-" + Release.newVersion + ".zip" );
@ -98,7 +98,6 @@ module.exports = function( Release ) {
throw err; throw err;
}); });
output.on( "close", next );
archiver.pipe( output ); archiver.pipe( output );
files = files.map(function( item ) { files = files.map(function( item ) {
@ -138,8 +137,10 @@ module.exports = function( Release ) {
* Release completion * Release completion
*/ */
complete: function() { complete: function() {
// Build CDN archives // Build CDN archives async
Release._walk([ buildGoogleCDN, buildMicrosoftCDN, _complete ]); buildGoogleCDN();
buildMicrosoftCDN();
_complete();
}, },
/** /**
* Our trac milestones are different than the new version * Our trac milestones are different than the new version