Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-lib/pull/7#discussion_r13337337
--- 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 --
Ok, basically it's calling the target-utils.js file, to get the target
list, one of it it's emulator and the other one it's to retrieve the list of
devices.
nfcall, it's because the existent blackberry code on that are
callback-based, not promises, and in info.js promises are required.
I can add some comment lines in there. No problem at all.
---
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.
---