You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2015/12/05 02:27:00 UTC

[6/8] cordova-lib git commit: address comments and simplify code; with no tabs

address comments and simplify code; with no tabs


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

Branch: refs/heads/master
Commit: aebd307b4b48b5f2df995bd4cbd9331a45095a1e
Parents: 877404b
Author: David Barth <da...@canonical.com>
Authored: Thu Dec 3 14:41:46 2015 +0100
Committer: David Barth <da...@canonical.com>
Committed: Thu Dec 3 14:41:46 2015 +0100

----------------------------------------------------------------------
 cordova-lib/src/plugman/platforms/ubuntu.js | 37 ++++++++++++++----------
 1 file changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/aebd307b/cordova-lib/src/plugman/platforms/ubuntu.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/ubuntu.js b/cordova-lib/src/plugman/platforms/ubuntu.js
index c34e218..90a066c 100644
--- a/cordova-lib/src/plugman/platforms/ubuntu.js
+++ b/cordova-lib/src/plugman/platforms/ubuntu.js
@@ -50,31 +50,36 @@ function findClassName(pluginxml, plugin_id) {
 
     // first check if we have a class-name parameter in the plugin config
     if (pluginxml) {
-	var platform = pluginxml.find("./platform/[@name='ubuntu']/");
-	if (platform) {
-	    var param = platform.find("./config-file/[@target='config.xml']/feature/param/[@name='ubuntu-package']");
-	    if (param && param.attrib) {
-		class_name = param.attrib.value;
-		return class_name;
-	    }
-	}
+        var platform = pluginxml.find("./platform/[@name='ubuntu']/");
+        if (platform) {
+            var param = platform.find("./config-file/[@target='config.xml']/feature/param/[@name='ubuntu-package']");
+            if (param && param.attrib) {
+                class_name = param.attrib.value;
+                return class_name;
+            }
+        }
     }
 
     // fallback to guess work, based on the plugin package name
 
     if (plugin_id.match(/\.[^.]+$/)) {
-        // old-style plugin name
+        // old-style plugin name (Apache Registry)
         class_name = plugin_id.match(/\.[^.]+$/)[0].substr(1);
-        class_name = toCamelCase(class_name);
     } else {
-	match = plugin_id.match(/cordova\-plugin\-([\w\-]+)$/);
-        if (match && match.length > 0)
-	    class_name = match[0].substr(15);
-	else
-            class_name = toCamelCase(class_name);
+        // new-style (NPM registry)
+        var match = plugin_id.match(/cordova\-plugin\-([\w\-]+)$/);
+        if (match && match.length > 0) {
+            class_name = match[0].substr(15);
+        } else {
+            // plugins not using a particular naming convention
+            // and missing a parameter in pluginxml can still
+            // fallback to using a class name equal to their
+            // plugin name (in camel case)
+            class_name = plugin_id;
+        }
     }
 
-    return class_name;
+    return toCamelCase(class_name);
 }
 
 var shell = require('shelljs')


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