cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwbro...@apache.org
Subject [07/15] git commit: [cli] Add shell entry point.
Date Thu, 14 Nov 2013 00:22:58 GMT
[cli] Add shell entry point.


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

Branch: refs/heads/doclet
Commit: 42728b1af338b59a7e37d341d9e25428cd79b7ae
Parents: 4da9318
Author: Michael Brooks <michael@michaelbrooks.ca>
Authored: Sat Nov 9 22:15:57 2013 -0800
Committer: Michael Brooks <michael@michaelbrooks.ca>
Committed: Sat Nov 9 22:15:57 2013 -0800

----------------------------------------------------------------------
 bin/index.js           | 13 +++++++++++++
 lib/cli/index.js       | 21 +++++++++++++++++++++
 spec/bin/index.spec.js |  6 +-----
 3 files changed, 35 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/42728b1a/bin/index.js
----------------------------------------------------------------------
diff --git a/bin/index.js b/bin/index.js
new file mode 100755
index 0000000..1e9b63c
--- /dev/null
+++ b/bin/index.js
@@ -0,0 +1,13 @@
+#!/usr/bin/env node
+
+/*!
+ * Module dependencies.
+ */
+
+var cli = require('../lib/cli');
+
+/*!
+ * Execute with the command-line arguments.
+ */
+
+cli.exec(process.argv);

http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/42728b1a/lib/cli/index.js
----------------------------------------------------------------------
diff --git a/lib/cli/index.js b/lib/cli/index.js
new file mode 100644
index 0000000..281a5c6
--- /dev/null
+++ b/lib/cli/index.js
@@ -0,0 +1,21 @@
+/*!
+ * Module dependencies.
+ */
+
+var optimist = require('optimist');
+
+/**
+ * CLI execution.
+ *
+ * Execute a command from the command-line.
+ *
+ * @param {String} argv is the value of process.argv.
+ */
+
+module.exports.exec = function(argv) {
+    argv = optimist.parse(argv);
+
+    //var paths = argv._.splice(2);
+    //argv._ = undefined;
+    //argv.$0 = undefined;
+};

http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/42728b1a/spec/bin/index.spec.js
----------------------------------------------------------------------
diff --git a/spec/bin/index.spec.js b/spec/bin/index.spec.js
index 8104447..8e12ec5 100644
--- a/spec/bin/index.spec.js
+++ b/spec/bin/index.spec.js
@@ -13,15 +13,11 @@ var shell = require('shelljs'),
 
 describe('$ doclet [options] <path>', function() {
     beforeEach(function() {
-        bin = 'node ' + path.resolve(path.join(__dirname, '..', '..', 'bin'));
+        bin = 'node ' + path.resolve(path.join(__dirname, '..', '..', 'bin', 'index.js'));
         options = { silent: true };
         spyOn(process.stdout, 'write');
     });
 
-    it('should exist', function() {
-        expect(shell.test('-e', bin)).toEqual(true);
-    });
-
     it('should have exit code 0', function() {
         var process = shell.exec(bin, options);
         expect(process.code).toEqual(0);


Mime
View raw message