]> source.dussan.org Git - jquery.git/commitdiff
Release: ensure Sizzle is the latest tag
authorTimmy Willison <timmywillisn@gmail.com>
Fri, 23 May 2014 16:45:51 +0000 (12:45 -0400)
committerTimmy Willison <timmywillisn@gmail.com>
Fri, 23 May 2014 17:49:57 +0000 (13:49 -0400)
Fixes #14915

build/ensure-sizzle.js [new file with mode: 0644]
build/release.js
package.json

diff --git a/build/ensure-sizzle.js b/build/ensure-sizzle.js
new file mode 100644 (file)
index 0000000..01a128e
--- /dev/null
@@ -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;
index 529137da7163e5ad2a3662872e096e3b65d0e5db..9f6b2e2a98472688d6b41b97047f173bc1292687 100644 (file)
@@ -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",
@@ -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
index d9953d485ea5280c511ed2a82184c2483123dd1f..ebf559f6039c97f780e0b311962b922ad88f08e4 100644 (file)
@@ -30,6 +30,7 @@
   ],
   "dependencies": {},
   "devDependencies": {
+    "colors": "^0.6.2",
     "commitplease": "1.7.0",
     "grunt": "0.4.2",
     "grunt-bowercopy": "0.7.1",