Repository: cordova-cli Updated Branches: refs/heads/master 087c39185 -> c7a643519
CB-6954: Use the unified cordova_lib.events After events got shared between cordova and plugman, some log messages were printed multiple times since handlers were registered twice in the cli: cordova.on(...) plugman.on(...) changing it to events.on(...) Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/c7a64351 Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/c7a64351 Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/c7a64351 Branch: refs/heads/master Commit: c7a6435193c354870487e5fed399c9c1e9754aa2 Parents: 087c391 Author: Mark Koudritsky <[email protected]> Authored: Wed Jun 18 11:12:50 2014 -0400 Committer: Mark Koudritsky <[email protected]> Committed: Wed Jun 18 11:12:50 2014 -0400 ---------------------------------------------------------------------- src/cli.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/c7a64351/src/cli.js ---------------------------------------------------------------------- diff --git a/src/cli.js b/src/cli.js index de74d50..56533f7 100644 --- a/src/cli.js +++ b/src/cli.js @@ -17,7 +17,10 @@ under the License. */ -/* jshint node:true, laxcomma:true, asi:true, strict:false, trailing:true, unused:vars */ +/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true, + indent:4, unused:vars, latedef:nofunc, + laxcomma:true, asi:true +*/ var path = require('path') @@ -83,7 +86,7 @@ function cli(inputArgs) { var cordova_lib = require('cordova-lib'), CordovaError = cordova_lib.CordovaError, cordova = cordova_lib.cordova, - plugman = cordova_lib.plugman; + events = cordova_lib.events; // For CordovaError print only the message without stack trace unless we @@ -99,20 +102,16 @@ function cli(inputArgs) { // Set up event handlers for logging and results emitted as events. - cordova.on('results', console.log); + events.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); + events.on('log', console.log); + events.on('warn', console.warn); } // Add handlers for verbose logging. if (args.verbose) { - cordova.on('verbose', console.log); - plugman.on('verbose', console.log); + events.on('verbose', console.log); } // TODO: Example wanted, is this functionality ever used?
