You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by martincgg <gi...@git.apache.org> on 2014/03/26 19:50:02 UTC
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
GitHub user martincgg opened a pull request:
https://github.com/apache/cordova-cli/pull/151
CB-6329 improve 'cordova info' command
info.js file has been modified to work mainly asynchronous.
Added info-utils, which contains several useful functions required by
info.js
-It doesn't require a template to set an output.
-getNode, getCordova, doPlatforms works asynchronous, works with
callbacks and deals with errors.
-it writes a report (info.txt) in rootProject.
This changes are required for futures improvements.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/martincgg/cordova-cli CB-6329
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-cli/pull/151.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #151
----
commit aaf54666f4c9a99d910620d42baf5599d85dd7df
Author: Martin Gonzalez <ma...@gmail.com>
Date: 2014-03-26T18:48:08Z
CB-6329 improve 'cordova info' command
info.js file has been modified to work mainly asynchronous.
Added info-utils, which contains several useful functions required by
info.js
-It doesn't require a template to set an output.
-getNode, getCordova, doPlatforms works asynchronous, works with
callbacks and deals with errors.
-it writes a report (info.txt) in rootProject.
This changes are required for futures improvements.
----
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/cordova-cli/pull/151
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260409
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
+ }()), (function (){
+ //Get Cordova version
+ return (Q.denodeify (info_utils.getCordovaInfo)());
+ }()), (function (){
+ //Get project config.xml file
+ return 'Config.xml File: \n\n'+ (fs.readFileSync(cordova_util.projectConfig(projectRoot), 'utf-8')) +'\n\n\n'
+ }()), (function (){
+ //Get list of plugins
+ return 'Plugins: \n\n' + doPlugins( projectRoot ) +'\n\n\n';
+ }()), (function (){
+ //Get Platforms information
+ return (Q.denodeify (doPlatforms)(projectRoot));
+ }())]).then(function (promises){
+ for(var t in promises)
+ print_SaveMsg( projectRoot, (function (){ return promises[t].state==='fulfilled' ? promises[t].value : promises[t].state==='rejected' ? promises[t].reason : 'Still working' }()) );
+ });
};
-function doPlatform( currentPlatform ) {
- var output = "";
- switch( currentPlatform ){
- case "ios":
- output = shell.exec('xcodebuild -version',{silent:true} ).output;
- break;
- case "android":
- output = shell.exec('android list target',{silent:true} ).output;
+ function delLog(projectRoot){
--- End diff --
don't indent top-level functions
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on the pull request:
https://github.com/apache/cordova-cli/pull/151#issuecomment-41192677
Ok, I got it, thanks Andrew, have a nice day.
2014-04-23 12:30 GMT-05:00 agrieve <no...@github.com>:
> Unless there are functions that will be used by other files as well, keep
> it in one file.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/apache/cordova-cli/pull/151#issuecomment-41190420>
> .
>
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260908
--- Diff: src/info-utils.js ---
@@ -0,0 +1,58 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+ var cordova_util = require('./util'),
+ child_process = require('child_process'),
+ path = require('path'),
+ fs = require('fs'),
+ _self;
+
+_self = {
+
+ getNodeInfo: function( callback ){
+ _self.execFunc('node', '--version', function(call){callback("Node version: "+call);});
--- End diff --
The main reason is the possibility of use this helper functions to be used by other js files, if another process requires to get any relevant information provided by utils-info.js, besides, I'm working improving and providing more information, and it would be better keep it outside of info.js file.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11262183
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
--- End diff --
https://github.com/kriskowal/q/wiki/API-Reference#promiseallsettled
Example of Q.allSettled usage, and also I've tried to use just the returning the value
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260150
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
--- End diff --
There's a lot of unnecessary (function(){})() going on here. You could simplify to:
console.log('Collecting Data...');
Q.allSettled([Q.denodeify(...), Q.denodeify(...), ...)
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260674
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
+ }()), (function (){
+ //Get Cordova version
+ return (Q.denodeify (info_utils.getCordovaInfo)());
+ }()), (function (){
+ //Get project config.xml file
+ return 'Config.xml File: \n\n'+ (fs.readFileSync(cordova_util.projectConfig(projectRoot), 'utf-8')) +'\n\n\n'
+ }()), (function (){
+ //Get list of plugins
+ return 'Plugins: \n\n' + doPlugins( projectRoot ) +'\n\n\n';
+ }()), (function (){
+ //Get Platforms information
+ return (Q.denodeify (doPlatforms)(projectRoot));
+ }())]).then(function (promises){
+ for(var t in promises)
--- End diff --
Understood, I'm changing it, I'll use the first one.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11080089
--- Diff: src/info-utils.js ---
@@ -0,0 +1,58 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+var cordova_util = require('./util'),
+child_process = require('child_process'),
+path = require('path'),
+fs = require('fs'),
+_self;
+
+_self = {
+
+getNodeInfo: function( callback ){
+ callback(_self.execFunc('node', '--version', function(call){callback(call);}));
+ },
+
+getCordovaInfo: function( callback ){
+ callback(_self.execFunc('cordova', '--version', function(call){callback(call);}));
+ },
+
+getPlatformInfo: function(platform, projectRoot, callback ){
+ var command="", args="";
+ switch( platform ){
+ case "ios":
+ _self.execFunc('xcodebuild', '-version', function(call){callback('iOS Platform:\r\r' +call);});
+ break;
+ case "android":
+ _self.execFunc('android', 'list target', function(call){callback('Android Platform:\r\r' +call);});
--- End diff --
Why use \r? I think \n is much more common for newlines. Not sure if \r even works correctly?
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260700
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
+ }()), (function (){
+ //Get Cordova version
+ return (Q.denodeify (info_utils.getCordovaInfo)());
+ }()), (function (){
+ //Get project config.xml file
+ return 'Config.xml File: \n\n'+ (fs.readFileSync(cordova_util.projectConfig(projectRoot), 'utf-8')) +'\n\n\n'
+ }()), (function (){
+ //Get list of plugins
+ return 'Plugins: \n\n' + doPlugins( projectRoot ) +'\n\n\n';
+ }()), (function (){
+ //Get Platforms information
+ return (Q.denodeify (doPlatforms)(projectRoot));
+ }())]).then(function (promises){
+ for(var t in promises)
+ print_SaveMsg( projectRoot, (function (){ return promises[t].state==='fulfilled' ? promises[t].value : promises[t].state==='rejected' ? promises[t].reason : 'Still working' }()) );
+ });
};
-function doPlatform( currentPlatform ) {
- var output = "";
- switch( currentPlatform ){
- case "ios":
- output = shell.exec('xcodebuild -version',{silent:true} ).output;
- break;
- case "android":
- output = shell.exec('android list target',{silent:true} ).output;
+ function delLog(projectRoot){
--- End diff --
Ok, zero indent on functions
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on the pull request:
https://github.com/apache/cordova-cli/pull/151#issuecomment-41184231
Merged. I did a clean-up commit along with it that you can see here:
https://git-wip-us.apache.org/repos/asf?p=cordova-cli.git;a=blobdiff;f=src/info.js;h=c8b8e248ed8f1cf99edb9324a056ea35fbfa563b;hp=a61d88e0d2834969490fd825eb792903a735c312;hb=cdb5deff;hpb=9372f0dd3ca9d9bc8982d0aaae7ee11ff1e58b9e
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11087542
--- 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 --
Another way
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11087286
--- Diff: src/info-utils.js ---
@@ -0,0 +1,58 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+var cordova_util = require('./util'),
+child_process = require('child_process'),
--- End diff --
my mistake, sorry.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260317
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
+ }()), (function (){
+ //Get Cordova version
+ return (Q.denodeify (info_utils.getCordovaInfo)());
+ }()), (function (){
+ //Get project config.xml file
+ return 'Config.xml File: \n\n'+ (fs.readFileSync(cordova_util.projectConfig(projectRoot), 'utf-8')) +'\n\n\n'
+ }()), (function (){
+ //Get list of plugins
+ return 'Plugins: \n\n' + doPlugins( projectRoot ) +'\n\n\n';
+ }()), (function (){
+ //Get Platforms information
+ return (Q.denodeify (doPlatforms)(projectRoot));
+ }())]).then(function (promises){
+ for(var t in promises)
+ print_SaveMsg( projectRoot, (function (){ return promises[t].state==='fulfilled' ? promises[t].value : promises[t].state==='rejected' ? promises[t].reason : 'Still working' }()) );
+ });
};
-function doPlatform( currentPlatform ) {
- var output = "";
- switch( currentPlatform ){
- case "ios":
- output = shell.exec('xcodebuild -version',{silent:true} ).output;
- break;
- case "android":
- output = shell.exec('android list target',{silent:true} ).output;
+ function delLog(projectRoot){
+ if(fs.existsSync(path.join(projectRoot,'info.txt'))){
+ fs.unlink(path.join(projectRoot,'info.txt'), function (err) {
+ if (err) {throw err; console.log("Unable to delete info.txt file \n");}
+ writeLog(projectRoot, '');
+ });
+ }else{writeLog(projectRoot, '');}
}
+ function writeLog (projectRoot, data){
+ //Successfully deleted, writing new one
+ fs.writeFile(path.join(projectRoot,'info.txt'), data, 'utf-8', function (err) {
+ if (err) throw err;
+ });
+ }
+ function print_SaveMsg(projectRoot, data){
+ console.info(data);
+ appendLog(projectRoot,data)
+ }
+ function appendLog(projectRoot, data){
--- End diff --
Ok, right, there's no need to append, I'll delete the function
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11261250
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
--- End diff --
Q.allSettled, it just accept functions, so with using it in that way, the function declarated and at the same time, is executed.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11278577
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
+ }()), (function (){
+ //Get Cordova version
+ return (Q.denodeify (info_utils.getCordovaInfo)());
+ }()), (function (){
+ //Get project config.xml file
+ return 'Config.xml File: \n\n'+ (fs.readFileSync(cordova_util.projectConfig(projectRoot), 'utf-8')) +'\n\n\n'
+ }()), (function (){
+ //Get list of plugins
+ return 'Plugins: \n\n' + doPlugins( projectRoot ) +'\n\n\n';
+ }()), (function (){
+ //Get Platforms information
+ return (Q.denodeify (doPlatforms)(projectRoot));
+ }())]).then(function (promises){
+ for(var t in promises)
+ print_SaveMsg( projectRoot, (function (){ return promises[t].state==='fulfilled' ? promises[t].value : promises[t].state==='rejected' ? promises[t].reason : 'Still working' }()) );
+ });
};
-function doPlatform( currentPlatform ) {
- var output = "";
- switch( currentPlatform ){
- case "ios":
- output = shell.exec('xcodebuild -version',{silent:true} ).output;
- break;
- case "android":
- output = shell.exec('android list target',{silent:true} ).output;
+ function delLog(projectRoot){
+ if(fs.existsSync(path.join(projectRoot,'info.txt'))){
+ fs.unlink(path.join(projectRoot,'info.txt'), function (err) {
+ if (err) {throw err; console.log("Unable to delete info.txt file \n");}
+ writeLog(projectRoot, '');
+ });
+ }else{writeLog(projectRoot, '');}
}
+ function writeLog (projectRoot, data){
+ //Successfully deleted, writing new one
+ fs.writeFile(path.join(projectRoot,'info.txt'), data, 'utf-8', function (err) {
+ if (err) throw err;
+ });
+ }
+ function print_SaveMsg(projectRoot, data){
+ console.info(data);
+ appendLog(projectRoot,data)
+ }
+ function appendLog(projectRoot, data){
--- End diff --
If you wait for them all before doing any writing, then there's no point in appending each time.
I think maybe the problem is that you should use Q.all() instead of Q.allSettled().
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on the pull request:
https://github.com/apache/cordova-cli/pull/151#issuecomment-41141270
I've been working on some other stuff with cordova-mobile-spec, but I came back to this topic to deliver the pending changes removing callback functions, and use only promises and superspawn following the recommendations and feedback provided.
Summary:
-Removed: All callbacks functions.
-Every function returns a promise.
-Use of superspawn instead of shelljs.
-Use of Q.defer(), to resolve or reject promises.
-Removed mostly all anonymous functions.
It's cleaner and complexity has been reduced without promises-callbacks
statements combination.
Q.allSettled it will wait until all promises are resolved, and then write the log file, collecting all data.
@agrieve , thanks for the feedback and all the suggestions that you provided me. If this is last commit is well accomplished, let me know to start to work on add support for blackberry, wp8 and windows 8, using the same pattern.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11080227
--- 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 --
Not this this is not synchronous, you need to have the returned promise not resolve until the command is completed. Have a look at other examples where promises are used.
It may also clean up your code above to use promises instead of such heavy nesting.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260509
--- Diff: src/info-utils.js ---
@@ -0,0 +1,58 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+ var cordova_util = require('./util'),
+ child_process = require('child_process'),
+ path = require('path'),
+ fs = require('fs'),
+ _self;
+
+_self = {
+
+ getNodeInfo: function( callback ){
+ _self.execFunc('node', '--version', function(call){callback("Node version: "+call);});
+ },
+
+ getCordovaInfo: function( callback ){
+ _self.execFunc('cordova', '--version', function(call){callback("Cordova version: "+call);});
+ },
+
+ getPlatformInfo: function(platform, projectRoot, callback ){
+ var command="", args="";
+ switch( platform ){
+ case "ios":
+ _self.execFunc('xcodebuild', '-version', function(call){callback('iOS Platform:\n\n' +call);});
+ break;
+ case "android":
+ _self.execFunc('android', 'list target', function(call){callback('Android Platform:\n\n' +call);});
+ break;
+ }
+ },
+
+ execFunc: function(command, args, callback){
--- End diff --
Feel free to ignore me and leave as-is, but might simplify to use superspawn instead of this, since that already returns a promise.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260484
--- Diff: src/info-utils.js ---
@@ -0,0 +1,58 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+ var cordova_util = require('./util'),
+ child_process = require('child_process'),
+ path = require('path'),
+ fs = require('fs'),
+ _self;
+
+_self = {
+
+ getNodeInfo: function( callback ){
+ _self.execFunc('node', '--version', function(call){callback("Node version: "+call);});
--- End diff --
I'd lean towards having these all as helper functions within info.js. Could be convinced otherwise. wondering what your rationale is?
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260238
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
+ }()), (function (){
+ //Get Cordova version
+ return (Q.denodeify (info_utils.getCordovaInfo)());
+ }()), (function (){
+ //Get project config.xml file
+ return 'Config.xml File: \n\n'+ (fs.readFileSync(cordova_util.projectConfig(projectRoot), 'utf-8')) +'\n\n\n'
+ }()), (function (){
+ //Get list of plugins
+ return 'Plugins: \n\n' + doPlugins( projectRoot ) +'\n\n\n';
+ }()), (function (){
+ //Get Platforms information
+ return (Q.denodeify (doPlatforms)(projectRoot));
+ }())]).then(function (promises){
+ for(var t in promises)
--- End diff --
Never use a for in loop on arrays. Use promises.forEach(function(p)), or a regular for loop.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on the pull request:
https://github.com/apache/cordova-cli/pull/151#issuecomment-39585091
Last commit.
-Removed functions: appendLog, writeLog, delLog.
-No indent on top-level functions
-Changed for loop from for(var t in promises) to
promises.forEach(function(p))
-Other minor changes
Well @agrieve , this is what I got, I have a combination of callbacks and promises, trying to take good advantages of both of them, you have more experience and expertise than me in this subject, if you want me to change the whole thing to promises, just let me know, but I rather focus efforts on in adding support to other platforms and make more improvements, but like I said, if you consider that the best action to take is change the whole thing to promises and not a combination of callbacks and promises, it's Ok, I'll do it.
Thanks a lot again for your feedback.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11301928
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
+ }()), (function (){
+ //Get Cordova version
+ return (Q.denodeify (info_utils.getCordovaInfo)());
+ }()), (function (){
+ //Get project config.xml file
+ return 'Config.xml File: \n\n'+ (fs.readFileSync(cordova_util.projectConfig(projectRoot), 'utf-8')) +'\n\n\n'
+ }()), (function (){
+ //Get list of plugins
+ return 'Plugins: \n\n' + doPlugins( projectRoot ) +'\n\n\n';
+ }()), (function (){
+ //Get Platforms information
+ return (Q.denodeify (doPlatforms)(projectRoot));
+ }())]).then(function (promises){
+ for(var t in promises)
+ print_SaveMsg( projectRoot, (function (){ return promises[t].state==='fulfilled' ? promises[t].value : promises[t].state==='rejected' ? promises[t].reason : 'Still working' }()) );
+ });
};
-function doPlatform( currentPlatform ) {
- var output = "";
- switch( currentPlatform ){
- case "ios":
- output = shell.exec('xcodebuild -version',{silent:true} ).output;
- break;
- case "android":
- output = shell.exec('android list target',{silent:true} ).output;
+ function delLog(projectRoot){
+ if(fs.existsSync(path.join(projectRoot,'info.txt'))){
+ fs.unlink(path.join(projectRoot,'info.txt'), function (err) {
+ if (err) {throw err; console.log("Unable to delete info.txt file \n");}
+ writeLog(projectRoot, '');
+ });
+ }else{writeLog(projectRoot, '');}
}
+ function writeLog (projectRoot, data){
+ //Successfully deleted, writing new one
+ fs.writeFile(path.join(projectRoot,'info.txt'), data, 'utf-8', function (err) {
+ if (err) throw err;
+ });
+ }
+ function print_SaveMsg(projectRoot, data){
+ console.info(data);
+ appendLog(projectRoot,data)
+ }
+ function appendLog(projectRoot, data){
--- End diff --
Ok, it's done.
I've removed some top level functions, delLog, appendLog, and writeLog.
Q.allSettled, because the code is dealing with callbacks, so the promises will be undefined with Q.all(), Q.allSettled waits until every promises is fulfilled or rejected, Q.all just collects or promises.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260194
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
--- End diff --
Might clean things up even more to have info_utils.* return promises instead of callbacks. Then you don't need to denodify, and error reporting becomes easier.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
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.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11080035
--- Diff: src/info-utils.js ---
@@ -0,0 +1,58 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+var cordova_util = require('./util'),
+child_process = require('child_process'),
+path = require('path'),
+fs = require('fs'),
+_self;
+
+_self = {
+
+getNodeInfo: function( callback ){
+ callback(_self.execFunc('node', '--version', function(call){callback(call);}));
+ },
+
+getCordovaInfo: function( callback ){
+ callback(_self.execFunc('cordova', '--version', function(call){callback(call);}));
--- End diff --
you're calling callback twice here and above.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260643
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
--- End diff --
Well, Ok I can do it without any problem, but I've leave it in that way, because all the promises are requested at time, then, all callbacks are processed asynchronously, so Q.allSettled, it will wait until every promises is recovered, meanwhile the callbacks completed, so it won't be necessary wait until the first promise is complete, to get the next one, I like it in that way, just because all callbacks are sent and the promises are retrieved when callbacks are completed, not waiting for execution one after another, that's the reason why I have implemented in that way.
But no problem, just confirm me please, are you sure that it would be better, if I change the whole methods to promises?
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11264375
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
+ }()), (function (){
+ //Get Cordova version
+ return (Q.denodeify (info_utils.getCordovaInfo)());
+ }()), (function (){
+ //Get project config.xml file
+ return 'Config.xml File: \n\n'+ (fs.readFileSync(cordova_util.projectConfig(projectRoot), 'utf-8')) +'\n\n\n'
+ }()), (function (){
+ //Get list of plugins
+ return 'Plugins: \n\n' + doPlugins( projectRoot ) +'\n\n\n';
+ }()), (function (){
+ //Get Platforms information
+ return (Q.denodeify (doPlatforms)(projectRoot));
+ }())]).then(function (promises){
+ for(var t in promises)
+ print_SaveMsg( projectRoot, (function (){ return promises[t].state==='fulfilled' ? promises[t].value : promises[t].state==='rejected' ? promises[t].reason : 'Still working' }()) );
+ });
};
-function doPlatform( currentPlatform ) {
- var output = "";
- switch( currentPlatform ){
- case "ios":
- output = shell.exec('xcodebuild -version',{silent:true} ).output;
- break;
- case "android":
- output = shell.exec('android list target',{silent:true} ).output;
+ function delLog(projectRoot){
+ if(fs.existsSync(path.join(projectRoot,'info.txt'))){
+ fs.unlink(path.join(projectRoot,'info.txt'), function (err) {
+ if (err) {throw err; console.log("Unable to delete info.txt file \n");}
+ writeLog(projectRoot, '');
+ });
+ }else{writeLog(projectRoot, '');}
}
+ function writeLog (projectRoot, data){
+ //Successfully deleted, writing new one
+ fs.writeFile(path.join(projectRoot,'info.txt'), data, 'utf-8', function (err) {
+ if (err) throw err;
+ });
+ }
+ function print_SaveMsg(projectRoot, data){
+ console.info(data);
+ appendLog(projectRoot,data)
+ }
+ function appendLog(projectRoot, data){
--- End diff --
delLog, it checks for info.txt file, if exists is going to delete it and then create a new one empty to be append for the other function.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11087336
--- Diff: src/info-utils.js ---
@@ -0,0 +1,58 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+var cordova_util = require('./util'),
+child_process = require('child_process'),
+path = require('path'),
+fs = require('fs'),
+_self;
+
+_self = {
+
+getNodeInfo: function( callback ){
+ callback(_self.execFunc('node', '--version', function(call){callback(call);}));
+ },
+
+getCordovaInfo: function( callback ){
+ callback(_self.execFunc('cordova', '--version', function(call){callback(call);}));
--- End diff --
yes, you're right, I can change that.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11264328
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
+ }()), (function (){
+ //Get Cordova version
+ return (Q.denodeify (info_utils.getCordovaInfo)());
+ }()), (function (){
+ //Get project config.xml file
+ return 'Config.xml File: \n\n'+ (fs.readFileSync(cordova_util.projectConfig(projectRoot), 'utf-8')) +'\n\n\n'
+ }()), (function (){
+ //Get list of plugins
+ return 'Plugins: \n\n' + doPlugins( projectRoot ) +'\n\n\n';
+ }()), (function (){
+ //Get Platforms information
+ return (Q.denodeify (doPlatforms)(projectRoot));
+ }())]).then(function (promises){
+ for(var t in promises)
+ print_SaveMsg( projectRoot, (function (){ return promises[t].state==='fulfilled' ? promises[t].value : promises[t].state==='rejected' ? promises[t].reason : 'Still working' }()) );
+ });
};
-function doPlatform( currentPlatform ) {
- var output = "";
- switch( currentPlatform ){
- case "ios":
- output = shell.exec('xcodebuild -version',{silent:true} ).output;
- break;
- case "android":
- output = shell.exec('android list target',{silent:true} ).output;
+ function delLog(projectRoot){
+ if(fs.existsSync(path.join(projectRoot,'info.txt'))){
+ fs.unlink(path.join(projectRoot,'info.txt'), function (err) {
+ if (err) {throw err; console.log("Unable to delete info.txt file \n");}
+ writeLog(projectRoot, '');
+ });
+ }else{writeLog(projectRoot, '');}
}
+ function writeLog (projectRoot, data){
+ //Successfully deleted, writing new one
+ fs.writeFile(path.join(projectRoot,'info.txt'), data, 'utf-8', function (err) {
+ if (err) throw err;
+ });
+ }
+ function print_SaveMsg(projectRoot, data){
+ console.info(data);
+ appendLog(projectRoot,data)
+ }
+ function appendLog(projectRoot, data){
--- End diff --
Well, I'm wrong, I cannot delete appendLog function, each promise result is store one at the time, so I'm sending to print into console and to write it into the fille as well.
What do you recommend? save all promises values/reasons into a temporal value and then writeFileSync(path, alldata, utf-8); ??
I can do it without any problem.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260290
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
+ }()), (function (){
+ //Get Cordova version
+ return (Q.denodeify (info_utils.getCordovaInfo)());
+ }()), (function (){
+ //Get project config.xml file
+ return 'Config.xml File: \n\n'+ (fs.readFileSync(cordova_util.projectConfig(projectRoot), 'utf-8')) +'\n\n\n'
+ }()), (function (){
+ //Get list of plugins
+ return 'Plugins: \n\n' + doPlugins( projectRoot ) +'\n\n\n';
+ }()), (function (){
+ //Get Platforms information
+ return (Q.denodeify (doPlatforms)(projectRoot));
+ }())]).then(function (promises){
+ for(var t in promises)
+ print_SaveMsg( projectRoot, (function (){ return promises[t].state==='fulfilled' ? promises[t].value : promises[t].state==='rejected' ? promises[t].reason : 'Still working' }()) );
+ });
};
-function doPlatform( currentPlatform ) {
- var output = "";
- switch( currentPlatform ){
- case "ios":
- output = shell.exec('xcodebuild -version',{silent:true} ).output;
- break;
- case "android":
- output = shell.exec('android list target',{silent:true} ).output;
+ function delLog(projectRoot){
+ if(fs.existsSync(path.join(projectRoot,'info.txt'))){
+ fs.unlink(path.join(projectRoot,'info.txt'), function (err) {
+ if (err) {throw err; console.log("Unable to delete info.txt file \n");}
+ writeLog(projectRoot, '');
+ });
+ }else{writeLog(projectRoot, '');}
}
+ function writeLog (projectRoot, data){
+ //Successfully deleted, writing new one
+ fs.writeFile(path.join(projectRoot,'info.txt'), data, 'utf-8', function (err) {
+ if (err) throw err;
+ });
+ }
+ function print_SaveMsg(projectRoot, data){
+ console.info(data);
+ appendLog(projectRoot,data)
+ }
+ function appendLog(projectRoot, data){
--- End diff --
Likewise, no need for delLog to do more than unlink.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on the pull request:
https://github.com/apache/cordova-cli/pull/151#issuecomment-41187328
Ok, I've see what you've done with it, it's Ok, I tried to keep it consistent as you recommend. Didn't knew about process.version, neither about package.version.
I just have a question.
For future improvements or additional support do you want me to set all in the same file? just a yes or not to clarify. that's it. Thanks @agrieve .
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on the pull request:
https://github.com/apache/cordova-cli/pull/151#issuecomment-39364969
Well, the feedback was attended thanks a lot, here's the new commit, this are the changes:
-Added, proper indent (4 spaces).
-Removed, trailing whitespace
-Fixed, callbacks double assignation.
- \r replaced by \n.
Also, now it uses Q to work with callbacks, this time is going to return
every value retrieve from the environment, all promises it will be
called, those promises are callbacks data, Q.allSettled is going to call
all of them, and then wait until every single one of them is fulfilled
or rejected, then is going to print the data and save into a file.
Adding this logic, it returns promises, and cleans the code of heavy
nesting of callbacks.
The only disadvantage, is that it requires to wait until everything is done to show it in the screen, if it takes too much time retrieving the data, the user may think that the terminal is frozen, which is unlikely.
@agrieve is this what you recommend me to do?
https://github.com/martincgg/cordova-cli/blob/31ea565bac97a6f35c484cba3461fb726f24e07a/src/info.js#L42
This is better?. Btw thanks a lot for the feedback.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on the pull request:
https://github.com/apache/cordova-cli/pull/151#issuecomment-41190420
Unless there are functions that will be used by other files as well, keep it in one file.
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11079999
--- Diff: src/info-utils.js ---
@@ -0,0 +1,58 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+var cordova_util = require('./util'),
+child_process = require('child_process'),
--- End diff --
nit: indent these
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11080008
--- Diff: src/info-utils.js ---
@@ -0,0 +1,58 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+var cordova_util = require('./util'),
+child_process = require('child_process'),
+path = require('path'),
+fs = require('fs'),
+_self;
+
+_self = {
+
+getNodeInfo: function( callback ){
+ callback(_self.execFunc('node', '--version', function(call){callback(call);}));
--- End diff --
Please use 4 space indent and remove trailing whitespace
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11087295
--- Diff: src/info-utils.js ---
@@ -0,0 +1,58 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+var cordova_util = require('./util'),
+child_process = require('child_process'),
+path = require('path'),
+fs = require('fs'),
+_self;
+
+_self = {
+
+getNodeInfo: function( callback ){
+ callback(_self.execFunc('node', '--version', function(call){callback(call);}));
--- End diff --
got it
---
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.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by martincgg <gi...@git.apache.org>.
Github user martincgg commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11087348
--- Diff: src/info-utils.js ---
@@ -0,0 +1,58 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+var cordova_util = require('./util'),
+child_process = require('child_process'),
+path = require('path'),
+fs = require('fs'),
+_self;
+
+_self = {
+
+getNodeInfo: function( callback ){
+ callback(_self.execFunc('node', '--version', function(call){callback(call);}));
+ },
+
+getCordovaInfo: function( callback ){
+ callback(_self.execFunc('cordova', '--version', function(call){callback(call);}));
+ },
+
+getPlatformInfo: function(platform, projectRoot, callback ){
+ var command="", args="";
+ switch( platform ){
+ case "ios":
+ _self.execFunc('xcodebuild', '-version', function(call){callback('iOS Platform:\r\r' +call);});
+ break;
+ case "android":
+ _self.execFunc('android', 'list target', function(call){callback('Android Platform:\r\r' +call);});
--- End diff --
If you say so, I can change them 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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cordova-cli pull request: CB-6329 improve 'cordova info' command
Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-cli/pull/151#discussion_r11260263
--- Diff: src/info.js ---
@@ -16,123 +16,99 @@
specific language governing permissions and limitations
under the License.
*/
-var cordova_util = require('./util'),
- shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- Q = require('q'),
- events = require('./events');
-
-/*
- A utility funciton to help output the information needed
- when submitting a help request.
-
- Outputs to a file
-*/
+ var cordova_util = require('./util'),
+ path = require('path'),
+ fs = require('fs'),
+ child_process = require('child_process'),
+ Q = require('q'),
+ info_utils = require('./info-utils');
+
+ /*
+ A utility funciton to help output the information needed
+ when submitting a help request.
+
+ 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"),
+ //Get projectRoot
+ var projectRoot = cordova_util.cdProjectRoot(),
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;
+ if (!projectRoot) {
+ return Q.reject( new Error('Current working directory is not a Cordova-based project.') );
}
- }).join("\n");
- // /*
- // Write to File;
- // */
- events.emit('results', output);
- fs.writeFileSync('info.txt', output );
- return Q();
+ delLog(projectRoot);
+ //Array of functions, Q.allSettled
+ return Q.allSettled([ (function (){
+ console.log("Collecting Data...");
+ //Get Node version
+ return (Q.denodeify (info_utils.getNodeInfo)());
+ }()), (function (){
+ //Get Cordova version
+ return (Q.denodeify (info_utils.getCordovaInfo)());
+ }()), (function (){
+ //Get project config.xml file
+ return 'Config.xml File: \n\n'+ (fs.readFileSync(cordova_util.projectConfig(projectRoot), 'utf-8')) +'\n\n\n'
+ }()), (function (){
+ //Get list of plugins
+ return 'Plugins: \n\n' + doPlugins( projectRoot ) +'\n\n\n';
+ }()), (function (){
+ //Get Platforms information
+ return (Q.denodeify (doPlatforms)(projectRoot));
+ }())]).then(function (promises){
+ for(var t in promises)
+ print_SaveMsg( projectRoot, (function (){ return promises[t].state==='fulfilled' ? promises[t].value : promises[t].state==='rejected' ? promises[t].reason : 'Still working' }()) );
+ });
};
-function doPlatform( currentPlatform ) {
- var output = "";
- switch( currentPlatform ){
- case "ios":
- output = shell.exec('xcodebuild -version',{silent:true} ).output;
- break;
- case "android":
- output = shell.exec('android list target',{silent:true} ).output;
+ function delLog(projectRoot){
+ if(fs.existsSync(path.join(projectRoot,'info.txt'))){
+ fs.unlink(path.join(projectRoot,'info.txt'), function (err) {
+ if (err) {throw err; console.log("Unable to delete info.txt file \n");}
+ writeLog(projectRoot, '');
+ });
+ }else{writeLog(projectRoot, '');}
}
+ function writeLog (projectRoot, data){
+ //Successfully deleted, writing new one
+ fs.writeFile(path.join(projectRoot,'info.txt'), data, 'utf-8', function (err) {
+ if (err) throw err;
+ });
+ }
+ function print_SaveMsg(projectRoot, data){
+ console.info(data);
+ appendLog(projectRoot,data)
+ }
+ function appendLog(projectRoot, data){
--- End diff --
No need for appendLog now that you're not streaming results. Just write it all at once.
---
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.
---