Repository: cordova-lib
Updated Branches:
  refs/heads/master 2ed7ed0b9 -> 4fad20d15


CB-8532 Adding Windows Plugin Failed with "Cannot read property 'text' of null"
Updated elementtree API according 0.1.6 release. This closes #277


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

Branch: refs/heads/master
Commit: 4fad20d1531e13a24d1f6b3565ea7ef4765e3287
Parents: 2ed7ed0
Author: daserge <[email protected]>
Authored: Tue Aug 11 20:57:11 2015 +0300
Committer: Rob Paveza <[email protected]>
Committed: Wed Aug 19 16:00:40 2015 -0700

----------------------------------------------------------------------
 cordova-lib/src/cordova/metadata/windows_parser.js |  2 +-
 cordova-lib/src/plugman/platform.js                |  2 +-
 cordova-lib/src/util/windows/jsprojManager.js      | 15 ++++++++++-----
 3 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4fad20d1/cordova-lib/src/cordova/metadata/windows_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/windows_parser.js 
b/cordova-lib/src/cordova/metadata/windows_parser.js
index e51e5a0..e53ea2d 100644
--- a/cordova-lib/src/cordova/metadata/windows_parser.js
+++ b/cordova-lib/src/cordova/metadata/windows_parser.js
@@ -150,7 +150,7 @@ windows_parser.prototype.update_from_config = 
function(config) {
         capabilities = capabilitiesRoot._children || [];
 
     capabilities.forEach(function(elem){
-        capabilitiesRoot.remove(0, elem);
+        capabilitiesRoot.remove(elem);
     });
     capabilities.sort(function(a, b) {
         return (a.tag > b.tag)? 1: -1;

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4fad20d1/cordova-lib/src/plugman/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platform.js 
b/cordova-lib/src/plugman/platform.js
index 163f5dd..b8cec07 100644
--- a/cordova-lib/src/plugman/platform.js
+++ b/cordova-lib/src/plugman/platform.js
@@ -75,7 +75,7 @@ module.exports = {
         }
 
         // Remove the Platform in question
-        pluginxml.getroot().remove( 0, pluginxml.find("./platform/[@name='"+ 
platformName +"']") );
+        pluginxml.getroot().remove(pluginxml.find("./platform/[@name='"+ 
platformName +"']") );
 
         // Rewrite the plugin.xml file back out
         fs.writeFileSync( "plugin.xml", pluginxml.write( "plugin.xml", 
{indent: 4} ), 'utf-8' );

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4fad20d1/cordova-lib/src/util/windows/jsprojManager.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/util/windows/jsprojManager.js 
b/cordova-lib/src/util/windows/jsprojManager.js
index ebb2d73..f1260f3 100644
--- a/cordova-lib/src/util/windows/jsprojManager.js
+++ b/cordova-lib/src/util/windows/jsprojManager.js
@@ -48,7 +48,12 @@ function jsprojManager(location) {
     this.projects = [];
     this.master = this.isUniversalWindowsApp ? new proj(location) : new 
jsproj(location);
     this.projectFolder = path.dirname(location);
+}
 
+function getProjectName(pluginProjectXML, relative_path) {
+    var projNameElt = pluginProjectXML.find("PropertyGroup/ProjectName");
+    // Falling back on project file name in case ProjectName is missing
+    return !!projNameElt ? projNameElt.text : path.basename(relative_path, 
path.extname(relative_path));
 }
 
 jsprojManager.prototype = {
@@ -138,7 +143,7 @@ jsprojManager.prototype = {
 
         // find the guid + name of the referenced project
         var projectGuid = 
pluginProjectXML.find("PropertyGroup/ProjectGuid").text;
-        var projName = pluginProjectXML.find("PropertyGroup/ProjectName").text;
+        var projName = getProjectName(pluginProjectXML, relative_path);
 
         // get the project type
         var projectTypeGuid = getProjectTypeGuid(relative_path);
@@ -217,7 +222,7 @@ jsprojManager.prototype = {
         // find the guid + name of the referenced project
         var pluginProjectXML = xml_helpers.parseElementtreeSync(relative_path);
         var projectGuid = 
pluginProjectXML.find("PropertyGroup/ProjectGuid").text;
-        var projName = pluginProjectXML.find("PropertyGroup/ProjectName").text;
+        var projName = getProjectName(pluginProjectXML, relative_path);
 
         // get the project type
         var projectTypeGuid = getProjectTypeGuid(relative_path);
@@ -416,7 +421,7 @@ proj.prototype = {
         var itemGroup = this.xml.find(xpath);
         if (itemGroup) {
             this.touched = true;
-            this.xml.getroot().remove(0, itemGroup);
+            this.xml.getroot().remove(itemGroup);
         }
     },
 
@@ -470,12 +475,12 @@ proj.prototype = {
 
             filesToRemove.forEach(function (file) {
                 // remove file reference
-                group.remove(0, file);
+                group.remove(file);
             });
             // remove ItemGroup if empty
             if (group.findall('*').length < 1) {
                 that.touched = true;
-                root.remove(0, group);
+                root.remove(group);
             }
         });
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to