Skip to content

Build: Replace @VERSION in release tags #1239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions build/release.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,38 @@
module.exports = function( Release ) {

var shell = require( "shelljs" ),
path = require( "path" );
path = require( "path" ),
fs = require( "fs" );

function replaceAtVersion() {
console.log( "Replacing @VERSION..." );
var matches = [];

function recurse( folder ) {
fs.readdirSync( folder ).forEach(function( fileName ) {
var content,
fullPath = folder + "/" + fileName;
if ( fs.statSync( fullPath ).isDirectory() ) {
recurse( fullPath );
return;
}
content = fs.readFileSync( fullPath, {
encoding: "utf-8"
});
if ( !/@VERSION/.test( content ) ) {
return;
}
matches.push( fullPath );
fs.writeFileSync( fullPath, content.replace( /@VERSION/g, Release.newVersion ) );
});
}

[ "ui", "themes" ].forEach( recurse );

console.log( "Replaced @VERSION in " + matches.length + " files." );

return matches;
}

function buildCDNPackage( callback ) {
console.log( "Building CDN package" );
Expand Down Expand Up @@ -34,7 +65,7 @@ Release.define({
"}</script>\n\nReleased on " + monthNames[ now.getMonth() ] + " " + now.getDate() + ", " + now.getFullYear() + "\n\n";
},
generateArtifacts: function( fn ) {
var manifestFiles;
var files;
function copyCdnFiles() {
var zipFile = shell.ls( "../jquery*-cdn.zip" )[ 0 ],
tmpFolder = "../tmp-zip-output",
Expand All @@ -50,11 +81,11 @@ Release.define({
shell.mkdir( "-p", "dist/cdn" );
shell.cp( tmpFolder + "/jquery-ui*.js", "dist/cdn" );
shell.cp( "-r", tmpFolder + "/themes", "dist/cdn" );
fn( manifestFiles );
fn( files );
}

Release.exec( "grunt manifest" );
manifestFiles = shell.ls( "*.jquery.json" );
files = shell.ls( "*.jquery.json" ).concat( replaceAtVersion() );
buildCDNPackage( copyCdnFiles );
}
});
Expand Down