aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2015-01-29 16:21:39 -0800
committerTimmy Willison <timmywillisn@gmail.com>2015-01-29 17:38:35 -0800
commite0673dfedb9ad07d8e68f28a54453b975c412c33 (patch)
treeda5430af9016d2dd68dc98719e941cbe413ef237 /build
parentaae998b5449f35dc71e87e360aee5bd0022e7c8e (diff)
downloadjquery-e0673dfedb9ad07d8e68f28a54453b975c412c33.tar.gz
jquery-e0673dfedb9ad07d8e68f28a54453b975c412c33.zip
Release: fix CDN archive creation
Fixes gh-1940
Diffstat (limited to 'build')
-rw-r--r--build/release.js6
-rw-r--r--build/release/cdn.js75
2 files changed, 49 insertions, 32 deletions
diff --git a/build/release.js b/build/release.js
index 388bea873..231e2c4c3 100644
--- a/build/release.js
+++ b/build/release.js
@@ -45,13 +45,15 @@ module.exports = function( Release ) {
* @param {Function} callback
*/
dist: function( callback ) {
- dist( Release, callback );
+ cdn.makeArchives( Release, function() {
+ dist( Release, callback );
+ });
}
});
};
module.exports.dependencies = [
- "archiver@0.5.2",
+ "archiver@0.14.2",
"shelljs@0.2.6",
"npm@2.3.0"
];
diff --git a/build/release/cdn.js b/build/release/cdn.js
index ebca6bad6..8b0658812 100644
--- a/build/release/cdn.js
+++ b/build/release/cdn.js
@@ -1,6 +1,7 @@
var
fs = require( "fs" ),
shell = require( "shelljs" ),
+ path = require( "path" ),
cdnFolder = "dist/cdn",
@@ -55,52 +56,66 @@ function makeReleaseCopies( Release ) {
});
}
-function makeArchive( Release, cdn, files ) {
- if ( Release.preRelease ) {
- console.log( "Skipping archive creation for " + cdn + "; this is a beta release." );
- return;
- }
+function makeArchives( Release, callback ) {
- console.log( "Creating production archive for " + cdn );
+ Release.chdir( Release.dir.repo );
- var archiver = require( "archiver" )( "zip" ),
- md5file = cdnFolder + "/" + cdn + "-md5.txt",
- output = fs.createWriteStream(
- cdnFolder + "/" + cdn + "-jquery-" + Release.newVersion + ".zip"
- );
+ function makeArchive( cdn, files, callback ) {
+ if ( Release.preRelease ) {
+ console.log( "Skipping archive creation for " + cdn + "; this is a beta release." );
+ callback();
+ return;
+ }
- output.on( "error", function( err ) {
- throw err;
- });
+ console.log( "Creating production archive for " + cdn );
- archiver.pipe( output );
+ var sum,
+ archiver = require( "archiver" )( "zip" ),
+ md5file = cdnFolder + "/" + cdn + "-md5.txt",
+ output = fs.createWriteStream(
+ cdnFolder + "/" + cdn + "-jquery-" + Release.newVersion + ".zip"
+ ),
+ rver = /VER/;
- files = files.map(function( item ) {
- return cdnFolder + "/" + item.replace( /VER/g, Release.newVersion );
- });
+ output.on( "close", callback );
+
+ output.on( "error", function( err ) {
+ throw err;
+ });
+
+ archiver.pipe( output );
+
+ files = files.map(function( item ) {
+ return "dist" + ( rver.test( item ) ? "/cdn" : "" ) + "/" +
+ item.replace( rver, Release.newVersion );
+ });
- shell.exec( "md5sum", files, function( code, stdout ) {
- fs.writeFileSync( md5file, stdout );
+ sum = Release.exec( "md5sum " + files.join( " " ), "Error retrieving md5sum" );
+ fs.writeFileSync( md5file, sum );
files.push( md5file );
files.forEach(function( file ) {
- archiver.append( fs.createReadStream( file ), { name: file } );
+ archiver.append( fs.createReadStream( file ),
+ { name: path.basename( file ) } );
});
archiver.finalize();
- });
-}
+ }
-function buildGoogleCDN( Release ) {
- makeArchive( Release, "googlecdn", googleFilesCDN );
-}
+ function buildGoogleCDN( callback ) {
+ makeArchive( "googlecdn", googleFilesCDN, callback );
+ }
+
+ function buildMicrosoftCDN( callback ) {
+ makeArchive( "mscdn", msFilesCDN, callback );
+ }
-function buildMicrosoftCDN( Release ) {
- makeArchive( Release, "mscdn", msFilesCDN );
+ buildGoogleCDN(function() {
+ buildMicrosoftCDN( callback );
+ });
}
module.exports = {
makeReleaseCopies: makeReleaseCopies,
- buildGoogleCDN: buildGoogleCDN,
- buildMicrosoftCDN: buildMicrosoftCDN
+ makeArchives: makeArchives
};