aboutsummaryrefslogtreecommitdiffstats
path: root/build/release.js
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2014-05-06 16:23:06 +0200
committerJörn Zaefferer <joern.zaefferer@gmail.com>2014-05-08 20:27:36 +0200
commit0645ac45edc383ae30f17ce9e21a92d934ea5931 (patch)
treec303979f40f932fc51bd6181f4a7c5d4b1df105d /build/release.js
parentd1a6aedb90f4beea7a85c3c660dafee0424bcd31 (diff)
downloadjquery-ui-0645ac45edc383ae30f17ce9e21a92d934ea5931.tar.gz
jquery-ui-0645ac45edc383ae30f17ce9e21a92d934ea5931.zip
Build: Replace @VERSION in release tags
Fixes #10006 Closes gh-1239
Diffstat (limited to 'build/release.js')
-rw-r--r--build/release.js39
1 files changed, 35 insertions, 4 deletions
diff --git a/build/release.js b/build/release.js
index 6362ca498..5999d036f 100644
--- a/build/release.js
+++ b/build/release.js
@@ -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" );
@@ -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",
@@ -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 );
}
});