[GitHub] cordova-lib pull request #574: CB-12838 : prevented sorting and alphabetizin...

2017-08-16 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cordova-lib/pull/574


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

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #574: CB-12838 : prevented sorting and alphabetizin...

2017-08-11 Thread audreyso
Github user audreyso commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/574#discussion_r132795105
  
--- Diff: src/cordova/restore-util.js ---
@@ -341,19 +340,29 @@ function installPluginsFromConfigXML (args) {
 fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 
2), 'utf8');
 }
 }
-// Write config.xml (only if plugins exist in package.json).
+// Write to config.xml (only if it is different from package.json in 
content)
 comboPluginIdArray.forEach(function (plugID) {
+var configXMLPlugin = cfg.getPlugin(plugID);
 if (pluginIdConfig.indexOf(plugID) < 0) {
 pluginIdConfig.push(plugID);
-}
-cfg.removePlugin(plugID);
-if (mergedPluginSpecs[plugID]) {
+if (mergedPluginSpecs[plugID]) {
+cfg.removePlugin(plugID);
+cfg.addPlugin({name: plugID, spec: 
mergedPluginSpecs[plugID]}, comboObject[plugID]);
+modifiedConfigXML = true;
+} else {
+cfg.removePlugin(plugID);
+cfg.addPlugin({name: plugID}, comboObject[plugID]);
+modifiedConfigXML = true;
+}
+
+// Write only if the plugin variables or specs are different from 
pkgJson
+} else if (((pluginIdConfig.indexOf(plugID) > 0) && 
(mergedPluginSpecs[plugID]) &&
+((configXMLPlugin.variables !== comboObject[plugID]))) ||
+((mergedPluginSpecs[plugID] !== configXMLPlugin.spec) ||
--- End diff --

Yes, exactly! Also rebased and updated based on feedback. Let me know if 
there's anything else!


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

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #574: CB-12838 : prevented sorting and alphabetizin...

2017-08-11 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/574#discussion_r132781446
  
--- Diff: src/cordova/restore-util.js ---
@@ -341,19 +340,29 @@ function installPluginsFromConfigXML (args) {
 fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 
2), 'utf8');
 }
 }
-// Write config.xml (only if plugins exist in package.json).
+// Write to config.xml (only if it is different from package.json in 
content)
 comboPluginIdArray.forEach(function (plugID) {
+var configXMLPlugin = cfg.getPlugin(plugID);
 if (pluginIdConfig.indexOf(plugID) < 0) {
 pluginIdConfig.push(plugID);
-}
-cfg.removePlugin(plugID);
-if (mergedPluginSpecs[plugID]) {
+if (mergedPluginSpecs[plugID]) {
+cfg.removePlugin(plugID);
+cfg.addPlugin({name: plugID, spec: 
mergedPluginSpecs[plugID]}, comboObject[plugID]);
+modifiedConfigXML = true;
+} else {
+cfg.removePlugin(plugID);
+cfg.addPlugin({name: plugID}, comboObject[plugID]);
+modifiedConfigXML = true;
+}
+
+// Write only if the plugin variables or specs are different from 
pkgJson
+} else if (((pluginIdConfig.indexOf(plugID) > 0) && 
(mergedPluginSpecs[plugID]) &&
+((configXMLPlugin.variables !== comboObject[plugID]))) ||
+((mergedPluginSpecs[plugID] !== configXMLPlugin.spec) ||
--- End diff --

so to confirm, either `((pluginIdConfig.indexOf(plugID) > 0) && 
(mergedPluginSpecs[plugID]) &&(configXMLPlugin.variables !== 
comboObject[plugID]))` or `((mergedPluginSpecs[plugID] !== 
configXMLPlugin.spec) || (configXMLPlugin.variables !== comboObject[plugID]))` 
need to be true


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

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #574: CB-12838 : prevented sorting and alphabetizin...

2017-08-11 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/574#discussion_r132780726
  
--- Diff: src/cordova/restore-util.js ---
@@ -341,19 +340,29 @@ function installPluginsFromConfigXML (args) {
 fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 
2), 'utf8');
 }
 }
-// Write config.xml (only if plugins exist in package.json).
+// Write to config.xml (only if it is different from package.json in 
content)
 comboPluginIdArray.forEach(function (plugID) {
+var configXMLPlugin = cfg.getPlugin(plugID);
 if (pluginIdConfig.indexOf(plugID) < 0) {
 pluginIdConfig.push(plugID);
-}
-cfg.removePlugin(plugID);
-if (mergedPluginSpecs[plugID]) {
+if (mergedPluginSpecs[plugID]) {
+cfg.removePlugin(plugID);
+cfg.addPlugin({name: plugID, spec: 
mergedPluginSpecs[plugID]}, comboObject[plugID]);
+modifiedConfigXML = true;
+} else {
+cfg.removePlugin(plugID);
+cfg.addPlugin({name: plugID}, comboObject[plugID]);
+modifiedConfigXML = true;
+}
+
+// Write only if the plugin variables or specs are different from 
pkgJson
+} else if (((pluginIdConfig.indexOf(plugID) > 0) && 
(mergedPluginSpecs[plugID]) &&
+((configXMLPlugin.variables !== comboObject[plugID]))) ||
--- End diff --

I think you have an extra bracket around this 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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #574: CB-12838 : prevented sorting and alphabetizin...

2017-08-11 Thread stevengill
Github user stevengill commented on a diff in the pull request:

https://github.com/apache/cordova-lib/pull/574#discussion_r132780476
  
--- Diff: src/cordova/restore-util.js ---
@@ -341,19 +340,29 @@ function installPluginsFromConfigXML (args) {
 fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 
2), 'utf8');
 }
 }
-// Write config.xml (only if plugins exist in package.json).
+// Write to config.xml (only if it is different from package.json in 
content)
 comboPluginIdArray.forEach(function (plugID) {
+var configXMLPlugin = cfg.getPlugin(plugID);
 if (pluginIdConfig.indexOf(plugID) < 0) {
 pluginIdConfig.push(plugID);
-}
-cfg.removePlugin(plugID);
-if (mergedPluginSpecs[plugID]) {
+if (mergedPluginSpecs[plugID]) {
+cfg.removePlugin(plugID);
+cfg.addPlugin({name: plugID, spec: 
mergedPluginSpecs[plugID]}, comboObject[plugID]);
+modifiedConfigXML = true;
+} else {
+cfg.removePlugin(plugID);
+cfg.addPlugin({name: plugID}, comboObject[plugID]);
+modifiedConfigXML = true;
+}
+
+// Write only if the plugin variables or specs are different from 
pkgJson
+} else if (((pluginIdConfig.indexOf(plugID) > 0) && 
(mergedPluginSpecs[plugID]) &&
--- End diff --

so this if statement, `(pluginIdConfig.indexOf(plugID) > 0)`, what if 
`plugID` is in the 0th index? I think you want `>=`


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

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org



[GitHub] cordova-lib pull request #574: CB-12838 : prevented sorting and alphabetizin...

2017-07-13 Thread audreyso
GitHub user audreyso opened a pull request:

https://github.com/apache/cordova-lib/pull/574

CB-12838 : prevented sorting and alphabetizing platforms and plugins i…

…n pkgJson and config



### Platforms affected


### What does this PR do?

Prevents modifying/alphabetizing platforms and plugins in config

### What testing has been done on this change?


### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/audreyso/cordova-lib CB-12838

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cordova-lib/pull/574.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 #574


commit 083deef9ce70afe8455a36f49ddccf0b093558f8
Author: Audrey So 
Date:   2017-07-12T00:21:41Z

CB-12838 : prevented sorting and aphabetizing platforms and plugins in 
pkgjson and config




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

-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org