cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kam...@apache.org
Subject cordova-lib git commit: CB-8755 Plugin --save: Multiple config.xml entries don't get removed
Date Fri, 27 Mar 2015 15:38:48 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 979f499b1 -> b9d02cbd7


CB-8755 Plugin --save: Multiple config.xml entries don't get removed

Ensures all entries for a plugin get removed on plugin remove --save.

GitHub: close #197


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/b9d02cbd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/b9d02cbd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/b9d02cbd

Branch: refs/heads/master
Commit: b9d02cbd785fbc94f298852129ab3efde6983300
Parents: 979f499
Author: Tim Barham <tim.barham@microsoft.com>
Authored: Fri Mar 27 23:53:23 2015 +1000
Committer: Mark Koudritsky <kamrik@gmail.com>
Committed: Fri Mar 27 11:37:27 2015 -0400

----------------------------------------------------------------------
 cordova-lib/src/configparser/ConfigParser.js | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b9d02cbd/cordova-lib/src/configparser/ConfigParser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/configparser/ConfigParser.js b/cordova-lib/src/configparser/ConfigParser.js
index 2bce391..cf165b2 100644
--- a/cordova-lib/src/configparser/ConfigParser.js
+++ b/cordova-lib/src/configparser/ConfigParser.js
@@ -375,17 +375,15 @@ ConfigParser.prototype = {
      */
     removePlugin: function(id){
         if(id){
-            var theElement = this.doc.find('./plugin/[@name="' + id + '"]');
-            if(!theElement){
-                theElement = this.doc.find('./feature/param[@name="id"][@value="' + id +
'"]/..');
-            }
-            if(theElement){
-                var childs = this.doc.getroot().getchildren();
-                var idx = childs.indexOf(theElement);
-                if(idx > -1){
-                    childs.splice(idx,1);
+            var plugins = this.doc.findall('./plugin/[@name="' + id + '"]')
+                .concat(this.doc.findall('./feature/param[@name="id"][@value="' + id + '"]/..'));
+            var children = this.doc.getroot().getchildren();
+            plugins.forEach(function (plugin) {
+                var idx = children.indexOf(plugin);
+                if (idx > -1) {
+                    children.splice(idx, 1);
                 }
-            }
+            });
         }
     },
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message