Skip to content

Commit

Permalink
Release: ensure Sizzle is the latest tag
Browse files Browse the repository at this point in the history
Fixes #14915
  • Loading branch information
timmywil committed May 23, 2014
1 parent b80700c commit 1d93106
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
40 changes: 40 additions & 0 deletions build/ensure-sizzle.js
@@ -0,0 +1,40 @@
var fs = require( "fs" ),
bower = require( "grunt-bowercopy/node_modules/bower" ),
sizzleLoc = __dirname + "/../src/sizzle/dist/sizzle.js",
rversion = /Engine v(\d+\.\d+\.\d+(?:-\w+)?)/;

/**
* Retrieve the latest tag of Sizzle from bower
* @param {Function(string)} callback
*/
function getLatestSizzle( callback ) {
bower.commands.info( "sizzle", "version" )
.on( "end", callback );
}

/**
* Ensure the /src folder has the latest tag of Sizzle
* @param {Object} Release
* @param {Function} callback
*/
function ensureSizzle( Release, callback ) {
console.log();
console.log( "Checking Sizzle version..." );
getLatestSizzle(function( latest ) {
var match = rversion.exec( fs.readFileSync( sizzleLoc, "utf8" ) ),
version = match ? match[ 1 ] : "Not Found";

if ( version !== latest ) {
console.log(
"The Sizzle version in the src folder (" + version.red +
") is not the latest tag (" + latest.green + ")."
);
Release.confirm( callback );
} else {
console.log( "Sizzle is latest (" + latest.green + ")" );
callback();
}
});
}

module.exports = ensureSizzle;
8 changes: 8 additions & 0 deletions build/release.js
Expand Up @@ -3,6 +3,7 @@ module.exports = function( Release ) {
var
fs = require( "fs" ),
shell = require( "shelljs" ),
ensureSizzle = require( "./ensure-sizzle" ),

devFile = "dist/jquery.js",
minFile = "dist/jquery.min.js",
Expand Down Expand Up @@ -116,6 +117,13 @@ module.exports = function( Release ) {
npmPublish: true,
issueTracker: "trac",
contributorReportId: 508,
/**
* Ensure the repo is in a proper state before release
* @param {Function} callback
*/
checkRepoState: function( callback ) {
ensureSizzle( Release, callback );
},
/**
* Generates any release artifacts that should be included in the release.
* The callback must be invoked with an array of files that should be
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -30,6 +30,7 @@
],
"dependencies": {},
"devDependencies": {
"colors": "^0.6.2",
"commitplease": "1.7.0",
"grunt": "0.4.2",
"grunt-bowercopy": "0.7.1",
Expand Down

0 comments on commit 1d93106

Please sign in to comment.