cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cordova-coho git commit: CB-9585 Support globs with 'coho verify-archive' command.
Date Thu, 03 Sep 2015 01:43:10 GMT
Repository: cordova-coho
Updated Branches:
  refs/heads/master 459ec62fd -> a701d6303


CB-9585 Support globs with 'coho verify-archive' command.

This adds supports for globs to the 'coho verify-archive' command, so you can pass wildcards
such as:

coho verify-archive *.tgz

(which is handy, since that's what 'coho create-archive' says to do :) ).


Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/a701d630
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/a701d630
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/a701d630

Branch: refs/heads/master
Commit: a701d6303eb86a1f609dd9afc6caa0e0188b0109
Parents: 459ec62
Author: Tim Barham <tim.barham@microsoft.com>
Authored: Tue Sep 1 10:32:49 2015 +1000
Committer: Tim Barham <tim.barham@microsoft.com>
Committed: Tue Sep 1 10:32:49 2015 +1000

----------------------------------------------------------------------
 package.json                 |  1 +
 src/create-verify-archive.js | 19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/a701d630/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index ef9988a..a6d2f3e 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
   "dependencies": {
     "chalk": "~0.4",
     "co": "~3.0",
+    "glob": "^5.0.14",
     "gnode": "^0.1.0",
     "nlf": "1.1.0",
     "opener": "^1.4.1",

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/a701d630/src/create-verify-archive.js
----------------------------------------------------------------------
diff --git a/src/create-verify-archive.js b/src/create-verify-archive.js
index 2757617..15e1d12 100644
--- a/src/create-verify-archive.js
+++ b/src/create-verify-archive.js
@@ -17,6 +17,7 @@ specific language governing permissions and limitations
 under the License.
 */
 
+var glob = require('glob');
 var optimist = require('optimist');
 var shelljs = require('shelljs');
 var chalk = require('chalk');
@@ -116,7 +117,7 @@ exports.createCommand = function*(argv) {
     print('Verify them using: coho verify-archive ' + path.join(outDir, '*.tgz'));
 }
 
-exports.verifyCommand = function*(argv) {
+exports.verifyCommand = function*() {
     var opt = flagutil.registerHelpFlag(optimist);
     var argv = opt
         .usage('Ensures the given .zip files match their neighbouring .asc, .md5, .sha files.\n'
+
@@ -134,8 +135,16 @@ exports.verifyCommand = function*(argv) {
         apputil.fatal('gpg command not found on your PATH. Refer to ' + settingUpGpg);
     }
 
-    for (var i = 0; i < zipPaths.length; ++i) {
-        var zipPath = apputil.resolveUserSpecifiedPath(zipPaths[i]);
+    var resolvedZipPaths = zipPaths.reduce(function (current, zipPath) {
+        var matchingPaths = glob.sync(apputil.resolveUserSpecifiedPath(zipPath));
+        if (!matchingPaths || !matchingPaths.length) {
+            apputil.fatal(chalk.red('No files found that match \'' + zipPath + '\''));
+        }
+        return current.concat(matchingPaths);
+    }, []);
+
+    for (var i = 0; i < resolvedZipPaths.length; ++i) {
+        var zipPath = resolvedZipPaths[i];
         var result = yield executil.execHelper(executil.ARGS('gpg --verify', zipPath + '.asc',
zipPath), false, true);
         if (result === null) {
             apputil.fatal('Verification failed. You may need to update your keys. Run: curl
"https://dist.apache.org/repos/dist/release/cordova/KEYS" | gpg --import');
@@ -150,8 +159,8 @@ exports.verifyCommand = function*(argv) {
         }
         print(zipPath + chalk.green(' signature and hashes verified.'));
     }
-    print(chalk.green('Verified ' + zipPaths.length + ' signatures and hashes.'));
-}
+    print(chalk.green('Verified ' + resolvedZipPaths.length + ' signatures and hashes.'));
+};
 
 function *computeHash(path, algo) {
     print('Computing ' + algo + ' for: ' + path);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message