small merge conflict in WP parsers with logging events.
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/cf9eb156 Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/cf9eb156 Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/cf9eb156 Branch: refs/heads/2.8.x Commit: cf9eb15696760f26204233e4366c6181627d5a76 Parents: 3124223 Author: Fil Maj <[email protected]> Authored: Wed Jun 5 08:18:00 2013 -0700 Committer: Fil Maj <[email protected]> Committed: Thu Jun 6 18:28:47 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 | 7 ++++--- src/metadata/wp8_parser.js | 6 +++--- src/platform.js | 3 ++- 8 files changed, 30 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cf9eb156/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/cf9eb156/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/cf9eb156/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/cf9eb156/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/cf9eb156/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/cf9eb156/src/metadata/wp7_parser.js ---------------------------------------------------------------------- diff --git a/src/metadata/wp7_parser.js b/src/metadata/wp7_parser.js index 657d266..f0127e9 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'), events = require('../events'), config_parser = require('../config_parser'); @@ -40,14 +40,15 @@ module.exports = function wp7_parser(project) { }; module.exports.check_requirements = function(callback) { - events.emit('log', 'Checking wp7 requirements...'); + 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/cf9eb156/src/metadata/wp8_parser.js ---------------------------------------------------------------------- diff --git a/src/metadata/wp8_parser.js b/src/metadata/wp8_parser.js index 27e3a5c..ac5613c 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'), events = require('../events'), config_parser = require('../config_parser'); @@ -40,7 +40,7 @@ module.exports = function wp8_parser(project) { }; module.exports.check_requirements = function(callback) { - events.emit('log', 'Checking wp8 requirements...'); + 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) { @@ -48,7 +48,7 @@ module.exports.check_requirements = function(callback) { if (code != 0) { callback(output); } else { - callback(false); + callback(false); } }); }; http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cf9eb156/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);
