You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by lo...@apache.org on 2014/08/21 20:23:06 UTC

[05/15] git commit: updated tests and cli to pass all tests

updated tests and cli to pass all tests


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

Branch: refs/heads/master
Commit: 1aef477d1dc95bc1faa0869458a638473e7cb03e
Parents: 7aef391
Author: Lorin Beer <lo...@gmail.com>
Authored: Fri Jun 13 12:42:45 2014 -0700
Committer: Lorin Beer <lo...@gmail.com>
Committed: Wed Aug 20 11:19:19 2014 -0700

----------------------------------------------------------------------
 spec/cli.spec.js |  1 +
 src/cli.js       | 35 ++++++++++++++++++++++++++++++++---
 2 files changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1aef477d/spec/cli.spec.js
----------------------------------------------------------------------
diff --git a/spec/cli.spec.js b/spec/cli.spec.js
index 382fdf0..1278f10 100644
--- a/spec/cli.spec.js
+++ b/spec/cli.spec.js
@@ -38,6 +38,7 @@ describe("cordova cli", function () {
     describe("options", function () {
         describe("version", function () {
             var version = require("../package").version;
+
             beforeEach(function () {
                 spyOn(console, "log");
             });

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1aef477d/src/cli.js
----------------------------------------------------------------------
diff --git a/src/cli.js b/src/cli.js
index 7aea811..2b3de8e 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -48,8 +48,28 @@ function init() {
     }
 };
 
-// Add handlers for verbose logging.
+/**
+ *
+ * set up event handlers for logging and results emitted as events.
+ */
+function initLogHandlers(args) {
+    
+    init();
+
+    cordova.on('results', console.log);
+
+    if ( !args.silent ) {
+        cordova.on('log', console.log);
+        cordova.on('warn', console.warn);
+        plugman.on('log', console.log);
+        plugman.on('results', console.log);
+        plugman.on('warn', console.warn);
+    }
+
+};
+
 function initVerboseHandlers() {
+    // Add handlers for verbose logging
     if (args.verbose) {
         cordova.on('verbose', console.log);
         plugman.on('verbose', console.log);
@@ -91,9 +111,14 @@ function cli(inputArgs) {
         , 'src' : '--copy-from'
         };
 
+    init();
+
     // If no inputArgs given, use process.argv.
-    inputArgs = inputArgs || process.argv;
-    var args = nopt(knownOpts, shortHands, inputArgs);
+    inputArgs = inputArgs || process.argv
+
+    var args = nopt(knownOpts, shortHands, inputArgs)
+
+    initLogHandlers(args);
 
     if (args.version) {
         console.log( require('../package').version );
@@ -222,7 +247,11 @@ function cli(inputArgs) {
 
         cordova.raw[cmd].call(null, opts).done();
     } else if (cmd == 'serve') {
+<<<<<<< HEAD
         var port = undashed[1];
+=======
+        var port = undashed[1]
+>>>>>>> be1e82d... updated tests and cli to pass all tests
         cordova.raw.serve(port).done();
     } else if (cmd == 'create') {
         var cfg = {};