mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Release: fix CDN archive creation
Fixes gh-1940
This commit is contained in:
parent
aae998b544
commit
e0673dfedb
@ -45,13 +45,15 @@ module.exports = function( Release ) {
|
||||
* @param {Function} callback
|
||||
*/
|
||||
dist: function( 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"
|
||||
];
|
||||
|
@ -1,6 +1,7 @@
|
||||
var
|
||||
fs = require( "fs" ),
|
||||
shell = require( "shelljs" ),
|
||||
path = require( "path" ),
|
||||
|
||||
cdnFolder = "dist/cdn",
|
||||
|
||||
@ -55,19 +56,28 @@ function makeReleaseCopies( Release ) {
|
||||
});
|
||||
}
|
||||
|
||||
function makeArchive( Release, cdn, files ) {
|
||||
function makeArchives( Release, callback ) {
|
||||
|
||||
Release.chdir( Release.dir.repo );
|
||||
|
||||
function makeArchive( cdn, files, callback ) {
|
||||
if ( Release.preRelease ) {
|
||||
console.log( "Skipping archive creation for " + cdn + "; this is a beta release." );
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log( "Creating production archive for " + cdn );
|
||||
|
||||
var archiver = require( "archiver" )( "zip" ),
|
||||
var sum,
|
||||
archiver = require( "archiver" )( "zip" ),
|
||||
md5file = cdnFolder + "/" + cdn + "-md5.txt",
|
||||
output = fs.createWriteStream(
|
||||
cdnFolder + "/" + cdn + "-jquery-" + Release.newVersion + ".zip"
|
||||
);
|
||||
),
|
||||
rver = /VER/;
|
||||
|
||||
output.on( "close", callback );
|
||||
|
||||
output.on( "error", function( err ) {
|
||||
throw err;
|
||||
@ -76,31 +86,36 @@ function makeArchive( Release, cdn, files ) {
|
||||
archiver.pipe( output );
|
||||
|
||||
files = files.map(function( item ) {
|
||||
return cdnFolder + "/" + item.replace( /VER/g, Release.newVersion );
|
||||
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( callback ) {
|
||||
makeArchive( "googlecdn", googleFilesCDN, callback );
|
||||
}
|
||||
|
||||
function buildMicrosoftCDN( callback ) {
|
||||
makeArchive( "mscdn", msFilesCDN, callback );
|
||||
}
|
||||
|
||||
buildGoogleCDN(function() {
|
||||
buildMicrosoftCDN( callback );
|
||||
});
|
||||
}
|
||||
|
||||
function buildGoogleCDN( Release ) {
|
||||
makeArchive( Release, "googlecdn", googleFilesCDN );
|
||||
}
|
||||
|
||||
function buildMicrosoftCDN( Release ) {
|
||||
makeArchive( Release, "mscdn", msFilesCDN );
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
makeReleaseCopies: makeReleaseCopies,
|
||||
buildGoogleCDN: buildGoogleCDN,
|
||||
buildMicrosoftCDN: buildMicrosoftCDN
|
||||
makeArchives: makeArchives
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user