diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2013-05-08 20:00:24 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2013-05-08 20:00:24 -0400 |
commit | 47f56f1612b907ec9eaa7111c7af66d335279fa2 (patch) | |
tree | 0c1b923161be37c14fc4839cb6c7f2f0607bdf29 /build | |
parent | 5e42df0517cefa6e81bdc5c3206740a5958b545c (diff) | |
download | jquery-47f56f1612b907ec9eaa7111c7af66d335279fa2.tar.gz jquery-47f56f1612b907ec9eaa7111c7af66d335279fa2.zip |
Create CDN archives in the build script.
Diffstat (limited to 'build')
-rw-r--r-- | build/release.js | 52 |
1 files changed, 45 insertions, 7 deletions
diff --git a/build/release.js b/build/release.js index 9cda180f1..f2e4cf560 100644 --- a/build/release.js +++ b/build/release.js @@ -13,7 +13,6 @@ var fs = require("fs"), var releaseVersion, nextVersion, - CDNFiles, isBeta, pkg, branch, @@ -41,7 +40,18 @@ var releaseVersion, // "jquery-latest.js": devFile, // "jquery-latest.min.js": minFile, // "jquery-latest.min.map": mapFile - }; + }, + + jQueryFilesCDN = [], + + googleFilesCDN = [ + "jquery.js", "jquery.min.js", "jquery.min.map" + ], + + msFilesCDN = [ + "jquery-VER.js", "jquery-VER.min.js", "jquery-VER.min.map" + ]; + steps( initialize, @@ -50,7 +60,9 @@ steps( gruntBuild, makeReleaseCopies, setNextVersion, - uploadToCDN, + copyTojQueryCDN, + buildGoogleCDN, + buildMicrosoftCDN, pushToGithub, exit ); @@ -133,7 +145,6 @@ function gruntBuild( next ) { } function makeReleaseCopies( next ) { - CDNFiles = {}; Object.keys( releaseFiles ).forEach(function( key ) { var text, builtFile = releaseFiles[ key ], @@ -158,7 +169,7 @@ function makeReleaseCopies( next ) { copy( builtFile, releaseFile ); } - CDNFiles[ releaseFile ] = builtFile; + jQueryFilesCDN.push( releaseFile ); } }); next(); @@ -169,10 +180,10 @@ function setNextVersion( next ) { git( [ "commit", "-a", "-m", "Updating the source version to " + nextVersion + "✓™" ], next, debug ); } -function uploadToCDN( next ) { +function copyTojQueryCDN( next ) { var cmds = []; - Object.keys( CDNFiles ).forEach(function( name ) { + jQueryFilesCDN.forEach(function( name ) { cmds.push(function( nxt ){ exec( "scp", [ name, scpURL ], nxt, debug || skipRemote ); }); @@ -185,6 +196,14 @@ function uploadToCDN( next ) { steps.apply( this, cmds ); } +function buildGoogleCDN( next ) { + makeArchive( "googlecdn", googleFilesCDN, next ); +} + +function buildMicrosoftCDN( next ) { + makeArchive( "mscdn", msFilesCDN, next ); +} + function pushToGithub( next ) { git( [ "push", "--tags", repoURL, branch ], next, debug || skipRemote ); } @@ -209,6 +228,25 @@ function updatePackageVersion( ver ) { } } +function makeArchive( cdn, files, fn ) { + + if ( isBeta ) { + console.log( "Skipping archive creation for " + cdn + "; " + releaseVersion + " is beta" ); + process.nextTick( fn ); + return + } + console.log("Creating production archive for " + cdn ); + files = files.map(function( item ) { + return "dist/" + item.replace( /VER/g, releaseVersion ); + }); + var md5file = "dist/" + cdn + "-md5.txt"; + exec( "md5sum", files, function( err, stdout, stderr ) { + fs.writeFileSync( md5file, stdout ); + files.push( md5file ); + exec( "tar", [ "-czvf", "dist/" + cdn + "-jquery-" + releaseVersion + ".tar.gz" ].concat( files ), fn, false ); + }, false ); +} + function copy( oldFile, newFile ) { console.log( "Copying " + oldFile + " to " + newFile ); if ( !debug ) { |