cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject cordova-cli git commit: CB-8379 Have --version print out cordova-lib version if it's not the same as CLI's version
Date Fri, 30 Jan 2015 00:50:18 GMT
Repository: cordova-cli
Updated Branches:
  refs/heads/master 7868590b6 -> 545cac1e0


CB-8379 Have --version print out cordova-lib version if it's not the same as CLI's version

Useful for local testing


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

Branch: refs/heads/master
Commit: 545cac1e0a96caa97a2ba8bcd54120495ce5af50
Parents: 7868590
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Jan 29 19:49:29 2015 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Jan 29 19:49:29 2015 -0500

----------------------------------------------------------------------
 spec/cli.spec.js | 6 +++---
 src/cli.js       | 8 +++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/545cac1e/spec/cli.spec.js
----------------------------------------------------------------------
diff --git a/spec/cli.spec.js b/spec/cli.spec.js
index 81f6b6d..734791a 100644
--- a/spec/cli.spec.js
+++ b/spec/cli.spec.js
@@ -42,17 +42,17 @@ describe("cordova cli", function () {
 
             it("will spit out the version with -v", function () {
                 cli(["node", "cordova", "-v"]);
-                expect(console.log).toHaveBeenCalledWith(version);
+                expect(console.log.mostRecentCall.args[0]).toMatch(version);
             });
 
             it("will spit out the version with --version", function () {
                 cli(["node", "cordova", "--version"]);
-                expect(console.log).toHaveBeenCalledWith(version);
+                expect(console.log.mostRecentCall.args[0]).toMatch(version);
             });
 
             it("will spit out the version with -v anywher", function () {
                 cli(["node", "cordova", "one", "-v", "three"]);
-                expect(console.log).toHaveBeenCalledWith(version);
+                expect(console.log.mostRecentCall.args[0]).toMatch(version);
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/545cac1e/src/cli.js
----------------------------------------------------------------------
diff --git a/src/cli.js b/src/cli.js
index 57f13ff..d974452 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -102,7 +102,13 @@ function cli(inputArgs) {
 
 
     if (args.version) {
-        console.log( require('../package').version );
+        var cliVersion = require('../package').version;
+        var libVersion = require('cordova-lib/package').version;
+        var toPrint = cliVersion;
+        if (cliVersion != libVersion || /-dev$/.exec(libVersion)) {
+            toPrint += ' (cordova-lib@' + libVersion + ')';
+        }
+        console.log(toPrint);
         return;
     }
 


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


Mime
View raw message