cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kam...@apache.org
Subject [1/3] git commit: CB-6973: Fix JSHint errors in ConfigParse
Date Thu, 19 Jun 2014 17:00:17 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master a1da72b62 -> ad086b9bb


CB-6973: Fix JSHint errors in ConfigParse

Also a minor bug fix in findOrCreate().


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

Branch: refs/heads/master
Commit: 5332be8f6691ba53794e42d8e0637389a213fbd9
Parents: a1da72b
Author: Mark Koudritsky <kamrik@gmail.com>
Authored: Thu Jun 19 10:52:17 2014 -0400
Committer: Mark Koudritsky <kamrik@gmail.com>
Committed: Thu Jun 19 10:52:17 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/configparser/ConfigParser.js | 32 ++++++++++++++---------
 1 file changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5332be8f/cordova-lib/src/configparser/ConfigParser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/configparser/ConfigParser.js b/cordova-lib/src/configparser/ConfigParser.js
index 2df38d3..eb070d6 100644
--- a/cordova-lib/src/configparser/ConfigParser.js
+++ b/cordova-lib/src/configparser/ConfigParser.js
@@ -16,6 +16,12 @@
     specific language governing permissions and limitations
     under the License.
 */
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc,
+          sub:true
+*/
+
 var et = require('elementtree'),
     xml= require('../util/xml-helpers'),
     CordovaError = require('../CordovaError'),
@@ -44,7 +50,7 @@ function findOrCreate(doc, name) {
     var ret = doc.find(name);
     if (!ret) {
         ret = new et.Element(name);
-        doc.getroot().append(content);
+        doc.getroot().append(ret);
     }
     return ret;
 }
@@ -67,8 +73,8 @@ ConfigParser.prototype = {
         return this.doc.find('description').text.trim();
     },
     setDescription: function(text) {
-        this.doc.find('description').text = text;
         var el = findOrCreate(this.doc, 'description');
+        el.text = text;
     },
     version: function() {
         return this.doc.getroot().attrib['version'];
@@ -102,13 +108,13 @@ ConfigParser.prototype = {
      * @return {Array} Icons for the platform specified.
      */
     getIcons: function(platform) {
-        var ret = [];
+        var ret = [],
             iconElements = [];
 
         if (platform) { // platform specific icons
             this.doc.findall('platform[@name=\'' + platform + '\']/icon').forEach(function(elt){
                 elt.platform = platform; // mark as platform specific icon
-                iconElements.push(elt)
+                iconElements.push(elt);
             });
         }
         // root level icons
@@ -151,7 +157,7 @@ ConfigParser.prototype = {
         /** Returns default icons */
         ret.getDefault = function() {
             return ret.defaultIcon;
-        }
+        };
 
         return ret;
     },
@@ -159,15 +165,15 @@ ConfigParser.prototype = {
      *This does not check for duplicate feature entries
      */
     addFeature: function (name, params){
-      var el = new et.Element('feature');
+        var el = new et.Element('feature');
         el.attrib.name = name;
-        if(params){
-          params.forEach(function(param){
-            var p = new et.Element('param');
-            p.attrib.name = param.name;
-            p.attrib.value = param.value;
-            el.append(p);
-          });
+        if (params) {
+            params.forEach(function(param){
+                var p = new et.Element('param');
+                p.attrib.name = param.name;
+                p.attrib.value = param.value;
+                el.append(p);
+            });
         }
         this.doc.getroot().append(el);
     },


Mime
View raw message