cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsoref <...@git.apache.org>
Subject [GitHub] cordova-lib pull request: CB-5082 [cordova info] Add support for B...
Date Tue, 03 Jun 2014 14:44:30 GMT
Github user jsoref commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/7#discussion_r13337873
  
    --- 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 --
    
    @kamrik is saying that you should cache at least:
    require(path.join(bbUtilsPath, 'lib', 'target-utils'))
    
    In a var somewhere. 
    
    Specifically right after the var bbUtilsPath line:



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message