cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [1/2] git commit: [CB-2452] hooked verbosity flag into execution of shell commands as well.
Date Wed, 05 Jun 2013 15:18:36 GMT
Updated Branches:
  refs/heads/master2 bddae62ca -> 50858af5e


[CB-2452] hooked verbosity flag into execution of shell commands as well.


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

Branch: refs/heads/master2
Commit: cff9c16bdb0663d67432ab294d430279b6ca7f17
Parents: bddae62
Author: Fil Maj <maj.fil@gmail.com>
Authored: Wed Jun 5 08:18:00 2013 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Wed Jun 5 08:18:00 2013 -0700

----------------------------------------------------------------------
 src/compile.js                 |    3 ++-
 src/emulate.js                 |    3 ++-
 src/hooker.js                  |    5 ++++-
 src/metadata/android_parser.js |    8 +++++++-
 src/metadata/ios_parser.js     |    8 ++++++--
 src/metadata/wp7_parser.js     |   10 +++++++---
 src/metadata/wp8_parser.js     |   10 +++++++---
 src/platform.js                |    3 ++-
 8 files changed, 37 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cff9c16b/src/compile.js
----------------------------------------------------------------------
diff --git a/src/compile.js b/src/compile.js
index 58d944e..1f550f8 100644
--- a/src/compile.js
+++ b/src/compile.js
@@ -36,8 +36,9 @@ function shell_out_to_debug(projectRoot, platform, callback) {
     } else {
         cmd = '"' + path.join(cmd, 'cordova', 'build') + '"';
     }
-    events.emit('log', 'Compiling platform "' + platform + '" with command "' + cmd + '"');
+    events.emit('log', 'Compiling platform "' + platform + '" with command "' + cmd + '"
(output to follow)...');
     shell.exec(cmd, {silent:true, async:true}, function(code, output) {
+        events.emit('log', output);
         if (code > 0) {
             throw new Error('An error occurred while building the ' + platform + ' project.
' + output);
         } else {

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cff9c16b/src/emulate.js
----------------------------------------------------------------------
diff --git a/src/emulate.js b/src/emulate.js
index 0787f60..9ccfc0b 100644
--- a/src/emulate.js
+++ b/src/emulate.js
@@ -36,8 +36,9 @@ function shell_out_to_emulate(root, platform, callback) {
     if (platform == 'blackberry') {
         cmd = 'ant -f "' + path.join(root, 'platforms', platform, 'build.xml') + '" qnx load-simulator';
     }
-    events.emit('log', 'Running on emulator for platform "' + platform + '" via command "'
+ cmd + '"');
+    events.emit('log', 'Running on emulator for platform "' + platform + '" via command "'
+ cmd + '" (output to follow)...');
     shell.exec(cmd, {silent:true, async:true}, function(code, output) {
+        events.emit('log', output);
         if (code > 0) {
             throw new Error('An error occurred while emulating/deploying the ' + platform
+ ' project.' + output);
         } else {

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cff9c16b/src/hooker.js
----------------------------------------------------------------------
diff --git a/src/hooker.js b/src/hooker.js
index d40b686..0d51304 100644
--- a/src/hooker.js
+++ b/src/hooker.js
@@ -42,7 +42,10 @@ module.exports.prototype = {
         contents.forEach(function(script) {
             var fullpath = path.join(dir, script);
             if (fs.statSync(fullpath).isDirectory()) return; // skip directories if they're
in there.
-            var status = shell.exec(fullpath + ' "' + self.root + '"');
+            var command = fullpath + ' "' + self.root + '"';
+            events.emit('log', 'Executing hook "' + hook + '" (output to follow)...');
+            var status = shell.exec(command);
+            events.emit('log', status.output);
             if (status.code !== 0) throw new Error('Script "' + path.basename(script) + '"'
+ 'in the ' + hook + ' hook exited with non-zero status code. Aborting.');
         });
         return true;

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cff9c16b/src/metadata/android_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/android_parser.js b/src/metadata/android_parser.js
index 63582a4..b66e58b 100644
--- a/src/metadata/android_parser.js
+++ b/src/metadata/android_parser.js
@@ -40,7 +40,11 @@ module.exports = function android_parser(project) {
 };
 
 module.exports.check_requirements = function(callback) {
-    shell.exec('android list target', {silent:true, async:true}, function(code, output) {
+    events.emit('log', 'Checking Android requirements...');
+    var command = 'android list target';
+    events.emit('log', 'Running "' + command + '" (output to follow)');
+    shell.exec(command, {silent:true, async:true}, function(code, output) {
+        events.emit('log', output);
         if (code != 0) {
             callback('The command `android` failed. Make sure you have the latest Android
SDK installed, and the `android` command (inside the tools/ folder) added to your path. Output:
' + output);
         } else {
@@ -48,7 +52,9 @@ module.exports.check_requirements = function(callback) {
                 callback('Please install Android target 17 (the Android 4.2 SDK). Make sure
you have the latest Android tools installed as well. Run `android` from your command-line
to install/update any missing SDKs or tools.');
             } else {
                 var cmd = 'android update project -p ' + path.join(__dirname, '..', '..',
'lib', 'cordova-android', 'framework') + ' -t android-17';
+                events.emit('log', 'Running "' + cmd + '" (output to follow)...');
                 shell.exec(cmd, {silent:true, async:true}, function(code, output) {
+                    events.emit('log', output);
                     if (code != 0) {
                         callback('Error updating the Cordova library to work with your Android
environment. Command run: "' + cmd + '", output: ' + output);
                     } else {

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cff9c16b/src/metadata/ios_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/ios_parser.js b/src/metadata/ios_parser.js
index b7e2d69..a8c6229 100644
--- a/src/metadata/ios_parser.js
+++ b/src/metadata/ios_parser.js
@@ -61,10 +61,14 @@ module.exports = function ios_parser(project) {
 };
 
 module.exports.check_requirements = function(callback) {
+    events.emit('log', 'Checking iOS requirements...');
     // Check xcode + version.
-    shell.exec('xcodebuild -version', {silent:true, async:true}, function(code, output) {
+    var command = 'xcodebuild -version';
+    events.emit('log', 'Running "' + command + '" (output to follow)');
+    shell.exec(command, {silent:true, async:true}, function(code, output) {
+        events.emit('log', output);
         if (code != 0) {
-            callback('Xcode is (probably) not installed, specifically the command `xcodebuild`
is unavailable or erroring out. Output of `xcodebuild -version` is: ' + output);
+            callback('Xcode is (probably) not installed, specifically the command `xcodebuild`
is unavailable or erroring out. Output of `'+command+'` is: ' + output);
         } else {
             var xc_version = output.split('\n')[0].split(' ')[1];
             if (semver.lt(xc_version, MIN_XCODE_VERSION)) {

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cff9c16b/src/metadata/wp7_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/wp7_parser.js b/src/metadata/wp7_parser.js
index a6a773a..5a46853 100644
--- a/src/metadata/wp7_parser.js
+++ b/src/metadata/wp7_parser.js
@@ -1,4 +1,3 @@
-
 /**
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
@@ -21,6 +20,7 @@ var fs            = require('fs'),
     path          = require('path'),
     et            = require('elementtree'),
     util          = require('../util'),
+    events        = require('../events'),
     shell         = require('shelljs'),
     config_parser = require('../config_parser');
 
@@ -39,11 +39,15 @@ module.exports = function wp7_parser(project) {
 };
 
 module.exports.check_requirements = function(callback) {
-    shell.exec(path.join(util.libDirectory, 'cordova-wp7', 'bin', 'check_reqs'), {silent:true,
async:true}, function(code, output) {
+    events.emit('log', 'Checking WP7 requirements...');
+    var command = '"' + path.join(util.libDirectory, 'cordova-wp7', 'bin', 'check_reqs')
+ '"';
+    events.emit('log', 'Running "' + command + '" (output to follow)');
+    shell.exec(command, {silent:true, async:true}, function(code, output) {
+        events.emit('log', output);
         if (code != 0) {
             callback(output);
         } else {
-                callback(false);
+            callback(false);
         }
     });
 };

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cff9c16b/src/metadata/wp8_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/wp8_parser.js b/src/metadata/wp8_parser.js
index 089b25b..d591538 100644
--- a/src/metadata/wp8_parser.js
+++ b/src/metadata/wp8_parser.js
@@ -1,4 +1,3 @@
-
 /**
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
@@ -21,6 +20,7 @@ var fs            = require('fs'),
     path          = require('path'),
     et            = require('elementtree'),
     util          = require('../util'),
+    events        = require('../events'),
     shell         = require('shelljs'),
     config_parser = require('../config_parser');
 
@@ -39,11 +39,15 @@ module.exports = function wp8_parser(project) {
 };
 
 module.exports.check_requirements = function(callback) {
-    shell.exec(path.join(util.libDirectory, 'cordova-wp8', 'bin', 'check_reqs'), {silent:true,
async:true}, function(code, output) {
+    events.emit('log', 'Checking WP8 requirements...');
+    var command = '"' + path.join(util.libDirectory, 'cordova-wp8', 'bin', 'check_reqs')
+ '"';
+    events.emit('log', 'Running "' + command + '" (output to follow)');
+    shell.exec(command, {silent:true, async:true}, function(code, output) {
+        events.emit('log', output);
         if (code != 0) {
             callback(output);
         } else {
-                callback(false);
+            callback(false);
         }
     });
 };

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cff9c16b/src/platform.js
----------------------------------------------------------------------
diff --git a/src/platform.js b/src/platform.js
index 7f9af14..e60aa1f 100644
--- a/src/platform.js
+++ b/src/platform.js
@@ -95,9 +95,10 @@ module.exports = function platform(command, targets, callback) {
                         // TODO: PLATFORM LIBRARY INCONSISTENCY: order/number of arguments
to create
                         // TODO: keep tabs on CB-2300
                         var command = util.format('"%s" %s "%s" "%s" "%s"', bin, args, output,
(target=='blackberry'?name:pkg), name);
-                        events.emit('log', 'Running bin/create for platform "' + target +
'" with command: "' + command + '"');
+                        events.emit('log', 'Running bin/create for platform "' + target +
'" with command: "' + command + '" (output to follow)');
 
                         shell.exec(command, {silent:true,async:true}, function(code, create_output)
{
+                            events.emit('log', create_output);
                             if (code > 0) {
                                 var err = new Error('An error occured during creation of
' + target + ' sub-project. ' + create_output);
                                 if (callback) callback(err);


Mime
View raw message