cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kam...@apache.org
Subject [2/3] git commit: CB-6973: Fix JSHint errors in cordova/metadata/*
Date Thu, 19 Jun 2014 17:00:18 GMT
CB-6973: Fix JSHint errors in cordova/metadata/*

All files in src pass JSHint clean now.
To run JSHint on all the js files, run
jshint src
from the root dir of cordova-lib package


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

Branch: refs/heads/master
Commit: 682d46d8847a610ae79674180d419619b374146c
Parents: 5332be8
Author: Mark Koudritsky <kamrik@gmail.com>
Authored: Thu Jun 19 12:51:45 2014 -0400
Committer: Mark Koudritsky <kamrik@gmail.com>
Committed: Thu Jun 19 12:51:45 2014 -0400

----------------------------------------------------------------------
 .../cordova/metadata/amazon_fireos_parser.js    | 45 ++++++++++----------
 .../src/cordova/metadata/android_parser.js      | 19 +++++----
 .../src/cordova/metadata/blackberry10_parser.js |  7 ++-
 .../src/cordova/metadata/firefoxos_parser.js    | 22 ++++++----
 cordova-lib/src/cordova/metadata/ios_parser.js  | 38 +++++++++--------
 .../src/cordova/metadata/ubuntu_parser.js       | 29 +++++++------
 .../src/cordova/metadata/windows8_parser.js     | 28 ++++++------
 cordova-lib/src/cordova/metadata/wp8_parser.js  | 42 +++++++++---------
 8 files changed, 130 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/682d46d8/cordova-lib/src/cordova/metadata/amazon_fireos_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/amazon_fireos_parser.js b/cordova-lib/src/cordova/metadata/amazon_fireos_parser.js
index 0a6d364..7bd0082 100644
--- a/cordova-lib/src/cordova/metadata/amazon_fireos_parser.js
+++ b/cordova-lib/src/cordova/metadata/amazon_fireos_parser.js
@@ -16,21 +16,21 @@
     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
+*/
+
 var fs            = require('fs'),
     path          = require('path'),
     xml           = require('../../util/xml-helpers'),
     util          = require('../util'),
     events        = require('../../events'),
     shell         = require('shelljs'),
-    project_config= require('../config'),
     Q             = require('q'),
     ConfigParser = require('../../configparser/ConfigParser'),
     CordovaError = require('../../CordovaError');
 
-var default_prefs = {
-    "useBrowserHistory":"true",
-    "exit-on-suspend":"false"
-};
 
 module.exports = function android_parser(project) {
     if (!fs.existsSync(path.join(project, 'AndroidManifest.xml'))) {
@@ -71,6 +71,9 @@ module.exports.prototype = {
     },
 
     update_from_config:function(config) {
+        // TODO: share code for this func with Android. Or fix it and remove
+        // the below JSHint hacks line.
+        // jshint unused:false, indent:false, undef:true, loopfunc:true, shadow:true
         if (config instanceof ConfigParser) {
         } else throw new Error('update_from_config requires a ConfigParser object');
 
@@ -84,8 +87,6 @@ module.exports.prototype = {
         var icons = config.getIcons('amazon-fireos');
         // if there are icon elements in config.xml
         if (icons) {
-          var haveSeenDefaultIcon = false;
-          var iconCount = 0;
           var android_icons = {};
           var projectRoot = util.isCordova(this.path);
           var default_icon;
@@ -93,10 +94,10 @@ module.exports.prototype = {
           var max_density;
           // http://developer.android.com/design/style/iconography.html
           var densities = {
-            "ldpi" : 36,
-            "mdpi" : 48,
-            "hdpi" : 72,
-            "xhdpi" : 96
+            'ldpi' : 36,
+            'mdpi' : 48,
+            'hdpi' : 72,
+            'xhdpi' : 96
           };
           for (var i=0; i<icons.length; i++) {
             var icon = icons[i];
@@ -107,7 +108,7 @@ module.exports.prototype = {
             }
             if (!size && !icon.density) {
               if (default_icon) {
-                  events.emit('verbose', "more than one default icon: " + JSON.stringify(icon));
+                  events.emit('verbose', 'more than one default icon: ' + JSON.stringify(icon));
               } else {
                   default_icon = icon;
               }
@@ -136,7 +137,7 @@ module.exports.prototype = {
                     max_density = density;
                   } else {
                     if (max_size < size) {
-                      max_size = size
+                      max_size = size;
                       max_density = density;
                     }
                   }
@@ -179,8 +180,8 @@ module.exports.prototype = {
         // Update the version by changing the AndroidManifest android:versionName
         var version = config.version();
         var versionCode = config.android_versionCode() || default_versionCode(version);
-        manifest.getroot().attrib["android:versionName"] = version;
-        manifest.getroot().attrib["android:versionCode"] = versionCode;
+        manifest.getroot().attrib['android:versionName'] = version;
+        manifest.getroot().attrib['android:versionCode'] = versionCode;
 
         // Update package name by changing the AndroidManifest id and moving the entry class
around to the proper package directory
         var pkg = config.packageName();
@@ -195,22 +196,22 @@ module.exports.prototype = {
         if (orientationPref) {
             switch (orientationPref) {
                 case 'default':
-                    delete act.attrib["android:screenOrientation"];
+                    delete act.attrib['android:screenOrientation'];
                     break;
                 case 'portrait':
-                    act.attrib["android:screenOrientation"] = 'portrait';
+                    act.attrib['android:screenOrientation'] = 'portrait';
                     break;
                 case 'landscape':
-                    act.attrib["android:screenOrientation"] = 'landscape';
+                    act.attrib['android:screenOrientation'] = 'landscape';
             }
         }
 
         // Set android:launchMode in AndroidManifest
         var androidLaunchModePref = this.findAndroidLaunchModePreference(config);
         if (androidLaunchModePref) {
-            act.attrib["android:launchMode"] = androidLaunchModePref;
+            act.attrib['android:launchMode'] = androidLaunchModePref;
         } else { // User has (explicitly) set an invalid value for AndroidLaunchMode preference
-            delete act.attrib["android:launchMode"]; // use Android default value (standard)
+            delete act.attrib['android:launchMode']; // use Android default value (standard)
         }
 
         // Write out AndroidManifest.xml
@@ -220,7 +221,7 @@ module.exports.prototype = {
         var java_files = fs.readdirSync(orig_pkgDir).filter(function(f) {
           return f.indexOf('.svn') == -1 && f.indexOf('.java') >= 0 &&
fs.readFileSync(path.join(orig_pkgDir, f), 'utf-8').match(/extends\s+CordovaActivity/);
         });
-        if (java_files.length == 0) {
+        if (java_files.length === 0) {
           throw new Error('No Java files found which extend CordovaActivity.');
         } else if(java_files.length > 1) {
           events.emit('log', 'Multiple candidate Java files (.java files which extend CordovaActivity)
found. Guessing at the first one, ' + java_files[0]);
@@ -297,7 +298,7 @@ module.exports.prototype = {
 // PATCH + MINOR * 100 + MAJOR * 10000
 // see http://developer.android.com/tools/publishing/versioning.html
 function default_versionCode(version) {
-    nums = version.split('-')[0].split('.').map(Number);
+    var nums = version.split('-')[0].split('.').map(Number);
     var versionCode = nums[0] * 10000 + nums[1] * 100 + nums[2];
     return versionCode;
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/682d46d8/cordova-lib/src/cordova/metadata/android_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/android_parser.js b/cordova-lib/src/cordova/metadata/android_parser.js
index ba6638e..6c9cf41 100644
--- a/cordova-lib/src/cordova/metadata/android_parser.js
+++ b/cordova-lib/src/cordova/metadata/android_parser.js
@@ -16,21 +16,21 @@
     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
+*/
+
 var fs            = require('fs'),
     path          = require('path'),
     xml           = require('../../util/xml-helpers'),
     util          = require('../util'),
     events        = require('../../events'),
     shell         = require('shelljs'),
-    project_config= require('../config'),
     Q             = require('q'),
     ConfigParser  = require('../../configparser/ConfigParser'),
     CordovaError  = require('../../CordovaError');
 
-var default_prefs = {
-    "useBrowserHistory":"true",
-    "exit-on-suspend":"false"
-};
 
 module.exports = function android_parser(project) {
     if (!fs.existsSync(path.join(project, 'AndroidManifest.xml'))) {
@@ -78,6 +78,9 @@ module.exports.prototype = {
     },
 
     update_from_config:function(config) {
+        // TODO: share code for this func with Android. Or fix it and remove
+        // the below JSHint hacks line.
+        // jshint unused:false, indent:false, undef:true, loopfunc:true, shadow:true, quotmark:false
         if (config instanceof ConfigParser) {
         } else throw new Error('update_from_config requires a ConfigParser object');
 
@@ -143,7 +146,7 @@ module.exports.prototype = {
                     max_density = density;
                   } else {
                     if (max_size < size) {
-                      max_size = size
+                      max_size = size;
                       max_density = density;
                     }
                   }
@@ -227,7 +230,7 @@ module.exports.prototype = {
         var java_files = fs.readdirSync(orig_pkgDir).filter(function(f) {
           return f.indexOf('.svn') == -1 && f.indexOf('.java') >= 0 &&
fs.readFileSync(path.join(orig_pkgDir, f), 'utf-8').match(/extends\s+CordovaActivity/);
         });
-        if (java_files.length == 0) {
+        if (java_files.length === 0) {
           throw new Error('No Java files found which extend CordovaActivity.');
         } else if(java_files.length > 1) {
           events.emit('log', 'Multiple candidate Java files (.java files which extend CordovaActivity)
found. Guessing at the first one, ' + java_files[0]);
@@ -304,7 +307,7 @@ module.exports.prototype = {
 // PATCH + MINOR * 100 + MAJOR * 10000
 // see http://developer.android.com/tools/publishing/versioning.html
 function default_versionCode(version) {
-    nums = version.split('-')[0].split('.').map(Number);
+    var nums = version.split('-')[0].split('.').map(Number);
     var versionCode = nums[0] * 10000 + nums[1] * 100 + nums[2];
     return versionCode;
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/682d46d8/cordova-lib/src/cordova/metadata/blackberry10_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/blackberry10_parser.js b/cordova-lib/src/cordova/metadata/blackberry10_parser.js
index 7135524..8d6ec1c 100644
--- a/cordova-lib/src/cordova/metadata/blackberry10_parser.js
+++ b/cordova-lib/src/cordova/metadata/blackberry10_parser.js
@@ -16,6 +16,11 @@
     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
+*/
+
 var fs            = require('fs'),
     path          = require('path'),
     shell         = require('shelljs'),
@@ -46,7 +51,7 @@ module.exports.check_requirements = function(project_root) {
         lib_path = path.join(util.libDirectory, 'blackberry10', 'cordova', require('../platforms').blackberry10.version);
     }
     var d = Q.defer();
-    child_process.exec("\"" + path.join(lib_path, 'bin', 'check_reqs') + "\"", function(err,
output, stderr) {
+    child_process.exec('"' + path.join(lib_path, 'bin', 'check_reqs') + '"', function(err,
output, stderr) {
         if (err) {
             d.reject(new CordovaError('Requirements check failed: ' + output + stderr));
         } else {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/682d46d8/cordova-lib/src/cordova/metadata/firefoxos_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/firefoxos_parser.js b/cordova-lib/src/cordova/metadata/firefoxos_parser.js
index 02238a1..4ccfa5d 100644
--- a/cordova-lib/src/cordova/metadata/firefoxos_parser.js
+++ b/cordova-lib/src/cordova/metadata/firefoxos_parser.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 fs = require('fs'),
     path = require('path'),
     shell = require('shelljs'),
@@ -48,9 +54,9 @@ module.exports.prototype = {
         // overwrite properties existing in config.xml
         var contentNode = config.doc.find('content');
         var contentSrc = contentNode.attrib['src'];
-        manifest.launch_path = path.join("/", contentSrc) || "/index.html";
+        manifest.launch_path = path.join('/', contentSrc) || '/index.html';
 
-        manifest.installs_allowed_from = manifest.installs_allowed_from || ["*"];
+        manifest.installs_allowed_from = manifest.installs_allowed_from || ['*'];
         manifest.version = config.version();
         manifest.name = config.name();
         manifest.pkgName = config.packageName();
@@ -101,7 +107,7 @@ module.exports.prototype = {
                     manifest.permissions[permissionName].access = node.attrib['access'];
                 }
 
-                if (node.attrib['privileged'] === "true") {
+                if (node.attrib['privileged'] === 'true') {
                     privileged = true;
                 }
             });
@@ -122,22 +128,22 @@ module.exports.prototype = {
                 var size = icon.width;
                 var sizeInt = parseInt(size);
 
-                events.emit('verbose', "icon[" + i + "]:" + JSON.stringify(icon));
+                events.emit('verbose', 'icon[' + i + ']:' + JSON.stringify(icon));
 
                 if (size && !isNaN(sizeInt)) {
                     if (icon.src) {
-                        var destfilepath = path.join(this.www_dir(), "icon", "icon-" + size
+ ".png");
+                        var destfilepath = path.join(this.www_dir(), 'icon', 'icon-' + size
+ '.png');
 
-                        manifest.icons[sizeInt] = "/icon/icon-" + size + ".png";
+                        manifest.icons[sizeInt] = '/icon/icon-' + size + '.png';
 
                         if (!fs.existsSync(icon.src)) {
-                            events.emit('verbose', "ignoring icon[" + i + "] icon. File "
+ icon.src + " not found.");
+                            events.emit('verbose', 'ignoring icon[' + i + '] icon. File '
+ icon.src + ' not found.');
                         } else {
                             events.emit('verbose', 'Copying icon from ' + icon.src + ' to
' + destfilepath);
                             shell.cp('-f', icon.src, destfilepath);
                         }
                     } else {
-                        events.emit('warn', "ignoring icon[" + i + "] no src attribute:"
+ JSON.stringify(icon));
+                        events.emit('warn', 'ignoring icon[' + i + '] no src attribute:'
+ JSON.stringify(icon));
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/682d46d8/cordova-lib/src/cordova/metadata/ios_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/ios_parser.js b/cordova-lib/src/cordova/metadata/ios_parser.js
index e5d2a67..9095410 100644
--- a/cordova-lib/src/cordova/metadata/ios_parser.js
+++ b/cordova-lib/src/cordova/metadata/ios_parser.js
@@ -17,6 +17,11 @@
     under the License.
 */
 
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc,
+          sub:true
+*/
+
 var fs            = require('fs'),
     path          = require('path'),
     xcode         = require('xcode'),
@@ -26,8 +31,7 @@ var fs            = require('fs'),
     plist         = require('plist-with-patches'),
     Q             = require('q'),
     ConfigParser  = require('../../configparser/ConfigParser'),
-    CordovaError  = require('../../CordovaError'),
-    config        = require('../config');
+    CordovaError  = require('../../CordovaError');
 
 module.exports = function ios_parser(project) {
     try {
@@ -83,24 +87,24 @@ module.exports.prototype = {
         var appRoot = util.isCordova(platformRoot);
 
         var platformIcons = [
-            {dest: "icon-60.png", width: 60, height: 60},
-            {dest: "icon-60@2x.png", width: 120, height: 120},
-            {dest: "icon-76.png", width: 76, height: 76},
-            {dest: "icon-76@2x.png", width: 152, height: 152},
-            {dest: "icon-small.png", width: 29, height: 29},
-            {dest: "icon-small@2x.png", width: 58, height: 58},
-            {dest: "icon-40.png", width: 40, height: 40},
-            {dest: "icon-40@2x.png", width: 80, height: 80},
-            {dest: "icon.png", width: 57, height: 57},
-            {dest: "icon@2x.png", width: 114, height: 114},
-            {dest: "icon-72.png", width: 72, height: 72},
-            {dest: "icon-72@2x.png", width: 144, height: 144},
-            {dest: "icon-50.png", width: 50, height: 50},
-            {dest: "icon-50@2x.png", width: 100, height: 100}
+            {dest: 'icon-60.png', width: 60, height: 60},
+            {dest: 'icon-60@2x.png', width: 120, height: 120},
+            {dest: 'icon-76.png', width: 76, height: 76},
+            {dest: 'icon-76@2x.png', width: 152, height: 152},
+            {dest: 'icon-small.png', width: 29, height: 29},
+            {dest: 'icon-small@2x.png', width: 58, height: 58},
+            {dest: 'icon-40.png', width: 40, height: 40},
+            {dest: 'icon-40@2x.png', width: 80, height: 80},
+            {dest: 'icon.png', width: 57, height: 57},
+            {dest: 'icon@2x.png', width: 114, height: 114},
+            {dest: 'icon-72.png', width: 72, height: 72},
+            {dest: 'icon-72@2x.png', width: 144, height: 144},
+            {dest: 'icon-50.png', width: 50, height: 50},
+            {dest: 'icon-50@2x.png', width: 100, height: 100}
         ];
 
         platformIcons.forEach(function (item) {
-            icon = icons.getIconBySize(item.width, item.height) || icons.getDefault();
+            var icon = icons.getIconBySize(item.width, item.height) || icons.getDefault();
             if (icon){
                 var src = path.join(appRoot, icon.src),
                     dest = path.join(platformRoot, 'Resources/icons/', item.dest);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/682d46d8/cordova-lib/src/cordova/metadata/ubuntu_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/ubuntu_parser.js b/cordova-lib/src/cordova/metadata/ubuntu_parser.js
index 82e106d..4887fe6 100644
--- a/cordova-lib/src/cordova/metadata/ubuntu_parser.js
+++ b/cordova-lib/src/cordova/metadata/ubuntu_parser.js
@@ -17,14 +17,16 @@
  *
 */
 
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc,
+          sub:true
+*/
+
 var fs            = require('fs'),
     path          = require('path'),
-    et            = require('elementtree'),
-    xml           = require('../../util/xml-helpers'),
     util          = require('../util'),
     events        = require('../../events'),
     shell         = require('shelljs'),
-    project_config= require('../config'),
     Q             = require('q'),
     os            = require('os'),
     ConfigParser  = require('../../configparser/ConfigParser'),
@@ -42,14 +44,15 @@ function sanitize(str) {
 
 // Returns a promise.
 module.exports.check_requirements = function(project_root, callback) {
+    // jshint quotmark:false
     var d = Q.defer();
 
     events.emit('log', 'Checking ubuntu requirements...');
-    command = "dpkg-query -Wf'${db:Status-abbrev}' cmake debhelper libx11-dev libicu-dev
pkg-config qtbase5-dev qtchooser qtdeclarative5-dev qtfeedback5-dev qtlocation5-dev qtmultimedia5-dev
qtpim5-dev qtsensors5-dev qtsystems5-dev 2>/dev/null | grep -q '^i'";
+    var command = "dpkg-query -Wf'${db:Status-abbrev}' cmake debhelper libx11-dev libicu-dev
pkg-config qtbase5-dev qtchooser qtdeclarative5-dev qtfeedback5-dev qtlocation5-dev qtmultimedia5-dev
qtpim5-dev qtsensors5-dev qtsystems5-dev 2>/dev/null | grep -q '^i'";
     events.emit('log', 'Running "' + command + '" (output to follow)');
     shell.exec(command, {silent:true, async:true}, function(code, output) {
         events.emit('log', output);
-        if (code != 0) {
+        if (code !== 0) {
             d.reject(new CordovaError('Make sure you have the following packages installed:
' + output));
         } else {
             d.resolve();
@@ -99,18 +102,18 @@ module.exports.prototype = {
         var manifest = { name: this.config.packageName(),
                          version: this.config.version(),
                          title: this.config.name(),
-                         hooks: { cordova: { desktop: "cordova.desktop",
-                                             apparmor: "apparmor.json" } },
-                         framework: "ubuntu-sdk-13.10",
-                         maintainer: sanitize(this.config.author())  + " <" + this.config.doc.find('author').attrib.email
+ ">",
+                         hooks: { cordova: { desktop: 'cordova.desktop',
+                                             apparmor: 'apparmor.json' } },
+                         framework: 'ubuntu-sdk-13.10',
+                         maintainer: sanitize(this.config.author())  + ' <' + this.config.doc.find('author').attrib.email
+ '>',
                          architecture: arch,
                          description: sanitize(this.config.description()) };
 
         var name = this.config.name().replace(/\n/g, ' '); //FIXME: escaping
-        var content = "[Desktop Entry]\nName=" + name + "\nExec=./cordova-ubuntu www/\nIcon=qmlscene\nTerminal=false\nType=Application\nX-Ubuntu-Touch=true";
+        var content = '[Desktop Entry]\nName=' + name + '\nExec=./cordova-ubuntu www/\nIcon=qmlscene\nTerminal=false\nType=Application\nX-Ubuntu-Touch=true';
 
-        var name = sanitize(this.config.name()); //FIXME: escaping
-        var content = "[Desktop Entry]\nName=" + name + "\nExec=./cordova-ubuntu www/\nTerminal=false\nType=Application\nX-Ubuntu-Touch=true";
+        name = sanitize(this.config.name()); //FIXME: escaping
+        content = '[Desktop Entry]\nName=' + name + '\nExec=./cordova-ubuntu www/\nTerminal=false\nType=Application\nX-Ubuntu-Touch=true';
 
         if (this.config.doc.find('icon') && this.config.doc.find('icon').attrib.src
&& fs.existsSync(path.join(this.path, 'www', this.config.doc.find('icon').attrib.src)))
{
             content += '\nIcon=www/' + this.config.doc.find('icon').attrib.src;
@@ -118,7 +121,7 @@ module.exports.prototype = {
         fs.writeFileSync(path.join(this.path, 'manifest.json'), JSON.stringify(manifest));
         fs.writeFileSync(path.join(this.path, 'cordova.desktop'), content);
 
-        var policy = { policy_groups: ["networking", "audio"], policy_version: 1 };
+        var policy = { policy_groups: ['networking', 'audio'], policy_version: 1 };
 
         this.config.doc.getroot().findall('./feature/param').forEach(function (element) {
             if (element.attrib.policy_group && policy.policy_groups.indexOf(element.attrib.policy_group)
=== -1)

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/682d46d8/cordova-lib/src/cordova/metadata/windows8_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/windows8_parser.js b/cordova-lib/src/cordova/metadata/windows8_parser.js
index e6eb068..b68c934 100644
--- a/cordova-lib/src/cordova/metadata/windows8_parser.js
+++ b/cordova-lib/src/cordova/metadata/windows8_parser.js
@@ -16,9 +16,13 @@
     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 fs            = require('fs'),
     path          = require('path'),
-    et            = require('elementtree'),
     util          = require('../util'),
     events        = require('../../events'),
     shell         = require('shelljs'),
@@ -53,7 +57,7 @@ module.exports.check_requirements = function(project_root) {
 
     var custom_path = config.has_custom_path(project_root, 'windows8');
     if (custom_path) {
-        lib_path = path.join(custom_path, "windows8");
+        lib_path = path.join(custom_path, 'windows8');
     }
     var command = '"' + path.join(lib_path, 'bin', 'check_reqs') + '"';
     events.emit('verbose', 'Running "' + command + '" (output to follow)');
@@ -168,13 +172,13 @@ module.exports.prototype = {
 
         // Icons, that should be added to platform
         var platformIcons = [
-            {dest: "images/logo.png", width: 150, height: 150},
-            {dest: "images/smalllogo.png", width: 30, height: 30},
-            {dest: "images/storelogo.png", width: 50, height: 50},
+            {dest: 'images/logo.png', width: 150, height: 150},
+            {dest: 'images/smalllogo.png', width: 30, height: 30},
+            {dest: 'images/storelogo.png', width: 50, height: 50},
         ];
 
         platformIcons.forEach(function (item) {
-            icon = icons.getIconBySize(item.width, item.height) || icons.getDefault();
+            var icon = icons.getIconBySize(item.width, item.height) || icons.getDefault();
             if (icon){
                 var src = path.join(appRoot, icon.src),
                     dest = path.join(platformRoot, item.dest);
@@ -189,7 +193,7 @@ module.exports.prototype = {
         return path.join(this.windows8_proj_dir, 'www');
     },
     config_xml:function() {
-        return path.join(this.windows8_proj_dir,"config.xml");
+        return path.join(this.windows8_proj_dir,'config.xml');
     },
     // copy files from merges directory to actual www dir
     copy_merges:function(merges_sub_path) {
@@ -202,7 +206,7 @@ module.exports.prototype = {
 
     // Used for creating platform_www in projects created by older versions.
     cordovajs_path:function(libDir) {
-        var jsPath = path.join(libDir, "template", 'www', 'cordova.js');
+        var jsPath = path.join(libDir, 'template', 'www', 'cordova.js');
         return path.resolve(jsPath);
     },
 
@@ -230,11 +234,11 @@ module.exports.prototype = {
         var projFile = new jsproj(this.jsproj_path);
 
         // remove any previous references to the www files
-        projFile.removeSourceFile(new RegExp("www\\\\*", "i"));
+        projFile.removeSourceFile(new RegExp('www\\\\*', 'i'));
 
         // now add all www references back in from the root www folder
         var www_files = this.folder_contents('www', this.www_dir());
-        for(file in www_files) {
+        for(var file in www_files) {
             projFile.addSourceFile(www_files[file]);
         }
         // save file
@@ -246,12 +250,12 @@ module.exports.prototype = {
     folder_contents:function(name, dir) {
         var results = [];
         var folder_dir = fs.readdirSync(dir);
-        for(item in folder_dir) {
+        for(var item in folder_dir) {
             var stat = fs.statSync(path.join(dir, folder_dir[item]));
             // Add all subfolder item paths if it's not a .svn dir.
             if( stat.isDirectory() && (folder_dir[item] !== '.svn') ) {
                 var sub_dir = this.folder_contents(path.join(name, folder_dir[item]), path.join(dir,
folder_dir[item]));
-                for(sub_item in sub_dir) {
+                for(var sub_item in sub_dir) {
                     results.push(sub_dir[sub_item]);
                 }
             } else if(stat.isFile()) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/682d46d8/cordova-lib/src/cordova/metadata/wp8_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/wp8_parser.js b/cordova-lib/src/cordova/metadata/wp8_parser.js
index c23df95..e9c8cce 100644
--- a/cordova-lib/src/cordova/metadata/wp8_parser.js
+++ b/cordova-lib/src/cordova/metadata/wp8_parser.js
@@ -16,9 +16,13 @@
     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 fs            = require('fs'),
     path          = require('path'),
-    et            = require('elementtree'),
     util          = require('../util'),
     events        = require('../../events'),
     shell         = require('shelljs'),
@@ -84,10 +88,10 @@ module.exports.prototype = {
         var name = config.name();
         var prev_name = manifest.find('.//App[@Title]')['attrib']['Title'];
         if(prev_name != name) {
-            //console.log("Updating app name from " + prev_name + " to " + name);
+            //console.log('Updating app name from ' + prev_name + " to " + name);
             manifest.find('.//App').attrib.Title = name;
-            manifest.find('.//App').attrib.Publisher = name + " Publisher";
-            manifest.find('.//App').attrib.Author = name + " Author";
+            manifest.find('.//App').attrib.Publisher = name + ' Publisher';
+            manifest.find('.//App').attrib.Author = name + ' Author';
             manifest.find('.//PrimaryToken').attrib.TokenID = name;
             //update name of sln and csproj.
             name = name.replace(/(\.\s|\s\.|\s+|\.+)/g, '_'); //make it a ligitamate name
@@ -96,7 +100,7 @@ module.exports.prototype = {
             var sln_name = fs.readdirSync(this.wp8_proj_dir).filter(function(e) { return
e.match(/\.sln$/i); })[0];
             var sln_path = path.join(this.wp8_proj_dir, sln_name);
             var sln_file = fs.readFileSync(sln_path, 'utf-8');
-            var name_regex = new RegExp(prev_name, "g");
+            var name_regex = new RegExp(prev_name, 'g');
             fs.writeFileSync(sln_path, sln_file.replace(name_regex, name), 'utf-8');
             shell.mv('-f', this.csproj_path, path.join(this.wp8_proj_dir, name + '.csproj'));
             this.csproj_path = path.join(this.wp8_proj_dir, name + '.csproj');
@@ -111,10 +115,10 @@ module.exports.prototype = {
          *  - App.xaml
          *  - App.xaml.cs
          */
-         var pkg = config.packageName();
-         var csproj = xml.parseElementtreeSync(this.csproj_path);
-         prev_name = csproj.find('.//RootNamespace').text;
-         if(prev_name != pkg) {
+        var pkg = config.packageName();
+        var csproj = xml.parseElementtreeSync(this.csproj_path);
+        prev_name = csproj.find('.//RootNamespace').text;
+        if(prev_name != pkg) {
             //console.log("Updating package name from " + prev_name + " to " + pkg);
             //CordovaAppProj.csproj
             csproj.find('.//RootNamespace').text = pkg;
@@ -137,10 +141,10 @@ module.exports.prototype = {
             //App.xaml.cs
             var appCS = fs.readFileSync(path.join(this.wp8_proj_dir, 'App.xaml.cs'), 'utf-8');
             fs.writeFileSync(path.join(this.wp8_proj_dir, 'App.xaml.cs'), appCS.replace(namespaceRegEx,
'namespace ' + pkg), 'utf-8');
-         }
+        }
 
-         //Write out manifest
-         fs.writeFileSync(this.manifest_path, manifest.write({indent: 4}), 'utf-8');
+        //Write out manifest
+        fs.writeFileSync(this.manifest_path, manifest.write({indent: 4}), 'utf-8');
 
         // Update icons
         var icons = config.getIcons('wp8');
@@ -150,12 +154,12 @@ module.exports.prototype = {
         // icons, that should be added to platform
         // @param dest {string} Path to copy icon to, relative to platform root
         var platformIcons = [
-            {dest: "ApplicationIcon.png", width: 99, height: 99},
-            {dest: "Background.png", width: 159, height: 159},
+            {dest: 'ApplicationIcon.png', width: 99, height: 99},
+            {dest: 'Background.png', width: 159, height: 159},
         ];
 
         platformIcons.forEach(function (item) {
-            icon = icons.getIconBySize(item.width, item.height) || icons.getDefault();
+            var icon = icons.getIconBySize(item.width, item.height) || icons.getDefault();
             if (icon){
                 var src = path.join(appRoot, icon.src),
                     dest = path.join(platformRoot, item.dest);
@@ -212,11 +216,11 @@ module.exports.prototype = {
         var projFile = new csproj(this.csproj_path);
 
         // remove any previous references to the www files
-        projFile.removeSourceFile(new RegExp("www\\\\*", "i"));
+        projFile.removeSourceFile(new RegExp('www\\\\*', 'i'));
 
         // now add all www references back in from the root www folder
         var www_files = this.folder_contents('www', this.www_dir());
-        for(file in www_files) {
+        for(var file in www_files) {
             projFile.addSourceFile(www_files[file]);
         }
         // save file
@@ -228,13 +232,13 @@ module.exports.prototype = {
     folder_contents:function(name, dir) {
         var results = [];
         var folder_dir = fs.readdirSync(dir);
-        for(item in folder_dir) {
+        for(var item in folder_dir) {
             var stat = fs.statSync(path.join(dir, folder_dir[item]));
 
             if(stat.isDirectory()) {
                 var sub_dir = this.folder_contents(path.join(name, folder_dir[item]), path.join(dir,
folder_dir[item]));
                 //Add all subfolder item paths
-                for(sub_item in sub_dir) {
+                for(var sub_item in sub_dir) {
                     results.push(sub_dir[sub_item]);
                 }
             }


Mime
View raw message