You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ka...@apache.org on 2014/06/23 19:34:30 UTC

git commit: Fix a bunch of JSHint errors

Repository: cordova-lib
Updated Branches:
  refs/heads/master 689be9dab -> 0abfcded4


Fix a bunch of JSHint errors

Some JSHint errors introduced all over the place during the weekend.
Please run "npm test" before pushing.


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

Branch: refs/heads/master
Commit: 0abfcded491fc4e15e24992ba101a5863513a1a7
Parents: 689be9d
Author: Mark Koudritsky <ka...@gmail.com>
Authored: Mon Jun 23 13:26:13 2014 -0400
Committer: Mark Koudritsky <ka...@gmail.com>
Committed: Mon Jun 23 13:26:13 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/cordova/metadata/windows_parser.js |  4 ++--
 cordova-lib/src/cordova/platform.js                |  4 ++--
 cordova-lib/src/plugman/fetch.js                   |  4 ++--
 cordova-lib/src/plugman/platforms/windows.js       |  7 ++++---
 cordova-lib/src/plugman/uninstall.js               |  2 +-
 cordova-lib/src/plugman/util/config-changes.js     | 14 +++++++-------
 6 files changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0abfcded/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 9907c9a..96ec44b 100644
--- a/cordova-lib/src/cordova/metadata/windows_parser.js
+++ b/cordova-lib/src/cordova/metadata/windows_parser.js
@@ -68,7 +68,7 @@ module.exports.check_requirements = function(project_root) {
     var custom_path = config.has_custom_path(project_root, 'windows8') ||
         config.has_custom_path(project_root, 'windows');
     if (custom_path) {
-        lib_path = path.join(custom_path, "windows");
+        lib_path = path.join(custom_path, 'windows');
     }
     var command = '"' + path.join(lib_path, 'bin', 'check_reqs') + '"';
     events.emit('verbose', 'Running "' + command + '" (output to follow)');
@@ -276,7 +276,7 @@ module.exports.prototype = {
 
         // 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

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0abfcded/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index be8c60b..be10f92 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -169,10 +169,10 @@ function update(hooks, projectRoot, targets, opts) {
               cordova_util.binname + ' platform list`.';
         return Q.reject(new CordovaError(msg));
     }
-    // CB-6976 Windows Universal Apps. Special case to upgrade from windows8 to windows platform 
+    // CB-6976 Windows Universal Apps. Special case to upgrade from windows8 to windows platform
     if (plat == 'windows8' && !fs.existsSync(path.join(projectRoot, 'platforms', 'windows'))) {
         var platformPathWindows = path.join(projectRoot, 'platforms', 'windows');
-        fs.renameSync(platformPath, platformPathWindows)
+        fs.renameSync(platformPath, platformPathWindows);
         plat = 'windows';
         platformPath = platformPathWindows;
     }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0abfcded/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index 839384b..600a76d 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -139,7 +139,7 @@ function readId(dir) {
 
 function readVersion(dir) {
     var xml_path = path.join(dir, 'plugin.xml');
-    var et = xml_helpers.parseElementtreeSync(path.join(dir, 'plugin.xml'));
+    var et = xml_helpers.parseElementtreeSync(xml_path);
     var plugin_id = et.getroot().attrib.version;
     return plugin_id;
 }
@@ -150,7 +150,7 @@ function checkID(expected_id, dir) {
         var id = readId(dir);
         // if id with specific version provided, append version to id
         if (expected_id.split('@').length > 1) {
-            id = id + "@" + readVersion(dir);
+            id = id + '@' + readVersion(dir);
         }
         if (expected_id != id) {
             throw new Error('Expected fetched plugin to have ID "' + expected_id + '" but got "' + id + '".');

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0abfcded/cordova-lib/src/plugman/platforms/windows.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/windows.js b/cordova-lib/src/plugman/platforms/windows.js
index 21cdfd0..803a3c8 100644
--- a/cordova-lib/src/plugman/platforms/windows.js
+++ b/cordova-lib/src/plugman/platforms/windows.js
@@ -24,14 +24,15 @@
 
 var common = require('./common'),
     path = require('path'),
+    fs   = require('fs'),
     glob = require('glob'),
     jsproj = require('../../util/windows/jsproj'),
     events = require('../../events'),
     xml_helpers = require('../../util/xml-helpers');
 
 module.exports = {
-    platformName:"windows",
-    InvalidProjectPathError:'does not appear to be a Windows 8 or Unified Windows Store project (no .projitems|jsproj file)',
+    platformName: 'windows',
+    InvalidProjectPathError: 'does not appear to be a Windows 8 or Unified Windows Store project (no .projitems|jsproj file)',
     www_dir:function(project_dir) {
         return path.join(project_dir, 'www');
     },
@@ -43,7 +44,7 @@ module.exports = {
             path.join(project_dir, 'package.appxmanifest');
 
         var manifest = xml_helpers.parseElementtreeSync(manifestPath);
-        return manifest.find("Properties/DisplayName").text;
+        return manifest.find('Properties/DisplayName').text;
     },
     parseProjectFile:function(project_dir) {
         var project_files = glob.sync('*.projitems', { cwd:project_dir });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0abfcded/cordova-lib/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/uninstall.js b/cordova-lib/src/plugman/uninstall.js
index 408f6f6..0e0dd2f 100644
--- a/cordova-lib/src/plugman/uninstall.js
+++ b/cordova-lib/src/plugman/uninstall.js
@@ -244,7 +244,7 @@ function handleUninstall(actions, platform, plugin_id, plugin_et, project_dir, w
     // CB-6976 Windows Universal Apps. For smooth transition and to prevent mass api failures
     // we allow using windows8 tag for new windows platform
     if (platform == 'windows' && !platformTag) {
-         platformTag = plugin_et.find('platform[@name="' + 'windows8' + '"]');
+        platformTag = plugin_et.find('platform[@name="' + 'windows8' + '"]');
     }
     www_dir = www_dir || handler.www_dir(project_dir);
     events.emit('log', 'Uninstalling ' + plugin_id + ' from ' + platform);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/0abfcded/cordova-lib/src/plugman/util/config-changes.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/config-changes.js b/cordova-lib/src/plugman/util/config-changes.js
index fad523e..c314b23 100644
--- a/cordova-lib/src/plugman/util/config-changes.js
+++ b/cordova-lib/src/plugman/util/config-changes.js
@@ -194,9 +194,9 @@ function remove_plugin_changes(plugin_name, plugin_id, is_top_level) {
         }
         // CB-6976 Windows Universal Apps. Compatibility fix for existing plugins.
         if (self.platform == 'windows' && file == 'package.appxmanifest' &&
-        	!fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
-        	// New windows template separate manifest files for Windows8, Windows8.1 and WP8.1
-            var substs = ["package.phone.appxmanifest", "package.store.appxmanifest", "package.store80.appxmanifest"];
+            !fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
+            // New windows template separate manifest files for Windows8, Windows8.1 and WP8.1
+            var substs = ['package.phone.appxmanifest', 'package.store.appxmanifest', 'package.store80.appxmanifest'];
             for (var subst in substs) {
                 events.emit('verbose', 'Applying munge to ' + substs[subst]);
                 self.apply_file_munge(substs[subst], munge.files[file], true);
@@ -254,8 +254,8 @@ function add_plugin_changes(plugin_id, plugin_vars, is_top_level, should_increme
         }
         // CB-6976 Windows Universal Apps. Compatibility fix for existing plugins.
         if (self.platform == 'windows' && file == 'package.appxmanifest' &&
-        	!fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
-            var substs = ["package.phone.appxmanifest", "package.store.appxmanifest", "package.store80.appxmanifest"];
+            !fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
+            var substs = ['package.phone.appxmanifest', 'package.store.appxmanifest', 'package.store80.appxmanifest'];
             for (var subst in substs) {
                 events.emit('verbose', 'Applying munge to ' + substs[subst]);
                 self.apply_file_munge(substs[subst], munge.files[file]);
@@ -321,8 +321,8 @@ function generate_plugin_config_munge(plugin_dir, vars) {
     // CB-6976 Windows Universal Apps. For smooth transition and to prevent mass api failures
     // we allow using windows8 tag for new windows platform
     if (self.platform == 'windows' && !platformTag) {
-         platformTag = plugin_xml.find('platform[@name="' + 'windows8' + '"]');
-     }
+        platformTag = plugin_xml.find('platform[@name="' + 'windows8' + '"]');
+    }
 
     var changes = [];
     // add platform-agnostic config changes