You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by za...@apache.org on 2014/12/15 14:33:14 UTC

[25/37] cordova-ubuntu git commit: Use --verbose instead of --debug as argument to enabled additional output.

Use --verbose instead of --debug as argument to enabled additional output.

* New --verbose argument
* Adjusted info message so the developer knows how to enabled verbose mode.


Project: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/commit/31aea7b8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/tree/31aea7b8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/diff/31aea7b8

Branch: refs/heads/master
Commit: 31aea7b8216b7f9f4c6c306d802efd83521c0ed0
Parents: e9239e5
Author: Jean-Francois Moy <je...@gmail.com>
Authored: Mon Nov 10 15:06:33 2014 +0000
Committer: Jean-Francois Moy <je...@gmail.com>
Committed: Mon Nov 10 15:06:33 2014 +0000

----------------------------------------------------------------------
 bin/templates/project/cordova/build         |  6 +++---
 bin/templates/project/cordova/lib/config.js | 12 ++++++------
 bin/templates/project/cordova/lib/logger.js |  2 +-
 bin/templates/project/cordova/lib/utils.js  | 18 ++++++++++++++----
 bin/templates/project/cordova/run           |  6 +++---
 5 files changed, 27 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/31aea7b8/bin/templates/project/cordova/build
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/build b/bin/templates/project/cordova/build
index 91c3847..bcee390 100755
--- a/bin/templates/project/cordova/build
+++ b/bin/templates/project/cordova/build
@@ -28,9 +28,9 @@ var root = path.resolve();
 var www = path.join(root, 'www');
 
 check_reqs(function () {
-    var argv = require('optimist').boolean(['debug']).string(['framework']).argv;
-    if (argv.debug) {
-      require('./lib/config').debugMode();
+    var argv = require('optimist').boolean(['verbose']).string(['framework']).argv;
+    if (argv.verbose) {
+      require('./lib/config').verboseMode();
     }
     return build(root, PLATFORMS.ALL, false, undefined, argv.framework, false);
 });

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/31aea7b8/bin/templates/project/cordova/lib/config.js
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/lib/config.js b/bin/templates/project/cordova/lib/config.js
index fe65a6f..26a9b7e 100644
--- a/bin/templates/project/cordova/lib/config.js
+++ b/bin/templates/project/cordova/lib/config.js
@@ -23,21 +23,21 @@ var shellCfg = require('shelljs').config;
 
 /**
  * The configuration is used by other tasks to access shared properties, such as if the tasks are
- * running in debug mode (verbose).
+ * running in verbose mode (more logs, and outputs from various commands).
  */
 function Config() {
-    this._debug = false;
+    this._verbose = false;
     shellCfg.silent = true;
 }
 
 Config.prototype = {
-    debugMode: function () {
-        this._debug = true;
+    verboseMode: function () {
+        this._verbose = true;
         shellCfg.silent = false;
     },
 
-    inDebugMode: function () {
-        return this._debug;
+    inVerboseMode: function () {
+        return this._verbose;
     }
 };
 

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/31aea7b8/bin/templates/project/cordova/lib/logger.js
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/lib/logger.js b/bin/templates/project/cordova/lib/logger.js
index 9f263ef..23342c6 100644
--- a/bin/templates/project/cordova/lib/logger.js
+++ b/bin/templates/project/cordova/lib/logger.js
@@ -26,7 +26,7 @@ var config = require('./config');
  * Output debug messages in white. If not in verbose mode, nothing is output.
  */
 module.exports.debug = function (msg) {
-    if (config.inDebugMode()) {
+    if (config.inVerboseMode()) {
         console.log(msg);
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/31aea7b8/bin/templates/project/cordova/lib/utils.js
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/lib/utils.js b/bin/templates/project/cordova/lib/utils.js
index 403da44..1798704 100644
--- a/bin/templates/project/cordova/lib/utils.js
+++ b/bin/templates/project/cordova/lib/utils.js
@@ -48,12 +48,17 @@ module.exports.popd = function(dir) {
 module.exports.execSync = function(cmd, silent) {
     logger.debug(cmd);
 
-    silent = (typeof silent === 'boolean') ? silent : !config.inDebugMode();
+    silent = (typeof silent === 'boolean') ? silent : !config.inVerboseMode();
     var res = shell.exec(cmd, { silent: silent });
     if (res.code !== 0) {
         logger.error(cmd.green + " " + "FAILED".underline);
         logger.error(res.output);
-        logger.error('You can run with --debug to debug more easily.');
+
+        if (!config.inVerboseMode()) {
+            logger.warn('Try running the task again with --verbose for more logs.');
+            logger.warn('Example: cordova run -- --verbose');
+        }
+
         process.exit(1);
     }
 
@@ -64,13 +69,18 @@ module.exports.execAsync = function (cmd, silent) {
     logger.debug(cmd);
 
     var deferred = Q.defer();
-    silent = (typeof silent === 'boolean') ? silent : !config.inDebugMode();
+    silent = (typeof silent === 'boolean') ? silent : !config.inVerboseMode();
     shell.exec(cmd, { async: true, silent: silent }, function (code, output) {
         var res = { code: code, output: output };
         if (res.code !== 0) {
             logger.error(cmd.green + " " + "FAILED".underline);
             logger.error(res.output);
-            logger.error('You can run with --debug to debug more easily.')
+
+            if (!config.inVerboseMode()) {
+                logger.warn('Try running the task again with --verbose for more logs.');
+                logger.warn('Example: cordova run -- --verbose');
+            }
+
             process.exit(1);
         }
         deferred.resolve(res);

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/31aea7b8/bin/templates/project/cordova/run
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/run b/bin/templates/project/cordova/run
index fc36457..536662e 100755
--- a/bin/templates/project/cordova/run
+++ b/bin/templates/project/cordova/run
@@ -28,9 +28,9 @@ var root = path.resolve();
 var www = path.join(root, 'www');
 
 check_reqs(function () {
-    var argv = require('optimist').boolean(['device', 'emulator', 'debug', 'nobuild']).string(['target', 'framework']).argv;
-    if (argv.debug) {
-      require('./lib/config').debugMode();
+    var argv = require('optimist').boolean(['device', 'emulator', 'debug', 'nobuild', 'verbose']).string(['target', 'framework']).argv;
+    if (argv.verbose) {
+      require('./lib/config').verboseMode();
     }
     return run(root, !argv.device, argv.debug, argv.target, argv.nobuild, argv.emulator, argv.framework);
 });


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