incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [6/7] git commit: added -v switch to print version. specs too
Date Mon, 01 Oct 2012 06:46:30 GMT
added -v switch to print version. specs too


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

Branch: refs/heads/cordova-client
Commit: bfc63541178a1fdab3b7b82713b7aadf2881c7d8
Parents: 8f41b0c
Author: Fil Maj <maj.fil@gmail.com>
Authored: Thu Sep 27 14:55:57 2012 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Thu Sep 27 14:55:57 2012 -0700

----------------------------------------------------------------------
 bin/cordova      |    5 +++++
 spec/cli.spec.js |   11 +++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/bfc63541/bin/cordova
----------------------------------------------------------------------
diff --git a/bin/cordova b/bin/cordova
index 92e9603..dd0156e 100755
--- a/bin/cordova
+++ b/bin/cordova
@@ -11,6 +11,11 @@ process.on('uncaughtException', function(err){
 
 if (cmd === undefined)  {
     console.log(cordova.help());
+} else if (cmd[0] == '-') {
+    // options
+    if (cmd[1].toLowerCase() == 'v') {
+        console.log(require('../package').version);
+    }
 } else if (cordova.hasOwnProperty(cmd)) {
     try {
         var r = cordova[cmd].apply(this, opts);

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/bfc63541/spec/cli.spec.js
----------------------------------------------------------------------
diff --git a/spec/cli.spec.js b/spec/cli.spec.js
new file mode 100644
index 0000000..29404a5
--- /dev/null
+++ b/spec/cli.spec.js
@@ -0,0 +1,11 @@
+var shell = require('shelljs'),
+    path = require('path');
+
+describe('cli interface', function() {
+    it('should print out version with -v', function() {
+        var bin = path.join(__dirname, '..', 'bin', 'cordova');
+        bin += ' -v';
+        var output = shell.exec(bin, {silent:true}).output;
+        expect(output.indexOf(require('../package').version)).toBe(0);
+    });
+});


Mime
View raw message