[ https://issues.apache.org/jira/browse/CB-6329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13951468#comment-13951468 ]
ASF GitHub Bot commented on CB-6329: ------------------------------------ Github user martincgg commented on a diff in the pull request: https://github.com/apache/cordova-cli/pull/151#discussion_r11087487 --- Diff: src/info.js --- @@ -30,105 +29,80 @@ var cordova_util = require('./util'), Outputs to a file */ module.exports = function info() { - - //Get the template - var projectRoot = cordova_util.cdProjectRoot(); - - var raw = fs.readFileSync(path.join(__dirname, '..', 'doc', 'info.txt'), 'utf-8').split("\n"), - output; - - output = raw.map(function(line) { - if(line.match(' %') ) { - var type = (line.substr(5)).replace("\r",""), - out = ""; - - switch(type) { - case "Node": - out = shell.exec('node --version',{silent:true}).output; - break; - case "Cordova": - out = require('../package').version; - break; - case "Config": - out = fs.readFileSync( cordova_util.projectConfig(projectRoot) ); - break; - case "Platforms": - out = doPlatforms( projectRoot ); - break; - case "Plugins": - out = doPlugins( projectRoot ); - break; - default: - break; - } - return line.replace( "%"+type, out ); - } else { - return line; + //Get projectRoot + var projectRoot = cordova_util.cdProjectRoot(), + output; + delLog(projectRoot); + //Get Node info + info_utils.getNodeInfo(function (result){ + if( result ){ + print_SaveMsg(projectRoot, "Node version: "+ result); + //Get Cordova version + info_utils.getCordovaInfo(function (result){ + if( result ){print_SaveMsg(projectRoot,"Cordova version: "+ result ); + // Get config.xml file + fs.readFile(cordova_util.projectConfig(projectRoot) , 'utf-8' , function ( err , result ){ + if(err) {print_SaveMsg(projectRoot,"Error reading config.xml file"+ err);} + print_SaveMsg(projectRoot,'Config.xml File: \r'+ result +'\r\r\r'); + print_SaveMsg(projectRoot,'Plugins: \r' + doPlugins( projectRoot ) +'\r\r\r'); + //Get platforms info + doPlatforms(projectRoot, function (result){ + if( result ){ + print_SaveMsg(projectRoot,result); + } + }); + }); + } + }); } - }).join("\n"); - - // /* - // Write to File; - // */ - events.emit('results', output); - fs.writeFileSync('info.txt', output ); + }); return Q(); --- End diff -- Noted, I'm going to look for another to do so. > [cordova-cli] improve 'cordova info' command to work asynchronous > ----------------------------------------------------------------- > > Key: CB-6329 > URL: https://issues.apache.org/jira/browse/CB-6329 > Project: Apache Cordova > Issue Type: Improvement > Components: CLI > Affects Versions: 3.4.0 > Reporter: Martin Gonzalez > Assignee: Martin Gonzalez > Labels: blackberry, cordova-cli, environment, info, wp8 > Fix For: 3.5.0 > > > The 'cordova info' command it works in total sync, it takes some time to pull > and push all data from the environment, so in order to use callbacks more > friendly, I'd like to modify the flow structure of the file and improve it to > use get callback outputs, write summary or log file without templates. > I also, I'd like to add a secondary file that holds all specific functions > related with 'get information about the dev environment'. -- This message was sent by Atlassian JIRA (v6.2#6252)