Github user kamrik commented on a diff in the pull request:
https://github.com/apache/cordova-lib/pull/7#discussion_r13336691
--- Diff: cordova-lib/src/cordova/info.js ---
@@ -31,23 +31,50 @@ var cordova_util = require('./util'),
// Execute using a child_process exec, for any async command
function execSpawn(command, args, resultMsg, errorMsg) {
- return superspawn.spawn(command, args).then(function(result) {
+ return superspawn.spawn(command, args).then(function (result) {
return resultMsg + result;
- }, function(error) {
+ }, function (error) {
return errorMsg + error;
});
}
+//Collects data from promise, and it returns a promise
+function preparePromise(promise, headline) {
+ var output = "";
+ resultList = promise.state === 'fullfilled' ? promise.value :
promise.reason;
+ if (resultList.length > 0) {
+ resultList.map(function (result) {
+ output += result.name + ' ip: ' + result.ip + '\n';
+ });
+ return Q(headline + ':\n' + output);
+ }
+ return Q(headline + ':\n' + 'Not found');
+}
+
function getPlatformInfo(platform, projectRoot) {
switch (platform) {
case 'ios':
return execSpawn('xcodebuild', ['-version'], 'iOS platform:\n\n',
'Error retrieving iOS platform information: ');
case 'android':
return execSpawn('android', ['list', 'target'], 'Android
platform:\n\n', 'Error retrieving Android platform information: ');
+ case 'blackberry10':
+ var bbUtilsPath = path.join(projectRoot, 'platforms', platform,
'cordova');
+ return Q.allSettled([
+ Q.nfcall(require(path.join(bbUtilsPath, 'lib',
'target-utils')).getTargetList, 'emulator', false),
+ Q.nfcall(require(path.join(bbUtilsPath, 'lib',
'target-utils')).getTargetList, 'device', false)
--- End diff --
Why do we import the same thing twice?
In general this change looks extremely hacky, please add a bunch of
comments to help people understand what's being done here and why is it being
done in this particular way.
A multi-line comment with an example of command line equivalent of the
commands being spawned here could also be extremely helpful.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---