You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by au...@apache.org on 2017/07/28 18:26:32 UTC

[01/18] cordova-lib git commit: CB-12895 : set up eslint

Repository: cordova-lib
Updated Branches:
  refs/heads/master 02e734ce9 -> d19951b3e


CB-12895 : set up eslint


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

Branch: refs/heads/master
Commit: 17be6c6845d4adc7ab96a93364f0c83f8853cfeb
Parents: 02e734c
Author: Audrey So <au...@apache.org>
Authored: Wed Jul 19 09:51:05 2017 -0700
Committer: Audrey So <au...@apache.org>
Committed: Fri Jul 28 10:58:30 2017 -0700

----------------------------------------------------------------------
 .eslintignore      |  4 ++++
 .eslintrc.yml      | 10 ++++++++++
 .jshintignore      |  4 ----
 package.json       | 14 ++++++++++----
 spec/.eslintrc.yml |  2 ++
 spec/.jshintrc     | 12 ------------
 src/.jshintrc      | 10 ----------
 7 files changed, 26 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17be6c68/.eslintignore
----------------------------------------------------------------------
diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 0000000..facec45
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,4 @@
+spec/cordova/fixtures/**
+spec/plugman/projects/**
+spec/plugman/plugins/**
+spec/cordova/temp/**

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17be6c68/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/.eslintrc.yml b/.eslintrc.yml
new file mode 100644
index 0000000..0cccb8c
--- /dev/null
+++ b/.eslintrc.yml
@@ -0,0 +1,10 @@
+root: true
+extends: semistandard
+rules:
+  indent:
+    - error
+    - 4
+  camelcase: off
+  padded-blocks: off
+  operator-linebreak: off
+  no-throw-literal: off
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17be6c68/.jshintignore
----------------------------------------------------------------------
diff --git a/.jshintignore b/.jshintignore
deleted file mode 100644
index facec45..0000000
--- a/.jshintignore
+++ /dev/null
@@ -1,4 +0,0 @@
-spec/cordova/fixtures/**
-spec/plugman/projects/**
-spec/plugman/plugins/**
-spec/cordova/temp/**

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17be6c68/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 6878ad7..7a7f4ea 100644
--- a/package.json
+++ b/package.json
@@ -44,17 +44,23 @@
   },
   "devDependencies": {
     "codecov": "^2.1.0",
+    "eslint": "^4.2.0",
+    "eslint-config-semistandard": "^11.0.0",
+    "eslint-config-standard": "^10.2.1",
+    "eslint-plugin-import": "^2.7.0",
+    "eslint-plugin-node": "^5.1.1",
+    "eslint-plugin-promise": "^3.5.0",
+    "eslint-plugin-standard": "^3.0.1",
     "istanbul": "^0.4.5",
     "jasmine": "^2.5.2",
-    "jshint": "2.5.8",
     "rewire": "2.5.2"
   },
   "scripts": {
-    "test": "npm run jshint && npm run unit-tests && npm run e2e-tests",
-    "jshint": "jshint src spec",
+    "test": "npm run eslint && npm run unit-tests && npm run e2e-tests",
+    "eslint": "eslint src spec",
     "unit-tests": "jasmine JASMINE_CONFIG_PATH=spec/jasmine.json",
     "cover": "istanbul cover --root src --print detail jasmine JASMINE_CONFIG_PATH=spec/jasmine.json",
-    "e2e-tests" : "jasmine JASMINE_CONFIG_PATH=integration-tests/jasmine.json"
+    "e2e-tests": "jasmine JASMINE_CONFIG_PATH=integration-tests/jasmine.json"
   },
   "contributors": [
     {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17be6c68/spec/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/spec/.eslintrc.yml b/spec/.eslintrc.yml
new file mode 100644
index 0000000..6afba65
--- /dev/null
+++ b/spec/.eslintrc.yml
@@ -0,0 +1,2 @@
+env:
+    jasmine: true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17be6c68/spec/.jshintrc
----------------------------------------------------------------------
diff --git a/spec/.jshintrc b/spec/.jshintrc
deleted file mode 100644
index 381f147..0000000
--- a/spec/.jshintrc
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-    "node": true
-  , "bitwise": true
-  , "undef": true
-  , "trailing": true
-  , "quotmark": true
-  , "indent": 4
-  , "unused": "vars"
-  , "latedef": "nofunc"
-  , "jasmine": true
-  , "predef" : [ "xdescribe"]
-}

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17be6c68/src/.jshintrc
----------------------------------------------------------------------
diff --git a/src/.jshintrc b/src/.jshintrc
deleted file mode 100644
index 89a121c..0000000
--- a/src/.jshintrc
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-    "node": true
-  , "bitwise": true
-  , "undef": true
-  , "trailing": true
-  , "quotmark": true
-  , "indent": 4
-  , "unused": "vars"
-  , "latedef": "nofunc"
-}


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


[13/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/integration-tests/pkgJson-restore.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/pkgJson-restore.spec.js b/integration-tests/pkgJson-restore.spec.js
index 0913a41..a241b74 100644
--- a/integration-tests/pkgJson-restore.spec.js
+++ b/integration-tests/pkgJson-restore.spec.js
@@ -17,16 +17,16 @@
     under the License.
     */
     var helpers = require('../spec/helpers'),
-    path = require('path'),
-    shell = require('shelljs'),
-    events = require('cordova-common').events,
-    ConfigParser = require('cordova-common').ConfigParser,
-    cordovaPlatform = require('../src/cordova/platform'),
-    prepare = require('../src/cordova/prepare'),
-    cordova_util = require('../src/cordova/util'),
-    cordovaPlugin = require('../src/cordova/plugin'),
-    //cordova = require('../src/cordova/cordova'),
-    TIMEOUT = 60 * 1000;
+        path = require('path'),
+        shell = require('shelljs'),
+        events = require('cordova-common').events,
+        ConfigParser = require('cordova-common').ConfigParser,
+        cordovaPlatform = require('../src/cordova/platform'),
+        prepare = require('../src/cordova/prepare'),
+        cordova_util = require('../src/cordova/util'),
+        cordovaPlugin = require('../src/cordova/plugin'),
+    // cordova = require('../src/cordova/cordova'),
+        TIMEOUT = 60 * 1000;
 
 /** Testing will check if "cordova prepare" is restoring platforms and plugins as expected.
 *   Uses different basePkgJson files depending on testing expecations of what (platforms/plugins/variables)
@@ -34,331 +34,331 @@
 */
 
 // Use basePkgJson
-describe('tests platform/spec restore with --save', function () {
-    var tmpDir = helpers.tmpDir('platform_test_pkgjson2');
-    var project = path.join(tmpDir, 'project');
-    var results;
+    describe('tests platform/spec restore with --save', function () {
+        var tmpDir = helpers.tmpDir('platform_test_pkgjson2');
+        var project = path.join(tmpDir, 'project');
+        var results;
 
-    beforeEach(function() {
-        shell.rm('-rf', project);
+        beforeEach(function () {
+            shell.rm('-rf', project);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson'), tmpDir);
-        shell.mv(path.join(tmpDir, 'basePkgJson'), project);
-        process.chdir(project);
-        delete process.env.PWD;
-        events.on('results', function(res) { results = res; });
-    });
+            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson'), tmpDir);
+            shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+            process.chdir(project);
+            delete process.env.PWD;
+            events.on('results', function (res) { results = res; });
+        });
 
-    afterEach(function() {
-        cordova_util.requireNoCache(path.join(process.cwd(),'package.json'));
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-        shell.rm('-rf', tmpDir);
-    });
+        afterEach(function () {
+            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+            shell.rm('-rf', tmpDir);
+        });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordovaPlatform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
-            expect(installed).toBeDefined();
-            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-        });
-    }
-    /** Test#000 will check that when a platform is added with a spec, it will 
+        function emptyPlatformList () {
+            return cordovaPlatform('list').then(function () {
+                var installed = results.match(/Installed platforms:\n {2}(.*)/);
+                expect(installed).toBeDefined();
+                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+            });
+        }
+    /** Test#000 will check that when a platform is added with a spec, it will
     *   add to pkg.json with a '^' and to config.xml with a '~'. When prepare is run,
     *   pkg.json will have no change and config.xml (first char) will change from a '~' to a '^'.
     */
-    it('Test#000 : tests that the spec (~,^) is added and updated as expected in config.xml', function(done) {
-        var cwd = process.cwd();
-        var pkgJsonPath = path.join(cwd,'package.json');
-        cordova_util.requireNoCache(pkgJsonPath);
-        var pkgJson;
-        var androidPlatform = 'android';
-        var configXmlPath = path.join(cwd, 'config.xml');
-        var firstCharConfig;
-        var engines;
-        var engNames;
-        var engSpec;
-
-        emptyPlatformList().then(function() {
+        it('Test#000 : tests that the spec (~,^) is added and updated as expected in config.xml', function (done) {
+            var cwd = process.cwd();
+            var pkgJsonPath = path.join(cwd, 'package.json');
+            cordova_util.requireNoCache(pkgJsonPath);
+            var pkgJson;
+            var androidPlatform = 'android';
+            var configXmlPath = path.join(cwd, 'config.xml');
+            var firstCharConfig;
+            var engines;
+            var engNames;
+            var engSpec;
+
+            emptyPlatformList().then(function () {
             // Add platform with save, fetch
-            return cordovaPlatform('add', androidPlatform, {'save':true , 'fetch':true});
-        }).then(function() {
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                return cordovaPlatform('add', androidPlatform, {'save': true, 'fetch': true});
+            }).then(function () {
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Added platform properly to pkg.json
-            expect(pkgJson.cordova.platforms).toBeDefined();
-            expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
+                expect(pkgJson.cordova.platforms).toBeDefined();
+                expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
             // When spec is added to pkg.json, first char is '^'.
-            expect(pkgJson.dependencies['cordova-'+androidPlatform].charAt(0)).toEqual('^');
-
-            var cfg = new ConfigParser(configXmlPath);
-            engines = cfg.getEngines();
-            engNames = engines.map(function(elem) {
-                return elem.name;
-            });
-            engSpec = engines.map(function(elem) {
-                return elem.spec;
-            });
+                expect(pkgJson.dependencies['cordova-' + androidPlatform].charAt(0)).toEqual('^');
+
+                var cfg = new ConfigParser(configXmlPath);
+                engines = cfg.getEngines();
+                engNames = engines.map(function (elem) {
+                    return elem.name;
+                });
+                engSpec = engines.map(function (elem) {
+                    return elem.spec;
+                });
             // Only android platform added to config.xml
-            expect(engNames).toEqual([ androidPlatform ]);
-            expect(engines.length === 1);
+                expect(engNames).toEqual([ androidPlatform ]);
+                expect(engines.length === 1);
             // When spec is added to config.xml, first char is '~'.
-            firstCharConfig = engSpec[0].charAt(0);
-            expect(firstCharConfig === '~');
-        }).then(function() {
+                firstCharConfig = engSpec[0].charAt(0);
+                expect(firstCharConfig === '~');
+            }).then(function () {
             // Run cordova prepare
-            return prepare();
-        }).then(function() {
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                return prepare();
+            }).then(function () {
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // No changes to pkg.json spec for android.
-            expect(pkgJson.dependencies['cordova-'+androidPlatform].charAt(0)).toEqual('^');
-            expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
+                expect(pkgJson.dependencies['cordova-' + androidPlatform].charAt(0)).toEqual('^');
+                expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
             // Config.xml spec (first char) should change from '~' to '^'.
-            var cfg1 = new ConfigParser(configXmlPath);
-            engines = cfg1.getEngines();
-            engNames = engines.map(function(elem) {
-                return elem.name;
-            });
-            engSpec = engines.map(function(elem) {
-                return elem.spec;
-            });
-            firstCharConfig = engSpec[0].charAt(0);
+                var cfg1 = new ConfigParser(configXmlPath);
+                engines = cfg1.getEngines();
+                engNames = engines.map(function (elem) {
+                    return elem.name;
+                });
+                engSpec = engines.map(function (elem) {
+                    return elem.spec;
+                });
+                firstCharConfig = engSpec[0].charAt(0);
             // When spec is added to config.xml, first char is '~'.
-            expect(firstCharConfig === '^');
-            expect(engNames).toEqual([ androidPlatform ]);
-            expect(engines.length === 1);
-        }).fail(function(err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+                expect(firstCharConfig === '^');
+                expect(engNames).toEqual([ androidPlatform ]);
+                expect(engines.length === 1);
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },300000);
+        }, 300000);
 
     /** Test#017
-    *   When platform is added with url and fetch and restored with fetch, 
+    *   When platform is added with url and fetch and restored with fetch,
     *   pkg.json and config.xml would add it to their files properly.
     *   When prepare is run with fetch, platform should be installed.
     */
-    it('Test#017 : test to make sure that platform url is added and restored properly', function(done) {
-        var cwd = process.cwd();
-        var pkgJsonPath = path.join(cwd,'package.json');
-        var pkgJson;
-        var platformsFolderPath = path.join(cwd,'platforms/platforms.json');
-        var platformsJson;
-        var configXmlPath = path.join(cwd, 'config.xml');
-        var bPlatform = 'browser';
-        var engines;
-        var engNames;
-        var engSpec;
-
-        emptyPlatformList().then(function() {
+        it('Test#017 : test to make sure that platform url is added and restored properly', function (done) {
+            var cwd = process.cwd();
+            var pkgJsonPath = path.join(cwd, 'package.json');
+            var pkgJson;
+            var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
+            var platformsJson;
+            var configXmlPath = path.join(cwd, 'config.xml');
+            var bPlatform = 'browser';
+            var engines;
+            var engNames;
+            var engSpec;
+
+            emptyPlatformList().then(function () {
             // Add platform with save and fetch
-            return cordovaPlatform('add', 'https://github.com/apache/cordova-browser', {'save':true, 'fetch':true});
-        }).then(function() {
+                return cordovaPlatform('add', 'https://github.com/apache/cordova-browser', {'save': true, 'fetch': true});
+            }).then(function () {
             // Check that platform was added to config.xml successfully.
-            var cfg = new ConfigParser(configXmlPath);
-            engines = cfg.getEngines();
-            engNames = engines.map(function(elem) {
-                return elem.name;
-            });
-            engSpec = engines.map(function(elem) {
-                return elem.spec;
-            });
-            expect(engNames).toEqual([bPlatform]);
-            expect(engSpec).toEqual([ 'https://github.com/apache/cordova-browser' ]);
+                var cfg = new ConfigParser(configXmlPath);
+                engines = cfg.getEngines();
+                engNames = engines.map(function (elem) {
+                    return elem.name;
+                });
+                engSpec = engines.map(function (elem) {
+                    return elem.spec;
+                });
+                expect(engNames).toEqual([bPlatform]);
+                expect(engSpec).toEqual([ 'https://github.com/apache/cordova-browser' ]);
             // Check that platform was added to pkg.json successfully.
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
-            expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
+                expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
             // Check that platform was added to platforms list successfully.
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-            expect(platformsJson[bPlatform]).toBeDefined();
-        }).then(function() {
+                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+                expect(platformsJson[bPlatform]).toBeDefined();
+            }).then(function () {
             // Remove platform without --save.
-            return cordovaPlatform('rm', bPlatform, {'fetch':true});
-        }).then(function() {
+                return cordovaPlatform('rm', bPlatform, {'fetch': true});
+            }).then(function () {
             // Platform in pkg.json should still be there.
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
-            expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
+                expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
             // Platform in platforms.json should not be there.
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-            expect(platformsJson[bPlatform]).toBeUndefined();
-        }).then(function() {
+                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+                expect(platformsJson[bPlatform]).toBeUndefined();
+            }).then(function () {
             // Run cordova prepare
-            return prepare({'fetch':true});
-        }).then(function() {
+                return prepare({'fetch': true});
+            }).then(function () {
             // Check config.xml for spec modification.
-            var cfg3 = new ConfigParser(configXmlPath);
-            engines = cfg3.getEngines();
-            engNames = engines.map(function(elem) {
-                return elem.name;
-            });
-            engSpec = engines.map(function(elem) {
-                return elem.spec;
-            });
-            expect(engNames).toEqual([ 'browser' ]);
-            expect(engSpec).toEqual([ 'git+https://github.com/apache/cordova-browser.git' ]);
+                var cfg3 = new ConfigParser(configXmlPath);
+                engines = cfg3.getEngines();
+                engNames = engines.map(function (elem) {
+                    return elem.name;
+                });
+                engSpec = engines.map(function (elem) {
+                    return elem.spec;
+                });
+                expect(engNames).toEqual([ 'browser' ]);
+                expect(engSpec).toEqual([ 'git+https://github.com/apache/cordova-browser.git' ]);
             // No change to pkg.json.
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
-            expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
+                expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
             // Check that platform was restored to platform.json list successfully.
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-            expect(platformsJson[bPlatform]).toBeDefined();
-        }).fail(function(err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+                expect(platformsJson[bPlatform]).toBeDefined();
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },TIMEOUT);
+        }, TIMEOUT);
 
     /** Test#018
-    *   When plugin is added with url and fetch and restored with fetch, 
+    *   When plugin is added with url and fetch and restored with fetch,
     *   pkg.json and config.xml would add it to their files properly.
     *   When prepare is run with fetch, plugin should be installed.
     */
-    it('Test#018 : test to make sure that plugin url is added and restored properly', function(done) {
-        var cwd = process.cwd();
-        var pkgJsonPath = path.join(cwd,'package.json');
-        var pkgJson;
-        var pluginsFolderPath = path.join(cwd,'plugins');
-        var configXmlPath = path.join(cwd, 'config.xml');
-        var configPlugins;
-        var configPlugin;
-
-        emptyPlatformList().then(function() {
+        it('Test#018 : test to make sure that plugin url is added and restored properly', function (done) {
+            var cwd = process.cwd();
+            var pkgJsonPath = path.join(cwd, 'package.json');
+            var pkgJson;
+            var pluginsFolderPath = path.join(cwd, 'plugins');
+            var configXmlPath = path.join(cwd, 'config.xml');
+            var configPlugins;
+            var configPlugin;
+
+            emptyPlatformList().then(function () {
             // Add plugin with save and fetch.
-            return cordovaPlugin('add', ['https://github.com/apache/cordova-plugin-splashscreen'], {'save':true, 'fetch':true});
-        }).then(function() {
+                return cordovaPlugin('add', ['https://github.com/apache/cordova-plugin-splashscreen'], {'save': true, 'fetch': true});
+            }).then(function () {
             // Plugin id and spec were added to config.xml successfully.
-            var cfg = new ConfigParser(configXmlPath);
-            configPlugins = cfg.getPluginIdList();
-            configPlugin = cfg.getPlugin(configPlugins);
-            expect(configPlugin.spec).toEqual('https://github.com/apache/cordova-plugin-splashscreen');
-            expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
-            // Plugin was added to pkg.json successfully in plugin list and dependencies.   
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            expect(pkgJson.dependencies).toEqual({ 'cordova-plugin-splashscreen': 'git+https://github.com/apache/cordova-plugin-splashscreen.git' });
-            expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
+                var cfg = new ConfigParser(configXmlPath);
+                configPlugins = cfg.getPluginIdList();
+                configPlugin = cfg.getPlugin(configPlugins);
+                expect(configPlugin.spec).toEqual('https://github.com/apache/cordova-plugin-splashscreen');
+                expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
+            // Plugin was added to pkg.json successfully in plugin list and dependencies.
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                expect(pkgJson.dependencies).toEqual({ 'cordova-plugin-splashscreen': 'git+https://github.com/apache/cordova-plugin-splashscreen.git' });
+                expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
             // Plugin was added to installed plugin list successfully.
-            expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).toExist();
-        }).then(function() {
+                expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).toExist();
+            }).then(function () {
             // Remove plugin without --save.
-            return cordovaPlugin('rm', 'cordova-plugin-splashscreen', {'fetch':true});
-        }).then(function() {
+                return cordovaPlugin('rm', 'cordova-plugin-splashscreen', {'fetch': true});
+            }).then(function () {
             // Plugin id and spec are still in config.xml.
-            var cfg2 = new ConfigParser(configXmlPath);
-            configPlugins = cfg2.getPluginIdList();
-            configPlugin = cfg2.getPlugin(configPlugins);
-            expect(configPlugin.spec).toEqual('https://github.com/apache/cordova-plugin-splashscreen');
-            expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
+                var cfg2 = new ConfigParser(configXmlPath);
+                configPlugins = cfg2.getPluginIdList();
+                configPlugin = cfg2.getPlugin(configPlugins);
+                expect(configPlugin.spec).toEqual('https://github.com/apache/cordova-plugin-splashscreen');
+                expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
             // Plugin still in pkg.json plugin list and dependencies.
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            expect(pkgJson.dependencies).toEqual({ 'cordova-plugin-splashscreen': 'git+https://github.com/apache/cordova-plugin-splashscreen.git' });
-            expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                expect(pkgJson.dependencies).toEqual({ 'cordova-plugin-splashscreen': 'git+https://github.com/apache/cordova-plugin-splashscreen.git' });
+                expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
             // Plugin was removed from the installed plugin list successfully.
-            expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).not.toExist();
-        }).then(function() {
+                expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).not.toExist();
+            }).then(function () {
             // Add platform (so that prepare can run).
-            return cordovaPlatform('add', 'browser', {'save':true});
-        }).then(function() {
+                return cordovaPlatform('add', 'browser', {'save': true});
+            }).then(function () {
             // Run cordova prepare with fetch.
-            return prepare({'fetch':true});
-        }).then(function() {
+                return prepare({'fetch': true});
+            }).then(function () {
             // Config.xml spec is modified.
-            var cfg3 = new ConfigParser(configXmlPath);
-            configPlugins = cfg3.getPluginIdList();
-            configPlugin = cfg3.getPlugin(configPlugins);
-            expect(configPlugin.spec).toEqual('git+https://github.com/apache/cordova-plugin-splashscreen.git');
-            expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
+                var cfg3 = new ConfigParser(configXmlPath);
+                configPlugins = cfg3.getPluginIdList();
+                configPlugin = cfg3.getPlugin(configPlugins);
+                expect(configPlugin.spec).toEqual('git+https://github.com/apache/cordova-plugin-splashscreen.git');
+                expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
             // Pkg.json splashscreen dependency has no changes.
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            expect (pkgJson.dependencies['cordova-plugin-splashscreen']).toEqual('git+https://github.com/apache/cordova-plugin-splashscreen.git');
-            expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                expect(pkgJson.dependencies['cordova-plugin-splashscreen']).toEqual('git+https://github.com/apache/cordova-plugin-splashscreen.git');
+                expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
             // Plugin was restored and added to installed plugin list successfully.
-            expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).toExist();
-        }).fail(function(err) {
+                expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).toExist();
+            }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },TIMEOUT);
-});
+        }, TIMEOUT);
+    });
 
 // Use basePkgJson
-describe('tests platform/spec restore with --save', function () {
-    var tmpDir = helpers.tmpDir('platform_test_pkgjson2');
-    var project = path.join(tmpDir, 'project');
-    var results;
+    describe('tests platform/spec restore with --save', function () {
+        var tmpDir = helpers.tmpDir('platform_test_pkgjson2');
+        var project = path.join(tmpDir, 'project');
+        var results;
 
-    beforeEach(function() {
-        shell.rm('-rf', tmpDir);
+        beforeEach(function () {
+            shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson'), tmpDir);
-        shell.mv(path.join(tmpDir, 'basePkgJson'), project);
-        process.chdir(project);
-        events.on('results', function(res) { results = res; });
-    });
+            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson'), tmpDir);
+            shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+            process.chdir(project);
+            events.on('results', function (res) { results = res; });
+        });
 
-    afterEach(function() {
-        cordova_util.requireNoCache(path.join(process.cwd(),'package.json'));
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-        shell.rm('-rf', tmpDir);
-    });
+        afterEach(function () {
+            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+            shell.rm('-rf', tmpDir);
+        });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordovaPlatform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
-            expect(installed).toBeDefined();
-            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-        });
-    }
+        function emptyPlatformList () {
+            return cordovaPlatform('list').then(function () {
+                var installed = results.match(/Installed platforms:\n {2}(.*)/);
+                expect(installed).toBeDefined();
+                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+            });
+        }
 
-    function fullPlatformList() {
-        return cordovaPlatform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
-            expect(installed).toBeDefined();
-            expect(installed[1].indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
-        });
-    }
+        function fullPlatformList () {
+            return cordovaPlatform('list').then(function () {
+                var installed = results.match(/Installed platforms:\n {2}(.*)/);
+                expect(installed).toBeDefined();
+                expect(installed[1].indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
+            });
+        }
     /** Test#003 will add two platforms to package.json - one with the 'save' flag and one
     *   without the 'save' flag. It will remove both platforms without a 'save' flag.
     *   After running cordova prepare, only the platform added with the 'save' flag is restored
     *   in platforms.json.
     */
-    it('Test#003 : should NOT restore platform that was not saved and removed', function(done) {
-        var cwd = process.cwd();
-        var pkgJsonPath = path.join(cwd,'package.json');
-        var pkgJson;
-        var platformsFolderPath = path.join(cwd,'platforms/platforms.json');
-        var secondPlatformAdded = 'browser';
-        var platformsJson;
-
-        emptyPlatformList().then(function() {
+        it('Test#003 : should NOT restore platform that was not saved and removed', function (done) {
+            var cwd = process.cwd();
+            var pkgJsonPath = path.join(cwd, 'package.json');
+            var pkgJson;
+            var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
+            var secondPlatformAdded = 'browser';
+            var platformsJson;
+
+            emptyPlatformList().then(function () {
             // Add 'browser' platform to project without --save
-            return cordovaPlatform('add', secondPlatformAdded);
-        }).then(function() {
+                return cordovaPlatform('add', secondPlatformAdded);
+            }).then(function () {
             // Add helpers.testPlatform to project with --save
-            return cordovaPlatform('add', [helpers.testPlatform], {'save':true});
-        }).then(function() {
+                return cordovaPlatform('add', [helpers.testPlatform], {'save': true});
+            }).then(function () {
             // Delete any previous caches of require(package.json) and (platformsJson)
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
             // Check the platform add of only helpers.testPlatform was successful in package.json.
-            expect(pkgJson.cordova.platforms).toBeDefined();
-            expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
-            expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(-1);
+                expect(pkgJson.cordova.platforms).toBeDefined();
+                expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
+                expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(-1);
             // Expect both platforms to be installed platform list in platforms.json
-            expect(platformsJson[helpers.testPlatform]).toBeDefined();
-            expect(platformsJson[secondPlatformAdded]).toBeDefined();
-        }).then(fullPlatformList) // Platforms should still be in platform ls.
-        .then(function() {
+                expect(platformsJson[helpers.testPlatform]).toBeDefined();
+                expect(platformsJson[secondPlatformAdded]).toBeDefined();
+            }).then(fullPlatformList) // Platforms should still be in platform ls.
+        .then(function () {
             // Remove helpers.testPlatform without --save.
             return cordovaPlatform('rm', [helpers.testPlatform]);
-        }).then(function() {
+        }).then(function () {
             // Remove secondPlatformAdded without --save.
             return cordovaPlatform('rm', secondPlatformAdded);
-        }).then(function() {
+        }).then(function () {
             // Delete any previous caches of require(pkgJson) and (platformsJson)
             platformsJson = cordova_util.requireNoCache(platformsFolderPath);
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
@@ -367,1004 +367,1007 @@ describe('tests platform/spec restore with --save', function () {
             // Check that both platforms were removed from the platforms.json.
             expect(platformsJson[secondPlatformAdded]).toBeUndefined();
             expect(platformsJson[helpers.testPlatform]).toBeUndefined();
-        }).then(function() {
+        }).then(function () {
             // Run cordova prepare
             return prepare();
-        }).then(function() {
+        }).then(function () {
             // Delete any previous caches of platformsJson
             platformsJson = cordova_util.requireNoCache(platformsFolderPath);
             // Expect "helpers.testPlatform" to be in the installed platforms list.
             expect(platformsJson[helpers.testPlatform]).toBeDefined();
             // Expect that 'browser' will not be in platforms.json and has not been restored.
             expect(platformsJson[secondPlatformAdded]).toBeUndefined();
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },TIMEOUT);
-});
+        }, TIMEOUT);
+    });
 
 // Use basePkgJson6 because pkg.json and config.xml contain only android
-describe('files should not be modified if their platforms are identical', function () {
-    var tmpDir = helpers.tmpDir('platform_test_pkgjson');
-    var project = path.join(tmpDir, 'project');
-    var results;
+    describe('files should not be modified if their platforms are identical', function () {
+        var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+        var project = path.join(tmpDir, 'project');
+        var results;
 
-    beforeEach(function() {
-        shell.rm('-rf', tmpDir);
+        beforeEach(function () {
+            shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
         // Use basePkgJson6 because pkg.json and config.xml contain only android
-        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson6'), tmpDir);
-        shell.mv(path.join(tmpDir, 'basePkgJson6'), project);
-        process.chdir(project);
-        events.on('results', function(res) { results = res; });
-    });
+            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson6'), tmpDir);
+            shell.mv(path.join(tmpDir, 'basePkgJson6'), project);
+            process.chdir(project);
+            events.on('results', function (res) { results = res; });
+        });
 
-    afterEach(function() {
-        cordova_util.requireNoCache(path.join(process.cwd(),'package.json'));
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-        shell.rm('-rf', tmpDir);
-    });
+        afterEach(function () {
+            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+            shell.rm('-rf', tmpDir);
+        });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordovaPlatform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
-            expect(installed).toBeDefined();
-            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-        });
-    }
-    /** Test#004 will check the platform list in package.json and config.xml. 
-    *   When both files contain the same platforms and cordova prepare is run, 
+        function emptyPlatformList () {
+            return cordovaPlatform('list').then(function () {
+                var installed = results.match(/Installed platforms:\n {2}(.*)/);
+                expect(installed).toBeDefined();
+                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+            });
+        }
+    /** Test#004 will check the platform list in package.json and config.xml.
+    *   When both files contain the same platforms and cordova prepare is run,
     *   neither file is modified.
     */
-    it('Test#004 : if pkg.json and config.xml have the same platforms, do not modify either file', function(done) {
-        var cwd = process.cwd();
-        var configXmlPath = path.join(cwd, 'config.xml');
-        var cfg1 = new ConfigParser(configXmlPath);
-        var engines = cfg1.getEngines();
-        var pkgJsonPath = path.join(cwd,'package.json');
-        var pkgJson;
-        var engNames = engines.map(function(elem) {
-            return elem.name;
-        });
-        var configEngArray = engNames.slice();
-        // Pkg.json and config.xml contain only android at this point (basePkgJson6).
-        emptyPlatformList().then(function() {
-            // Run cordova prepare.
-            return prepare();
-        }).then(function() {
-            var cfg2 = new ConfigParser(configXmlPath);
-            engines = cfg2.getEngines();
-            engNames = engines.map(function(elem) {
+        it('Test#004 : if pkg.json and config.xml have the same platforms, do not modify either file', function (done) {
+            var cwd = process.cwd();
+            var configXmlPath = path.join(cwd, 'config.xml');
+            var cfg1 = new ConfigParser(configXmlPath);
+            var engines = cfg1.getEngines();
+            var pkgJsonPath = path.join(cwd, 'package.json');
+            var pkgJson;
+            var engNames = engines.map(function (elem) {
                 return elem.name;
             });
-            configEngArray = engNames.slice();
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            var configEngArray = engNames.slice();
+        // Pkg.json and config.xml contain only android at this point (basePkgJson6).
+            emptyPlatformList().then(function () {
+            // Run cordova prepare.
+                return prepare();
+            }).then(function () {
+                var cfg2 = new ConfigParser(configXmlPath);
+                engines = cfg2.getEngines();
+                engNames = engines.map(function (elem) {
+                    return elem.name;
+                });
+                configEngArray = engNames.slice();
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Expect android to be in both pkg.json and config.xml.
-            expect(pkgJson.cordova.platforms.indexOf('android')).toBeGreaterThan(-1);
-            expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
+                expect(pkgJson.cordova.platforms.indexOf('android')).toBeGreaterThan(-1);
+                expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
             // Expect pkg.json and config.xml to have only 1 element each.
-            expect(configEngArray.length === 1);
-            expect(pkgJson.cordova.platforms.length === 1);
-        }).fail(function(err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+                expect(configEngArray.length === 1);
+                expect(pkgJson.cordova.platforms.length === 1);
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },TIMEOUT);
-});
+        }, TIMEOUT);
+    });
 
 // Use a new basePkgJson5 as config.xml contains android/browser and pkg.json contains android
-describe('update pkg.json to include platforms in config.xml', function () {
-    var tmpDir = helpers.tmpDir('platform_test_pkgjson');
-    var project = path.join(tmpDir, 'project');
-    var results;
+    describe('update pkg.json to include platforms in config.xml', function () {
+        var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+        var project = path.join(tmpDir, 'project');
+        var results;
 
-    beforeEach(function() {
-        shell.rm('-rf', tmpDir);
+        beforeEach(function () {
+            shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson5'), tmpDir);
-        shell.mv(path.join(tmpDir, 'basePkgJson5'), project);
-        process.chdir(project);
-        events.on('results', function(res) { results = res; });
-    });
+            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson5'), tmpDir);
+            shell.mv(path.join(tmpDir, 'basePkgJson5'), project);
+            process.chdir(project);
+            events.on('results', function (res) { results = res; });
+        });
 
-    afterEach(function() {
-        cordova_util.requireNoCache(path.join(process.cwd(),'package.json'));
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-        shell.rm('-rf', tmpDir);
-    });
+        afterEach(function () {
+            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+            shell.rm('-rf', tmpDir);
+        });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordovaPlatform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
-            expect(installed).toBeDefined();
-            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-        });
-    }
-    /** Test#005 will check the platform list in package.json and config.xml. 
+        function emptyPlatformList () {
+            return cordovaPlatform('list').then(function () {
+                var installed = results.match(/Installed platforms:\n {2}(.*)/);
+                expect(installed).toBeDefined();
+                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+            });
+        }
+    /** Test#005 will check the platform list in package.json and config.xml.
     *   When config.xml has 'android and browser' and pkg.json only contains 'android', run cordova
     *   and pkg.json is updated to include 'browser'. This test will also check that pkg.json
     *   is updated with the correct spec/dependencies when restored. Checks that specs are
     *   added properly, too.
     */
-    it('Test#005 : if config.xml has android & browser platforms and pkg.json has android, update pkg.json to also include browser with spec', function(done) {
-        var cwd = process.cwd();
-        var configXmlPath = path.join(cwd, 'config.xml');
-        var cfg = new ConfigParser(configXmlPath);
-        var engines = cfg.getEngines();
-        var pkgJsonPath = path.join(cwd,'package.json');
-        cordova_util.requireNoCache(pkgJsonPath);
-        var pkgJson = require(pkgJsonPath);
-        var engNames = engines.map(function(elem) {
-            return elem.name;
-        });
-        var configEngArray = engNames.slice();
-        var androidPlatform = 'android';
-        var browserPlatform = 'browser';
+        it('Test#005 : if config.xml has android & browser platforms and pkg.json has android, update pkg.json to also include browser with spec', function (done) {
+            var cwd = process.cwd();
+            var configXmlPath = path.join(cwd, 'config.xml');
+            var cfg = new ConfigParser(configXmlPath);
+            var engines = cfg.getEngines();
+            var pkgJsonPath = path.join(cwd, 'package.json');
+            cordova_util.requireNoCache(pkgJsonPath);
+            var pkgJson = require(pkgJsonPath);
+            var engNames = engines.map(function (elem) {
+                return elem.name;
+            });
+            var configEngArray = engNames.slice();
+            var androidPlatform = 'android';
+            var browserPlatform = 'browser';
 
         // Config.xml contains(android & browser) and pkg.json contains android (basePkgJson5).
-        expect(configEngArray.indexOf(androidPlatform)).toBeGreaterThan(-1);
-        expect(configEngArray.indexOf(browserPlatform)).toBeGreaterThan(-1);
+            expect(configEngArray.indexOf(androidPlatform)).toBeGreaterThan(-1);
+            expect(configEngArray.indexOf(browserPlatform)).toBeGreaterThan(-1);
         // pkg.json should not contain 'browser' platform before cordova prepare.
-        expect(pkgJson.cordova.platforms.indexOf(browserPlatform)).toEqual(-1);
-        expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
+            expect(pkgJson.cordova.platforms.indexOf(browserPlatform)).toEqual(-1);
+            expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
         // pkg.json browser/android specs should be undefined.
-        expect(pkgJson.dependencies[browserPlatform]).toBeUndefined();
-        expect(pkgJson.dependencies[androidPlatform]).toBeUndefined();
-        emptyPlatformList().then(function() {
-            return prepare();
-        }).then(function() {
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            expect(pkgJson.dependencies[browserPlatform]).toBeUndefined();
+            expect(pkgJson.dependencies[androidPlatform]).toBeUndefined();
+            emptyPlatformList().then(function () {
+                return prepare();
+            }).then(function () {
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Expect 'browser' to be added to pkg.json.
-            expect(pkgJson.cordova.platforms.indexOf(browserPlatform)).toBeGreaterThan(-1);
+                expect(pkgJson.cordova.platforms.indexOf(browserPlatform)).toBeGreaterThan(-1);
             // Expect 'android' to still be there in pkg.json.
-            expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
+                expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
             // Expect both pkg.json and config.xml to each have both platforms in their arrays.
-            expect(configEngArray.length === 2);
-            expect(pkgJson.cordova.platforms.length === 2);
+                expect(configEngArray.length === 2);
+                expect(pkgJson.cordova.platforms.length === 2);
             // No changes to config.xml.
-            expect(configEngArray.indexOf(androidPlatform)).toBeGreaterThan(-1);
-            expect(configEngArray.indexOf(browserPlatform)).toBeGreaterThan(-1);
+                expect(configEngArray.indexOf(androidPlatform)).toBeGreaterThan(-1);
+                expect(configEngArray.indexOf(browserPlatform)).toBeGreaterThan(-1);
             // Platform specs from config.xml have been added to pkg.json.
-            expect(pkgJson.dependencies['cordova-browser']).toEqual('^4.1.0');
-            expect(pkgJson.dependencies['cordova-android']).toEqual('6.1.1');
-        }).fail(function(err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+                expect(pkgJson.dependencies['cordova-browser']).toEqual('^4.1.0');
+                expect(pkgJson.dependencies['cordova-android']).toEqual('6.1.1');
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },TIMEOUT);
-});
+        }, TIMEOUT);
+    });
 
 // Use basePkgJson3 as it has 'android' in config.xml and pkg.json (no cordova key).
-describe('update empty package.json to match config.xml', function () {
-    var tmpDir = helpers.tmpDir('platform_test_pkgjson');
-    var project = path.join(tmpDir, 'project');
-    var results;
+    describe('update empty package.json to match config.xml', function () {
+        var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+        var project = path.join(tmpDir, 'project');
+        var results;
 
-    beforeEach(function() {
-        shell.rm('-rf', tmpDir);
+        beforeEach(function () {
+            shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson3'), tmpDir);
-        shell.mv(path.join(tmpDir, 'basePkgJson3'), project);
-        process.chdir(project);
-        events.on('results', function(res) { results = res; });
-    });
+            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson3'), tmpDir);
+            shell.mv(path.join(tmpDir, 'basePkgJson3'), project);
+            process.chdir(project);
+            events.on('results', function (res) { results = res; });
+        });
 
-    afterEach(function() {
-        cordova_util.requireNoCache(path.join(process.cwd(),'package.json'));
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-        shell.rm('-rf', tmpDir);
-    });
+        afterEach(function () {
+            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+            shell.rm('-rf', tmpDir);
+        });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordovaPlatform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
-            expect(installed).toBeDefined();
-            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-        });
-    }
+        function emptyPlatformList () {
+            return cordovaPlatform('list').then(function () {
+                var installed = results.match(/Installed platforms:\n {2}(.*)/);
+                expect(installed).toBeDefined();
+                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+            });
+        }
     /** Test#006 will check if pkg.json has a cordova key and platforms installed already.
      *   If it does not and config.xml has a platform(s) installed already, run cordova prepare
      *   and it will add a cordova key and the platform(s) from config.xml to package.json.
      */
-     it('Test#006 : if pkg.json exists without cordova key, create one with same platforms in config.xml ', function(done) {
-        var cwd = process.cwd();
-        var configXmlPath = path.join(cwd, 'config.xml');
-        var pkgJsonPath = path.join(cwd,'package.json');
-        cordova_util.requireNoCache(pkgJsonPath);
-        var cfg1 = new ConfigParser(configXmlPath);
-        var engines = cfg1.getEngines();
-        var pkgJson = require(pkgJsonPath);
-        var engNames = engines.map(function(elem) {
-            return elem.name;
-        });
-        var configEngArray = engNames.slice();
+        it('Test#006 : if pkg.json exists without cordova key, create one with same platforms in config.xml ', function (done) {
+            var cwd = process.cwd();
+            var configXmlPath = path.join(cwd, 'config.xml');
+            var pkgJsonPath = path.join(cwd, 'package.json');
+            cordova_util.requireNoCache(pkgJsonPath);
+            var cfg1 = new ConfigParser(configXmlPath);
+            var engines = cfg1.getEngines();
+            var pkgJson = require(pkgJsonPath);
+            var engNames = engines.map(function (elem) {
+                return elem.name;
+            });
+            var configEngArray = engNames.slice();
 
         // Expect that pkg.json exists without a cordova key.
-        expect(pkgJson).toBeDefined();
-        expect(pkgJson.cordova).toBeUndefined();
+            expect(pkgJson).toBeDefined();
+            expect(pkgJson.cordova).toBeUndefined();
         // Expect that config.xml contains only android at this point.
-        expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
-        expect(configEngArray.length === 1);
+            expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
+            expect(configEngArray.length === 1);
         // Run cordova prepare.
-        prepare();
-        emptyPlatformList().then(function() {
-            var cfg2 = new ConfigParser(configXmlPath);
-            engines = cfg2.getEngines();
-            engNames = engines.map(function(elem) {
-                return elem.name;
-            });
-            configEngArray = engNames.slice();
+            prepare();
+            emptyPlatformList().then(function () {
+                var cfg2 = new ConfigParser(configXmlPath);
+                engines = cfg2.getEngines();
+                engNames = engines.map(function (elem) {
+                    return elem.name;
+                });
+                configEngArray = engNames.slice();
             // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Expect no change to config.xml.
-            expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
+                expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
             // Expect cordova key and 'android' platform to be added to pkg.json.
-            expect(pkgJson.cordova.platforms.indexOf('android')).toBeGreaterThan(-1);
+                expect(pkgJson.cordova.platforms.indexOf('android')).toBeGreaterThan(-1);
             // Expect both pkg.json and config.xml to each have (only) android in their arrays.
-            expect(configEngArray.length === 1);
-            expect(pkgJson.cordova.platforms.length === 1);
-        }).fail(function(err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+                expect(configEngArray.length === 1);
+                expect(pkgJson.cordova.platforms.length === 1);
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },TIMEOUT);
- });
+        }, TIMEOUT);
+    });
 
 // Use a new basePkgJson4 as pkg.json contains android/browser and config.xml contains android.
-describe('update config.xml to include platforms in pkg.json', function () {
-    var tmpDir = helpers.tmpDir('platform_test_pkgjson');
-    var project = path.join(tmpDir, 'project');
-    var results;
+    describe('update config.xml to include platforms in pkg.json', function () {
+        var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+        var project = path.join(tmpDir, 'project');
+        var results;
 
-    beforeEach(function() {
-        shell.rm('-rf', tmpDir);
+        beforeEach(function () {
+            shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson4'), tmpDir);
-        shell.mv(path.join(tmpDir, 'basePkgJson4'), project);
-        process.chdir(project);
-        events.on('results', function(res) { results = res; });
-    });
+            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson4'), tmpDir);
+            shell.mv(path.join(tmpDir, 'basePkgJson4'), project);
+            process.chdir(project);
+            events.on('results', function (res) { results = res; });
+        });
 
-    afterEach(function() {
-        cordova_util.requireNoCache(path.join(process.cwd(),'package.json'));
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-        shell.rm('-rf', tmpDir);
-    });
+        afterEach(function () {
+            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+            shell.rm('-rf', tmpDir);
+        });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordovaPlatform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
-            expect(installed).toBeDefined();
-            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-        });
-    }
-    /** Test#007 will check the platform list in package.json and config.xml. 
+        function emptyPlatformList () {
+            return cordovaPlatform('list').then(function () {
+                var installed = results.match(/Installed platforms:\n {2}(.*)/);
+                expect(installed).toBeDefined();
+                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+            });
+        }
+    /** Test#007 will check the platform list in package.json and config.xml.
     *   When package.json has 'android and browser' and config.xml only contains 'android', run cordova
     *   and config.xml is updated to include 'browser'. Also, if there is a specified spec in pkg.json,
     *   it should be added to config.xml during restore.
     */
-    it('Test#007 : if pkgJson has android & browser platforms and config.xml has android, update config to also include browser and spec', function(done) {
-        var cwd = process.cwd();
-        var configXmlPath = path.join(cwd, 'config.xml');
-        var cfg1 = new ConfigParser(configXmlPath);
-        var engines = cfg1.getEngines();
-        var pkgJsonPath = path.join(cwd,'package.json');
-        cordova_util.requireNoCache(pkgJsonPath);
-        var pkgJson = require(pkgJsonPath);
-        var engNames = engines.map(function(elem) {
-            return elem.name;
-        });
-        var configEngArray = engNames.slice();
+        it('Test#007 : if pkgJson has android & browser platforms and config.xml has android, update config to also include browser and spec', function (done) {
+            var cwd = process.cwd();
+            var configXmlPath = path.join(cwd, 'config.xml');
+            var cfg1 = new ConfigParser(configXmlPath);
+            var engines = cfg1.getEngines();
+            var pkgJsonPath = path.join(cwd, 'package.json');
+            cordova_util.requireNoCache(pkgJsonPath);
+            var pkgJson = require(pkgJsonPath);
+            var engNames = engines.map(function (elem) {
+                return elem.name;
+            });
+            var configEngArray = engNames.slice();
 
         // Expect that config.xml contains only android at this point (basePjgJson4)
-        expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
-        expect(configEngArray.indexOf('browser')).toEqual(-1);
-        expect(configEngArray.length === 1);
+            expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
+            expect(configEngArray.indexOf('browser')).toEqual(-1);
+            expect(configEngArray.length === 1);
         // Pkg.json has cordova-browser in its dependencies.
-        expect(pkgJson.dependencies).toEqual({ 'cordova-android' : '^3.1.0', 'cordova-browser' : '^4.1.0' });
-        emptyPlatformList().then(function() {
+            expect(pkgJson.dependencies).toEqual({ 'cordova-android': '^3.1.0', 'cordova-browser': '^4.1.0' });
+            emptyPlatformList().then(function () {
             // Run cordova prepare.
-            return prepare();
-        }).then(function() {
+                return prepare();
+            }).then(function () {
             // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            var cfg2 = new ConfigParser(configXmlPath);
-            engines = cfg2.getEngines();
-            engNames = engines.map(function(elem) {
-                return elem.name;
-            });
-            configEngArray = engNames.slice();
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                var cfg2 = new ConfigParser(configXmlPath);
+                engines = cfg2.getEngines();
+                engNames = engines.map(function (elem) {
+                    return elem.name;
+                });
+                configEngArray = engNames.slice();
             // Expect 'browser' to be added to config.xml.
-            expect(configEngArray.indexOf('browser')).toBeGreaterThan(-1);
+                expect(configEngArray.indexOf('browser')).toBeGreaterThan(-1);
             // Expect 'android' to still be in config.xml.
-            expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
+                expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
             // Expect config.xml array to have 2 elements (platforms).
-            expect(configEngArray.length === 2);
+                expect(configEngArray.length === 2);
             // Check to make sure that 'browser' spec was added properly.
-            expect(engines).toEqual([ { name: 'android', spec: '^3.1.0' },{ name: 'browser', spec: '^4.1.0' } ]);
+                expect(engines).toEqual([ { name: 'android', spec: '^3.1.0' }, { name: 'browser', spec: '^4.1.0' } ]);
             // No change to pkg.json dependencies.
-            expect(pkgJson.dependencies).toEqual({ 'cordova-android' : '^3.1.0', 'cordova-browser' : '^4.1.0' });
-            expect(pkgJson.dependencies['cordova-android']).toEqual('^3.1.0');
-            expect(pkgJson.dependencies['cordova-browser']).toEqual('^4.1.0');
-        }).fail(function(err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+                expect(pkgJson.dependencies).toEqual({ 'cordova-android': '^3.1.0', 'cordova-browser': '^4.1.0' });
+                expect(pkgJson.dependencies['cordova-android']).toEqual('^3.1.0');
+                expect(pkgJson.dependencies['cordova-browser']).toEqual('^4.1.0');
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },TIMEOUT);
-});
+        }, TIMEOUT);
+    });
 
 // Plugin testing begins here.
 
 // Use basePkgJson8 as pkg.json contains 1 plugin and 1 variable and config contains 1 plugin 1 var
 // Same variable, different values... pkg.json should win
-describe('update config.xml to use the variable found in pkg.json', function () {
-    var tmpDir = helpers.tmpDir('platform_test_pkgjson');
-    var project = path.join(tmpDir, 'project');
-    var results;
+    describe('update config.xml to use the variable found in pkg.json', function () {
+        var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+        var project = path.join(tmpDir, 'project');
+        var results;
 
-    beforeEach(function() {
-        shell.rm('-rf', tmpDir);
+        beforeEach(function () {
+            shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson8'), tmpDir);
-        shell.mv(path.join(tmpDir, 'basePkgJson8'), project);
-        process.chdir(project);
-        events.on('results', function(res) { results = res; });
-    });
+            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson8'), tmpDir);
+            shell.mv(path.join(tmpDir, 'basePkgJson8'), project);
+            process.chdir(project);
+            events.on('results', function (res) { results = res; });
+        });
 
-    afterEach(function() {
-        cordova_util.requireNoCache(path.join(process.cwd(),'package.json'));
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-        shell.rm('-rf', tmpDir);
-    });
-    // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordovaPlatform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
-            expect(installed).toBeDefined();
-            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+        afterEach(function () {
+            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+            shell.rm('-rf', tmpDir);
         });
-    }
-    /** Test#011 will check the plugin/variable list in package.json and config.xml. 
+    // Factoring out some repeated checks.
+        function emptyPlatformList () {
+            return cordovaPlatform('list').then(function () {
+                var installed = results.match(/Installed platforms:\n {2}(.*)/);
+                expect(installed).toBeDefined();
+                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+            });
+        }
+    /** Test#011 will check the plugin/variable list in package.json and config.xml.
     *   When pkg.json and config.xml have the same variables, but different values,
     *   pkg.json should win and that value will be used and replaces config's value.
     */
-    it('Test#011 : if pkg.Json has 1 plugin and 1 variable, update config.xml to include these variables', function(done) {
-        var cwd = process.cwd();
-        var configXmlPath = path.join(cwd, 'config.xml');
-        var pkgJsonPath = path.join(cwd,'package.json');
-        cordova_util.requireNoCache(pkgJsonPath);
-        var cfg1 = new ConfigParser(configXmlPath);
-        var configPlugins = cfg1.getPluginIdList();
-        var configPlugin = cfg1.getPlugin(configPlugins);
-        var configPluginVariables = configPlugin.variables;
-        var pkgJson = require(pkgJsonPath);
-        var pluginsFolderPath = path.join(cwd,'plugins');
+        it('Test#011 : if pkg.Json has 1 plugin and 1 variable, update config.xml to include these variables', function (done) {
+            var cwd = process.cwd();
+            var configXmlPath = path.join(cwd, 'config.xml');
+            var pkgJsonPath = path.join(cwd, 'package.json');
+            cordova_util.requireNoCache(pkgJsonPath);
+            var cfg1 = new ConfigParser(configXmlPath);
+            var configPlugins = cfg1.getPluginIdList();
+            var configPlugin = cfg1.getPlugin(configPlugins);
+            var configPluginVariables = configPlugin.variables;
+            var pkgJson = require(pkgJsonPath);
+            var pluginsFolderPath = path.join(cwd, 'plugins');
 
         // Expect that pkg.json exists with 1 plugin, 1 variable, and a different value ('json').
-        expect(pkgJson.cordova.plugins).toBeDefined();
-        expect(Object.keys(pkgJson.cordova.plugins).length === 1);
-        expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
-        expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toEqual({ variable_1: 'json' });
+            expect(pkgJson.cordova.plugins).toBeDefined();
+            expect(Object.keys(pkgJson.cordova.plugins).length === 1);
+            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
+            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toEqual({ variable_1: 'json' });
         // Expect that config.xml exists with 1 plugin, 1 variable, but a different value ('config').
-        expect(configPlugin.name).toEqual('cordova-plugin-camera');
-        expect(configPluginVariables).toEqual({ variable_1: 'config' });
-        expect(Object.keys(configPlugin).length === 1);
+            expect(configPlugin.name).toEqual('cordova-plugin-camera');
+            expect(configPluginVariables).toEqual({ variable_1: 'config' });
+            expect(Object.keys(configPlugin).length === 1);
 
-        emptyPlatformList().then(function() {
+            emptyPlatformList().then(function () {
             // Run cordova prepare.
-            return prepare();
-        }).then(function() {
+                return prepare();
+            }).then(function () {
             // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            var cfg2 = new ConfigParser(configXmlPath);
-            configPlugins = cfg2.getPluginIdList();
-            configPlugin = cfg2.getPlugin(configPlugins);
-            configPluginVariables = configPlugin.variables;
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                var cfg2 = new ConfigParser(configXmlPath);
+                configPlugins = cfg2.getPluginIdList();
+                configPlugin = cfg2.getPlugin(configPlugins);
+                configPluginVariables = configPlugin.variables;
             // Expect that pkg.json exists with 1 plugin, 1 variable, and the pkg.json value.
-            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
-            expect(Object.keys(pkgJson.cordova.plugins).length === 1);
-            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toEqual({ variable_1: 'json' });
+                expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
+                expect(Object.keys(pkgJson.cordova.plugins).length === 1);
+                expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toEqual({ variable_1: 'json' });
             // Expect that config.xml exists with 1 plugin, 1 variable and pkg.json's value.
-            expect(configPlugin.name).toEqual('cordova-plugin-camera');
-            expect(configPluginVariables).toEqual({ variable_1: 'json' });
-            expect(Object.keys(configPlugin).length === 1);
+                expect(configPlugin.name).toEqual('cordova-plugin-camera');
+                expect(configPluginVariables).toEqual({ variable_1: 'json' });
+                expect(Object.keys(configPlugin).length === 1);
             // Expect that the camera plugin is restored.
-            expect(path.join(pluginsFolderPath, 'cordova-plugin-camera')).toExist();
-        }).fail(function(err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+                expect(path.join(pluginsFolderPath, 'cordova-plugin-camera')).toExist();
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },TIMEOUT);
-});
+        }, TIMEOUT);
+    });
 
 // Use basePkgJson9 as config contains 1 plugin and 1 variable and pkg.json contains 1 plugin 0 var
-describe('update pkg.json to include plugin and variable found in config.xml', function () {
-    var tmpDir = helpers.tmpDir('platform_test_pkgjson');
-    var project = path.join(tmpDir, 'project');
-    var results;
+    describe('update pkg.json to include plugin and variable found in config.xml', function () {
+        var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+        var project = path.join(tmpDir, 'project');
+        var results;
 
-    beforeEach(function() {
-        shell.rm('-rf', tmpDir);
+        beforeEach(function () {
+            shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson9'), tmpDir);
-        shell.mv(path.join(tmpDir, 'basePkgJson9'), project);
-        process.chdir(project);
-        events.on('results', function(res) { results = res; });
-    });
+            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson9'), tmpDir);
+            shell.mv(path.join(tmpDir, 'basePkgJson9'), project);
+            process.chdir(project);
+            events.on('results', function (res) { results = res; });
+        });
 
-    afterEach(function() {
-        cordova_util.requireNoCache(path.join(process.cwd(),'package.json'));
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-        shell.rm('-rf', tmpDir);
-    });
+        afterEach(function () {
+            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+            shell.rm('-rf', tmpDir);
+        });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordovaPlatform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
-            expect(installed).toBeDefined();
-            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-        });
-    }
-    /** Test#012 will check the plugin/variable list in package.json and config.xml. 
+        function emptyPlatformList () {
+            return cordovaPlatform('list').then(function () {
+                var installed = results.match(/Installed platforms:\n {2}(.*)/);
+                expect(installed).toBeDefined();
+                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+            });
+        }
+    /** Test#012 will check the plugin/variable list in package.json and config.xml.
     *   When config.xml has a 'camera plugin and 1 variable' and pkg.json has 1 plugins/0 variables,
     *   cordova prepare runs and will update pkg.json to match config.xml's plugins/variables.
     */
-    it('Test#012 : if pkg.Json has 1 plugin and 2 variables, update config.xml to include these plugins/variables', function(done) {
-        var cwd = process.cwd();
-        var configXmlPath = path.join(cwd, 'config.xml');
-        var pkgJsonPath = path.join(cwd,'package.json');
+        it('Test#012 : if pkg.Json has 1 plugin and 2 variables, update config.xml to include these plugins/variables', function (done) {
+            var cwd = process.cwd();
+            var configXmlPath = path.join(cwd, 'config.xml');
+            var pkgJsonPath = path.join(cwd, 'package.json');
         // Delete any previous caches of require(package.json).
-        cordova_util.requireNoCache(pkgJsonPath);
-        var cfg1 = new ConfigParser(configXmlPath);
-        var configPlugins = cfg1.getPluginIdList();
-        var configPlugin = cfg1.getPlugin(configPlugins);
-        var configPluginVariables = configPlugin.variables;
-        var pkgJson = require(pkgJsonPath);
-        var pluginsFolderPath12 = path.join(cwd,'plugins');
+            cordova_util.requireNoCache(pkgJsonPath);
+            var cfg1 = new ConfigParser(configXmlPath);
+            var configPlugins = cfg1.getPluginIdList();
+            var configPlugin = cfg1.getPlugin(configPlugins);
+            var configPluginVariables = configPlugin.variables;
+            var pkgJson = require(pkgJsonPath);
+            var pluginsFolderPath12 = path.join(cwd, 'plugins');
 
         // Expect that pkg.json exists with 1 plugin without a variable.
-        expect(pkgJson.cordova.plugins).toBeDefined();
-        expect(Object.keys(pkgJson.cordova.plugins).length === 1);
-        expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
-        expect(pkgJson.cordova.plugins).toEqual({ 'cordova-plugin-camera': {} });
+            expect(pkgJson.cordova.plugins).toBeDefined();
+            expect(Object.keys(pkgJson.cordova.plugins).length === 1);
+            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
+            expect(pkgJson.cordova.plugins).toEqual({ 'cordova-plugin-camera': {} });
 
         // Expect that config.xml exists with 1 plugin and 1 variable with value_1.
-        expect(configPlugin.name).toEqual('cordova-plugin-camera');
-        expect(configPluginVariables).toEqual({ variable_1: 'value_1' });
-        expect(Object.keys(configPlugin).length === 1);
+            expect(configPlugin.name).toEqual('cordova-plugin-camera');
+            expect(configPluginVariables).toEqual({ variable_1: 'value_1' });
+            expect(Object.keys(configPlugin).length === 1);
 
-        emptyPlatformList().then(function() {
+            emptyPlatformList().then(function () {
             // Run cordova prepare.
-            return prepare();
-        }).then(function() {
+                return prepare();
+            }).then(function () {
             // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            var cfg2 = new ConfigParser(configXmlPath);
-            configPlugins = cfg2.getPluginIdList();
-            configPlugin = cfg2.getPlugin(configPlugins);
-            configPluginVariables = configPlugin.variables;
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                var cfg2 = new ConfigParser(configXmlPath);
+                configPlugins = cfg2.getPluginIdList();
+                configPlugin = cfg2.getPlugin(configPlugins);
+                configPluginVariables = configPlugin.variables;
             // Expect that pkg.json exists with 1 plugin, 1 variable, and 1 value.
-            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
-            expect(Object.keys(pkgJson.cordova.plugins).length === 1);
-            expect(pkgJson.cordova.plugins).toEqual({ 'cordova-plugin-camera': { variable_1: 'value_1' } });
+                expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
+                expect(Object.keys(pkgJson.cordova.plugins).length === 1);
+                expect(pkgJson.cordova.plugins).toEqual({ 'cordova-plugin-camera': { variable_1: 'value_1' } });
             // Expect that config.xml exists with 1 plugin, 1 variable and 1 value.
-            expect(configPlugin.name).toEqual('cordova-plugin-camera');
-            expect(configPluginVariables).toEqual({ variable_1: 'value_1' });
-            expect(Object.keys(configPlugin).length === 1);
-            //Expect camera to be restored and in the installed plugin list.
-            expect(path.join(pluginsFolderPath12, 'cordova-plugin-camera')).toExist();
-        }).fail(function(err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+                expect(configPlugin.name).toEqual('cordova-plugin-camera');
+                expect(configPluginVariables).toEqual({ variable_1: 'value_1' });
+                expect(Object.keys(configPlugin).length === 1);
+            // Expect camera to be restored and in the installed plugin list.
+                expect(path.join(pluginsFolderPath12, 'cordova-plugin-camera')).toExist();
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },TIMEOUT);
-});
+        }, TIMEOUT);
+    });
 
-// Use basePkgJson10 as pkg.json contains (camera plugin: var 1/var 2, splashscreen plugin). 
+// Use basePkgJson10 as pkg.json contains (camera plugin: var 1/var 2, splashscreen plugin).
 // and config contains (camera plugin: var 3, value 1, device plugin).
-describe('update pkg.json AND config.xml to include all plugins and merge unique variables', function () {
-    var tmpDir = helpers.tmpDir('plugin_test_pkgjson');
-    var project = path.join(tmpDir, 'project');
-    var results;
+    describe('update pkg.json AND config.xml to include all plugins and merge unique variables', function () {
+        var tmpDir = helpers.tmpDir('plugin_test_pkgjson');
+        var project = path.join(tmpDir, 'project');
+        var results;
 
-    beforeEach(function() {
-        shell.rm('-rf', tmpDir);
+        beforeEach(function () {
+            shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson10'), tmpDir);
-        shell.mv(path.join(tmpDir, 'basePkgJson10'), project);
-        process.chdir(project);
-        events.on('results', function(res) { results = res; });
-    });
+            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson10'), tmpDir);
+            shell.mv(path.join(tmpDir, 'basePkgJson10'), project);
+            process.chdir(project);
+            events.on('results', function (res) { results = res; });
+        });
 
-    afterEach(function() {
-        cordova_util.requireNoCache(path.join(process.cwd(),'package.json'));
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-        shell.rm('-rf', tmpDir);
-    });
+        afterEach(function () {
+            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+            shell.rm('-rf', tmpDir);
+        });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordovaPlatform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
-            expect(installed).toBeDefined();
-            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-        });
-    }
-    /** Test#013 will check the plugin/variable list in package.json and config.xml. 
+        function emptyPlatformList () {
+            return cordovaPlatform('list').then(function () {
+                var installed = results.match(/Installed platforms:\n {2}(.*)/);
+                expect(installed).toBeDefined();
+                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+            });
+        }
+    /** Test#013 will check the plugin/variable list in package.json and config.xml.
     *   For plugins that are the same, it will merge their variables together for the final list.
     *   Plugins that are unique to that file, will be copied over to the file that is missing it.
     *   Config.xml and pkg.json will have identical plugins and variables after cordova prepare.
     */
-    it('Test#013 : update pkg.json AND config.xml to include all plugins and merge unique variables', function(done) {
-        var cwd = process.cwd();
-        var configXmlPath = path.join(cwd, 'config.xml');
-        var pkgJsonPath = path.join(cwd,'package.json');
-        cordova_util.requireNoCache(pkgJsonPath);
-        var cfg1 = new ConfigParser(configXmlPath);
-        var configPlugins = cfg1.getPluginIdList();
-        var pkgJson = require(pkgJsonPath);
-        var configPlugin;
-        var configPluginVariables;
-        var pluginsFolderPath13 = path.join(cwd,'plugins');
+        it('Test#013 : update pkg.json AND config.xml to include all plugins and merge unique variables', function (done) {
+            var cwd = process.cwd();
+            var configXmlPath = path.join(cwd, 'config.xml');
+            var pkgJsonPath = path.join(cwd, 'package.json');
+            cordova_util.requireNoCache(pkgJsonPath);
+            var cfg1 = new ConfigParser(configXmlPath);
+            var configPlugins = cfg1.getPluginIdList();
+            var pkgJson = require(pkgJsonPath);
+            var configPlugin;
+            var configPluginVariables;
+            var pluginsFolderPath13 = path.join(cwd, 'plugins');
 
         // Config.xml has 2 plugins and does not have device plugin yet.
-        expect(Object.keys(configPlugins).length === 2);
-        expect(configPlugins.indexOf('cordova-plugin-device')).toEqual(-1);
-        expect(configPlugins.indexOf('cordova-plugin-camera')).toEqual(0);
-        expect(configPlugins.indexOf('cordova-plugin-splashscreen')).toEqual(1);
+            expect(Object.keys(configPlugins).length === 2);
+            expect(configPlugins.indexOf('cordova-plugin-device')).toEqual(-1);
+            expect(configPlugins.indexOf('cordova-plugin-camera')).toEqual(0);
+            expect(configPlugins.indexOf('cordova-plugin-splashscreen')).toEqual(1);
         // Config.xml camera plugin has var_3,value_3 and splashscreen has 0 variables.
-        for (var i = 0; i < configPlugins.length; i++) {
-            configPlugin = cfg1.getPlugin(configPlugins[i]);
-            configPluginVariables = configPlugin.variables;
-            if(configPlugin.name === 'cordova-plugin-camera') {
-                expect(configPluginVariables).toEqual({ variable_3: 'value_3'});
-            }
-            if(configPlugin.name === 'cordova-plugin-splashscreen') {
-                expect(configPluginVariables).toEqual({});
+            for (var i = 0; i < configPlugins.length; i++) {
+                configPlugin = cfg1.getPlugin(configPlugins[i]);
+                configPluginVariables = configPlugin.variables;
+                if (configPlugin.name === 'cordova-plugin-camera') {
+                    expect(configPluginVariables).toEqual({ variable_3: 'value_3'});
+                }
+                if (configPlugin.name === 'cordova-plugin-splashscreen') {
+                    expect(configPluginVariables).toEqual({});
+                }
             }
-        }
         // Expect that pkg.json exists with 3 plugins (camera, device, and splashscreen)
-        expect(pkgJson.cordova.plugins).toBeDefined();
-        expect(Object.keys(pkgJson.cordova.plugins).length === 3);
-        expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
-        expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
-        expect(pkgJson.cordova.plugins['cordova-plugin-device']).toBeDefined();
+            expect(pkgJson.cordova.plugins).toBeDefined();
+            expect(Object.keys(pkgJson.cordova.plugins).length === 3);
+            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
+            expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
+            expect(pkgJson.cordova.plugins['cordova-plugin-device']).toBeDefined();
         // Splashscreen has no variables and camera has var_1 and var_2 and device has var_1, val_1.
-        expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toEqual({});
-        expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toEqual({ variable_1: ' ', variable_2: ' ' });
-        expect(pkgJson.cordova.plugins['cordova-plugin-device']).toEqual({ variable_1: 'value_1' });
+            expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toEqual({});
+            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toEqual({ variable_1: ' ', variable_2: ' ' });
+            expect(pkgJson.cordova.plugins['cordova-plugin-device']).toEqual({ variable_1: 'value_1' });
 
-        emptyPlatformList().then(function() {
+            emptyPlatformList().then(function () {
             // Run cordova prepare.
-            return prepare();
-        }).then(function() {
+                return prepare();
+            }).then(function () {
             // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            var cfg2 = new ConfigParser(configXmlPath);
-            configPlugins = cfg2.getPluginIdList();
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                var cfg2 = new ConfigParser(configXmlPath);
+                configPlugins = cfg2.getPluginIdList();
             // Check to make sure that variables were added as expected.
-            for (var i = 0; i < configPlugins.length; i++) {
-                configPlugin = cfg2.getPlugin(configPlugins[i]);
-                configPluginVariables = configPlugin.variables;
+                for (var i = 0; i < configPlugins.length; i++) {
+                    configPlugin = cfg2.getPlugin(configPlugins[i]);
+                    configPluginVariables = configPlugin.variables;
                 // Config.xml camera variables have been merged, no duplicates.
-                if(configPlugin.name === '

<TRUNCATED>

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


[09/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/platform/index.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/platform/index.spec.js b/spec/cordova/platform/index.spec.js
index 546694d..5146902 100644
--- a/spec/cordova/platform/index.spec.js
+++ b/spec/cordova/platform/index.spec.js
@@ -14,8 +14,6 @@
     specific language governing permissions and limitations
     under the License.
 */
-// TODO: remove these once eslint lands
-/* eslint-env jasmine */
 /* globals fail */
 
 var rewire = require('rewire');
@@ -49,11 +47,11 @@ describe('cordova/platform', function () {
                     // targets = null
                     return platform('remove', null);
                 })
-                .then(function () {
-                    fail('should not succeed without targets');
-                }, function (err) {
-                    expect(err).toMatch(/You need to qualify.* with one or more platforms/gi);
-                }).done(done);
+                    .then(function () {
+                        fail('should not succeed without targets');
+                    }, function (err) {
+                        expect(err).toMatch(/You need to qualify.* with one or more platforms/gi);
+                    }).done(done);
             });
         });
         describe('handling of targets parameter', function () {
@@ -64,119 +62,119 @@ describe('cordova/platform', function () {
             it('should be able to handle an array of platform targets', function (done) {
                 var targets = ['nokia brick', 'HAM radio', 'nintendo wii'];
                 platform(cmd, targets)
-                .then(function () {
-                    expect(platform[cmd]).toHaveBeenCalledWith(jasmine.any(Object), projectRoot, targets, jasmine.any(Object));
-                }).fail(function (e) {
-                    expect(e).toBeUndefined();
-                    fail('did not expect fail handler to be invoked');
-                }).done(done);
+                    .then(function () {
+                        expect(platform[cmd]).toHaveBeenCalledWith(jasmine.any(Object), projectRoot, targets, jasmine.any(Object));
+                    }).fail(function (e) {
+                        expect(e).toBeUndefined();
+                        fail('did not expect fail handler to be invoked');
+                    }).done(done);
             });
             it('should be able to handle a single platform target string', function (done) {
                 var target = 'motorola razr';
                 platform(cmd, target)
-                .then(function () {
-                    expect(platform[cmd]).toHaveBeenCalledWith(jasmine.any(Object), projectRoot, [target], jasmine.any(Object));
-                }).fail(function (e) {
-                    expect(e).toBeUndefined();
-                    fail('did not expect fail handler to be invoked');
-                }).done(done);
+                    .then(function () {
+                        expect(platform[cmd]).toHaveBeenCalledWith(jasmine.any(Object), projectRoot, [target], jasmine.any(Object));
+                    }).fail(function (e) {
+                        expect(e).toBeUndefined();
+                        fail('did not expect fail handler to be invoked');
+                    }).done(done);
             });
         });
         describe('happy path (success conditions)', function () {
             it('should direct `add` commands to the `add` method/module', function (done) {
                 spyOn(platform, 'add').and.returnValue(true);
                 platform('add', ['android'])
-                .then(function () {
-                    expect(platform.add).toHaveBeenCalled();
-                }).fail(function (e) {
-                    expect(e).toBeUndefined();
-                    fail('did not expect fail handler to be invoked');
-                }).done(done);
+                    .then(function () {
+                        expect(platform.add).toHaveBeenCalled();
+                    }).fail(function (e) {
+                        expect(e).toBeUndefined();
+                        fail('did not expect fail handler to be invoked');
+                    }).done(done);
             });
             it('should direct `remove` + `rm` commands to the `remove` method/module', function (done) {
                 spyOn(platform, 'remove').and.returnValue(true);
                 platform('remove', ['android'])
-                .then(function () {
-                    expect(platform.remove).toHaveBeenCalled();
-                }).fail(function (e) {
-                    expect(e).toBeUndefined();
-                    fail('did not expect fail handler to be invoked');
-                }).then(function () {
-                    platform.remove.calls.reset(); // reset spy counter
-                    return platform('rm', ['android']);
-                }).then(function () {
-                    expect(platform.remove).toHaveBeenCalled();
-                }).fail(function (e) {
-                    expect(e).toBeUndefined();
-                    fail('did not expect fail handler to be invoked');
-                }).done(done);
+                    .then(function () {
+                        expect(platform.remove).toHaveBeenCalled();
+                    }).fail(function (e) {
+                        expect(e).toBeUndefined();
+                        fail('did not expect fail handler to be invoked');
+                    }).then(function () {
+                        platform.remove.calls.reset(); // reset spy counter
+                        return platform('rm', ['android']);
+                    }).then(function () {
+                        expect(platform.remove).toHaveBeenCalled();
+                    }).fail(function (e) {
+                        expect(e).toBeUndefined();
+                        fail('did not expect fail handler to be invoked');
+                    }).done(done);
             });
             it('should direct `update` + `up` commands to the `update` method/module', function (done) {
                 spyOn(platform, 'update').and.returnValue(true);
                 platform('update', ['android'])
-                .then(function () {
-                    expect(platform.update).toHaveBeenCalled();
-                }).fail(function (e) {
-                    expect(e).toBeUndefined();
-                    fail('did not expect fail handler to be invoked');
-                }).then(function () {
-                    platform.update.calls.reset(); // reset spy counter
-                    return platform('up', ['android']);
-                }).then(function () {
-                    expect(platform.update).toHaveBeenCalled();
-                }).fail(function (e) {
-                    expect(e).toBeUndefined();
-                    fail('did not expect fail handler to be invoked');
-                }).done(done);
+                    .then(function () {
+                        expect(platform.update).toHaveBeenCalled();
+                    }).fail(function (e) {
+                        expect(e).toBeUndefined();
+                        fail('did not expect fail handler to be invoked');
+                    }).then(function () {
+                        platform.update.calls.reset(); // reset spy counter
+                        return platform('up', ['android']);
+                    }).then(function () {
+                        expect(platform.update).toHaveBeenCalled();
+                    }).fail(function (e) {
+                        expect(e).toBeUndefined();
+                        fail('did not expect fail handler to be invoked');
+                    }).done(done);
             });
             it('should direct `check` commands to the `check` method/module', function (done) {
                 spyOn(platform, 'check').and.returnValue(true);
                 platform('check', ['android'])
-                .then(function () {
-                    expect(platform.check).toHaveBeenCalled();
-                }).fail(function (e) {
-                    expect(e).toBeUndefined();
-                    fail('did not expect fail handler to be invoked');
-                }).done(done);
+                    .then(function () {
+                        expect(platform.check).toHaveBeenCalled();
+                    }).fail(function (e) {
+                        expect(e).toBeUndefined();
+                        fail('did not expect fail handler to be invoked');
+                    }).done(done);
             });
             it('should direct `save` commands to the `save` method/module', function (done) {
                 spyOn(platform, 'save').and.returnValue(true);
                 platform('save', ['android'])
-                .then(function () {
-                    expect(platform.save).toHaveBeenCalled();
-                }).fail(function (e) {
-                    expect(e).toBeUndefined();
-                    fail('did not expect fail handler to be invoked');
-                }).done(done);
+                    .then(function () {
+                        expect(platform.save).toHaveBeenCalled();
+                    }).fail(function (e) {
+                        expect(e).toBeUndefined();
+                        fail('did not expect fail handler to be invoked');
+                    }).done(done);
             });
             it('should direct `list`, all other commands and no command at all to the `list` method/module', function (done) {
                 spyOn(platform, 'list').and.returnValue(true);
                 // test the `list` command directly
                 platform('list')
-                .then(function () {
-                    expect(platform.list).toHaveBeenCalled();
-                }).fail(function (e) {
-                    expect(e).toBeUndefined();
-                    fail('did not expect fail handler to be invoked');
-                }).then(function () {
-                    platform.list.calls.reset(); // reset spy counter
-                    // test the list catch-all
-                    return platform('please give me the list command');
-                }).then(function () {
-                    expect(platform.list).toHaveBeenCalled();
-                }).fail(function (e) {
-                    expect(e).toBeUndefined();
-                    fail('did not expect fail handler to be invoked');
-                }).then(function () {
-                    platform.list.calls.reset(); // reset spy counter
-                    // test the lack of providing an argument.
-                    return platform();
-                }).then(function () {
-                    expect(platform.list).toHaveBeenCalled();
-                }).fail(function (e) {
-                    expect(e).toBeUndefined();
-                    fail('did not expect fail handler to be invoked');
-                }).done(done);
+                    .then(function () {
+                        expect(platform.list).toHaveBeenCalled();
+                    }).fail(function (e) {
+                        expect(e).toBeUndefined();
+                        fail('did not expect fail handler to be invoked');
+                    }).then(function () {
+                        platform.list.calls.reset(); // reset spy counter
+                        // test the list catch-all
+                        return platform('please give me the list command');
+                    }).then(function () {
+                        expect(platform.list).toHaveBeenCalled();
+                    }).fail(function (e) {
+                        expect(e).toBeUndefined();
+                        fail('did not expect fail handler to be invoked');
+                    }).then(function () {
+                        platform.list.calls.reset(); // reset spy counter
+                        // test the lack of providing an argument.
+                        return platform();
+                    }).then(function () {
+                        expect(platform.list).toHaveBeenCalled();
+                    }).fail(function (e) {
+                        expect(e).toBeUndefined();
+                        fail('did not expect fail handler to be invoked');
+                    }).done(done);
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/platforms/PlatformApiPoly.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/platforms/PlatformApiPoly.spec.js b/spec/cordova/platforms/PlatformApiPoly.spec.js
index 23369b7..c15c17c 100644
--- a/spec/cordova/platforms/PlatformApiPoly.spec.js
+++ b/spec/cordova/platforms/PlatformApiPoly.spec.js
@@ -81,21 +81,21 @@ describe('PlatformApi polyfill', function () {
 
     it('should be constructable', function () {
         var api;
-        expect(function(){api = new PlatformApiPoly(PLATFORM, PLATFORM_ROOT);}).not.toThrow();
+        expect(function () { api = new PlatformApiPoly(PLATFORM, PLATFORM_ROOT); }).not.toThrow();
         expect(api).toEqual(jasmine.any(PlatformApiPoly));
     });
-
+    /* eslint-disable no-unused-vars */
     it('should fail when unknown platform is specified', function () {
         var api;
-        expect(function(){api = new PlatformApiPoly('fakePlatform', PLATFORM_ROOT);}).toThrow();
+        expect(function () { api = new PlatformApiPoly('fakePlatform', PLATFORM_ROOT); }).toThrow();
     });
 
     it('should fail when mandatory argument is not specified', function () {
         var api;
-        expect(function(){api = new PlatformApiPoly(PLATFORM);}).toThrow();
-        expect(function(){api = new PlatformApiPoly(null, PLATFORM_ROOT);}).toThrow();
+        expect(function () { api = new PlatformApiPoly(PLATFORM); }).toThrow();
+        expect(function () { api = new PlatformApiPoly(null, PLATFORM_ROOT); }).toThrow();
     });
-
+    /* eslint-enable no-unused-vars */
     it('should have fields defined', function () {
         expect(platformApi.platform).toBe(PLATFORM);
         expect(platformApi.root).toBe(PLATFORM_ROOT);
@@ -114,7 +114,12 @@ describe('PlatformApi polyfill', function () {
 
     describe('methods:', function () {
 
-        var FAKE_PROJECT, FAKE_CONFIG, OPTIONS, getPlatformApi, fail, success;
+        var FAKE_PROJECT;
+        var FAKE_CONFIG;
+        var OPTIONS;
+        var getPlatformApi; // eslint-disable-line no-unused-vars
+        var fail;
+        var success;
 
         beforeEach(function () {
             getPlatformApi = spyOn(knownPlatforms, 'getPlatformApi').and.returnValue(platformApi);
@@ -141,54 +146,54 @@ describe('PlatformApi polyfill', function () {
 
             it('should create/update platform through running platforms\' scripts', function (done) {
                 Q.all([PlatformApiPoly.createPlatform(PLATFORM_ROOT, FAKE_CONFIG, OPTIONS),
-                       PlatformApiPoly.updatePlatform(PLATFORM_ROOT, OPTIONS)])
-                .then(function () {
-                    expect(spawn).toHaveBeenCalled();
-                    expect(spawn.calls.count()).toBe(2);
-                }).fail(function (err) {
-                    expect(err).not.toBeDefined();
-                }).fin(done);
+                    PlatformApiPoly.updatePlatform(PLATFORM_ROOT, OPTIONS)])
+                    .then(function () {
+                        expect(spawn).toHaveBeenCalled();
+                        expect(spawn.calls.count()).toBe(2);
+                    }).fail(function (err) {
+                        expect(err).not.toBeDefined();
+                    }).fin(done);
             });
 
             it('should pass down arguments to platforms\' scripts', function (done) {
                 Q.all([PlatformApiPoly.createPlatform(PLATFORM_ROOT, FAKE_CONFIG, OPTIONS),
-                       PlatformApiPoly.updatePlatform(PLATFORM_ROOT, OPTIONS)])
-                .then(function () {
-                    expect(spawn).toHaveBeenCalled();
-                    expect(spawn.calls.count()).toBe(2);
-                    expect(spawn.calls.argsFor(0)[0]).toBe(path.join(PLATFORM_LIB, 'bin/create'));
-                    expect(spawn.calls.argsFor(0)[1]).toContain(PLATFORM_ROOT);
-                    expect(spawn.calls.argsFor(1)[0]).toBe(path.join(PLATFORM_LIB, 'bin/update'));
-                    expect(spawn.calls.argsFor(1)[1]).toContain(PLATFORM_ROOT);
-                }).fail(function (err) {
-                    expect(err).not.toBeDefined();
-                }).fin(done);
+                    PlatformApiPoly.updatePlatform(PLATFORM_ROOT, OPTIONS)])
+                    .then(function () {
+                        expect(spawn).toHaveBeenCalled();
+                        expect(spawn.calls.count()).toBe(2);
+                        expect(spawn.calls.argsFor(0)[0]).toBe(path.join(PLATFORM_LIB, 'bin/create'));
+                        expect(spawn.calls.argsFor(0)[1]).toContain(PLATFORM_ROOT);
+                        expect(spawn.calls.argsFor(1)[0]).toBe(path.join(PLATFORM_LIB, 'bin/update'));
+                        expect(spawn.calls.argsFor(1)[1]).toContain(PLATFORM_ROOT);
+                    }).fail(function (err) {
+                        expect(err).not.toBeDefined();
+                    }).fin(done);
             });
 
             it('should copy cordova JS sources into created platform', function (done) {
                 Q.all([PlatformApiPoly.createPlatform(PLATFORM_ROOT, FAKE_CONFIG, OPTIONS),
-                       PlatformApiPoly.updatePlatform(PLATFORM_ROOT, OPTIONS)])
-                .then(function () {
-                    expect(shell.cp).toHaveBeenCalled();
-                    expect(shell.cp.calls.count()).toBe(2);
-                }).fail(fail)
-                .fin(function () {
-                    expect(fail).not.toHaveBeenCalled();
-                    done();
-                });
+                    PlatformApiPoly.updatePlatform(PLATFORM_ROOT, OPTIONS)])
+                    .then(function () {
+                        expect(shell.cp).toHaveBeenCalled();
+                        expect(shell.cp.calls.count()).toBe(2);
+                    }).fail(fail)
+                    .fin(function () {
+                        expect(fail).not.toHaveBeenCalled();
+                        done();
+                    });
             });
 
             it('should fail immediately if options.platformInfo is not specified', function (done) {
                 Q.all([PlatformApiPoly.createPlatform(PLATFORM_ROOT, FAKE_CONFIG),
-                       PlatformApiPoly.updatePlatform(PLATFORM_ROOT, FAKE_CONFIG)])
-                .then(success)
-                .fail(fail)
-                .fin(function function_name (argument) {
-                    expect(success).not.toHaveBeenCalled();
-                    expect(fail).toHaveBeenCalled();
-                    expect(spawn).not.toHaveBeenCalled();
-                    done();
-                });
+                    PlatformApiPoly.updatePlatform(PLATFORM_ROOT, FAKE_CONFIG)])
+                    .then(success)
+                    .fail(fail)
+                    .fin(function function_name (argument) {
+                        expect(success).not.toHaveBeenCalled();
+                        expect(fail).toHaveBeenCalled();
+                        expect(spawn).not.toHaveBeenCalled();
+                        done();
+                    });
             });
         });
 
@@ -206,17 +211,17 @@ describe('PlatformApi polyfill', function () {
 
             it('should call parser\'s corresponding methods', function (done) {
                 platformApi.prepare(FAKE_PROJECT, OPTIONS)
-                .then(function () {
-                    [platformApi._parser.update_www, platformApi._parser.update_project]
-                    .forEach(function (method) {
-                        expect(method).toHaveBeenCalled();
+                    .then(function () {
+                        [platformApi._parser.update_www, platformApi._parser.update_project]
+                            .forEach(function (method) {
+                                expect(method).toHaveBeenCalled();
+                            });
+                    })
+                    .fail(fail)
+                    .fin(function () {
+                        expect(fail).not.toHaveBeenCalled();
+                        done();
                     });
-                })
-                .fail(fail)
-                .fin(function () {
-                    expect(fail).not.toHaveBeenCalled();
-                    done();
-                });
             });
         });
 
@@ -236,25 +241,25 @@ describe('PlatformApi polyfill', function () {
 
             it('should fail if plugin parameter is not specified', function (done) {
                 platformApi.addPlugin()
-                .then(success)
-                .fail(fail)
-                .fin(function () {
-                    expect(success).not.toHaveBeenCalled();
-                    expect(fail).toHaveBeenCalled();
-                    done();
-                });
+                    .then(success)
+                    .fail(fail)
+                    .fin(function () {
+                        expect(success).not.toHaveBeenCalled();
+                        expect(fail).toHaveBeenCalled();
+                        done();
+                    });
             });
 
             it('should process all plugin files through action stack', function (done) {
                 platformApi.addPlugin(plugin)
-                .then(success)
-                .fail(fail)
-                .fin(function () {
-                    expect(actionsProcess).toHaveBeenCalled();
-                    expect(success).toHaveBeenCalled();
-                    expect(fail).not.toHaveBeenCalled();
-                    done();
-                });
+                    .then(success)
+                    .fail(fail)
+                    .fin(function () {
+                        expect(actionsProcess).toHaveBeenCalled();
+                        expect(success).toHaveBeenCalled();
+                        expect(fail).not.toHaveBeenCalled();
+                        done();
+                    });
             });
         });
 
@@ -267,9 +272,9 @@ describe('PlatformApi polyfill', function () {
 
             it('should return promise', function (done) {
                 var ops = [
-                    platformApi.build(/*opts*/),
-                    platformApi.run(/*opts*/),
-                    platformApi.clean(/*opts*/),
+                    platformApi.build(/* opts */),
+                    platformApi.run(/* opts */),
+                    platformApi.clean(/* opts */),
                     platformApi.requirements()
                 ];
 
@@ -281,16 +286,16 @@ describe('PlatformApi polyfill', function () {
 
             it('should do their job through running platforms\' scripts', function (done) {
                 var ops = [
-                    platformApi.build(/*opts*/),
-                    platformApi.run(/*opts*/),
-                    platformApi.clean(/*opts*/)
+                    platformApi.build(/* opts */),
+                    platformApi.run(/* opts */),
+                    platformApi.clean(/* opts */)
                 ];
 
                 Q.all(ops)
-                .then(function () {
-                    expect(spawnSpy).toHaveBeenCalled();
-                    expect(spawnSpy.calls.count()).toEqual(3);
-                }).fin(done);
+                    .then(function () {
+                        expect(spawnSpy).toHaveBeenCalled();
+                        expect(spawnSpy.calls.count()).toEqual(3);
+                    }).fin(done);
             });
 
             it('should convert and pass down options to platforms\' scripts', function (done) {
@@ -304,12 +309,12 @@ describe('PlatformApi polyfill', function () {
                 };
                 spawnSpy.and.returnValue(Q());
                 platformApi.build(options)
-                .then(function () {
-                    ['--release', '--nobuild', '--device', '--target=' + options.target, '--archs=arm,x86', '--buildConfig='  +options.buildConfig]
-                    .forEach(function (arg) {
-                        expect(spawnSpy.calls[0].args[1]).toContain(arg);
-                    });
-                }).fin(done);
+                    .then(function () {
+                        ['--release', '--nobuild', '--device', '--target=' + options.target, '--archs=arm,x86', '--buildConfig=' + options.buildConfig]
+                            .forEach(function (arg) {
+                                expect(spawnSpy.calls[0].args[1]).toContain(arg);
+                            });
+                    }).fin(done);
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/platforms/platforms.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/platforms/platforms.spec.js b/spec/cordova/platforms/platforms.spec.js
index 1918446..b57ff2d 100644
--- a/spec/cordova/platforms/platforms.spec.js
+++ b/spec/cordova/platforms/platforms.spec.js
@@ -62,8 +62,8 @@ describe('getPlatformApi method', function () {
 
     it('should return PlatformApi polyfill if PlatformApi is not defined by platform', function () {
         spyOn(browserParser, 'dirExists').and.returnValue(true);
-        spyOn(fs, 'existsSync').and.callFake(function(somePath) {
-            if(somePath === 'PLATFORM_WOUT_API') {
+        spyOn(fs, 'existsSync').and.callFake(function (somePath) {
+            if (somePath === 'PLATFORM_WOUT_API') {
                 return true;
             }
             return false;
@@ -83,7 +83,7 @@ describe('getPlatformApi method', function () {
     it('should throw error if using deprecated platform', function () {
         try {
             platforms.getPlatformApi('android', path.join(CORDOVA_ROOT, 'platforms/android'));
-        } catch(error) {
+        } catch (error) {
             expect(error.toString()).toContain('platform does not have Api.js');
         }
     });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/plugin/search.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/plugin/search.spec.js b/spec/cordova/plugin/search.spec.js
index 32c9eeb..33e4d48 100644
--- a/spec/cordova/plugin/search.spec.js
+++ b/spec/cordova/plugin/search.spec.js
@@ -16,8 +16,6 @@
     specific language governing permissions and limitations
     under the License.
 */
-// TODO: remove once eslint lands
-/* eslint-env jasmine */
 /* globals fail */
 
 var Q = require('q');

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/prepare.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/prepare.spec.js b/spec/cordova/prepare.spec.js
index 1afe882..1467587 100644
--- a/spec/cordova/prepare.spec.js
+++ b/spec/cordova/prepare.spec.js
@@ -67,14 +67,14 @@ describe('cordova/prepare', function () {
             spyOn(util, 'cdProjectRoot').and.returnValue(project_dir);
             spyOn(util, 'preProcessOptions').and.callFake(function (options) {
                 var platforms = options.platforms || [];
-                return {'platforms':platforms};
+                return {'platforms': platforms};
             });
             spyOn(prepare, 'preparePlatforms').and.returnValue(Q);
         });
         describe('failure', function () {
             it('should invoke util.preProcessOptions as preflight task checker, which, if fails, should trigger promise rejection and only fire the before_prepare hook', function (done) {
                 util.preProcessOptions.and.callFake(function () {
-                    throw new Error('preProcessOption error'); 
+                    throw new Error('preProcessOption error');
                 });
                 prepare({}).then(function () {
                     fail('unexpected failure handler invoked');
@@ -87,7 +87,7 @@ describe('cordova/prepare', function () {
                 util.cdProjectRoot.and.callFake(function () {
                     throw new Error('cdProjectRoot error');
                 });
-                prepare({}).then(function () { 
+                prepare({}).then(function () {
                     fail('unexpected failure handler invoked');
                 }).fail(function (e) {
                     expect(e.message).toBe('cdProjectRoot error');
@@ -114,11 +114,11 @@ describe('cordova/prepare', function () {
                 }).done(done);
             });
             it('should retrieve PlatformApi instances for each platform provided', function (done) {
-                prepare({'platforms':['android', 'ios']}).then(function () {
+                prepare({'platforms': ['android', 'ios']}).then(function () {
                     expect(platforms.getPlatformApi).toHaveBeenCalledTimes(4);
-                    //expect(platforms.getPlatformApi).toHaveBeenCalledWith(['android', path.join('some','path','platforms','android')], ['ios', path.join('some','path','platforms','ios')], ['android'], ['ios']);
-                    expect(platforms.getPlatformApi).toHaveBeenCalledWith('android', path.join('/','some','path','platforms','android'));
-                    expect(platforms.getPlatformApi).toHaveBeenCalledWith('ios', path.join('/','some','path','platforms','ios'));
+                    // expect(platforms.getPlatformApi).toHaveBeenCalledWith(['android', path.join('some','path','platforms','android')], ['ios', path.join('some','path','platforms','ios')], ['android'], ['ios']);
+                    expect(platforms.getPlatformApi).toHaveBeenCalledWith('android', path.join('/', 'some', 'path', 'platforms', 'android'));
+                    expect(platforms.getPlatformApi).toHaveBeenCalledWith('ios', path.join('/', 'some', 'path', 'platforms', 'ios'));
                     expect(platforms.getPlatformApi).toHaveBeenCalledWith('android');
                     expect(platforms.getPlatformApi).toHaveBeenCalledWith('ios');
                 }).fail(function (e) {
@@ -127,7 +127,7 @@ describe('cordova/prepare', function () {
                 }).done(done);
             });
             it('should invoke restore module\'s installPluginsFromConfigXML method', function (done) {
-                prepare({platforms:[]}).then(function () {
+                prepare({platforms: []}).then(function () {
                     expect(restore.installPluginsFromConfigXML).toHaveBeenCalled();
                 }).fail(function (e) {
                     fail('unexpected failure handler invoked');
@@ -135,8 +135,8 @@ describe('cordova/prepare', function () {
                 }).done(done);
             });
             it('should invoke preparePlatforms method, providing the appropriate platforms', function (done) {
-                prepare({platforms:['android']}).then(function () {
-                    expect(prepare.preparePlatforms).toHaveBeenCalledWith(['android'],'/some/path', jasmine.any(Object));
+                prepare({platforms: ['android']}).then(function () {
+                    expect(prepare.preparePlatforms).toHaveBeenCalledWith(['android'], '/some/path', jasmine.any(Object));
                 }).fail(function (e) {
                     fail('unexpected failure handler invoked');
                     console.error(e);
@@ -144,7 +144,7 @@ describe('cordova/prepare', function () {
 
             });
             it('should fire the after_prepare hook and provide platform and path information as arguments', function (done) {
-                prepare({platforms:['android']}).then(function () {
+                prepare({platforms: ['android']}).then(function () {
                     expect(HooksRunner.prototype.fire).toHaveBeenCalledWith('after_prepare', jasmine.any(Object));
                 }).fail(function (e) {
                     fail('unexpected failure handler invoked');
@@ -171,48 +171,48 @@ describe('cordova/prepare', function () {
             platform_munger_revert_mock = prepare.__set__('PlatformMunger', platform_munger_mock);
             spyOn(util, 'projectConfig').and.returnValue(project_dir);
             spyOn(util, 'projectWww').and.returnValue(path.join(project_dir, 'www'));
-            
+
         });
         afterEach(function () {
             cfg_parser_revert_mock();
             platform_munger_revert_mock();
         });
         it('should call restoreMissingPluginsForPlatform', function (done) {
-            prepare.preparePlatforms(['android'],project_dir, {}).then(function () {
+            prepare.preparePlatforms(['android'], project_dir, {}).then(function () {
                 expect(prepare.restoreMissingPluginsForPlatform).toHaveBeenCalled();
             }).fail(function (e) {
                 fail('unexpected failure handler invoked');
                 console.error(e);
-            }).done(done);        
+            }).done(done);
         });
         it('should retrieve the platform API via getPlatformApi per platform provided, and invoke the prepare method from that API', function (done) {
-            prepare.preparePlatforms(['android'],project_dir, {}).then(function () {
+            prepare.preparePlatforms(['android'], project_dir, {}).then(function () {
                 expect(platforms.getPlatformApi).toHaveBeenCalledWith('android');
                 expect(platform_api_prepare_mock).toHaveBeenCalled();
             }).fail(function (e) {
                 fail('unexpected failure handler invoked');
                 console.error(e);
-            }).done(done); 
+            }).done(done);
         });
         it('should fire a pre_package hook for the windows', function (done) {
-            prepare.preparePlatforms(['windows'],project_dir, {}).then(function () {
+            prepare.preparePlatforms(['windows'], project_dir, {}).then(function () {
                 expect(HooksRunner.prototype.fire).toHaveBeenCalledWith('pre_package', jasmine.any(Object));
             }).fail(function (e) {
                 fail('unexpected failure handler invoked');
                 console.error(e);
-            }).done(done); 
+            }).done(done);
         });
         // TODO: xit'ed the one below as dynamic requires make it difficult to spy on
         // Can we refactor the relevant code to make it testable?
         xit('should invoke browserify if the browserify option is provided');
         it('should handle config changes by invoking add_config_changes and save_all', function (done) {
-            prepare.preparePlatforms(['android'],project_dir, {}).then(function () {
+            prepare.preparePlatforms(['android'], project_dir, {}).then(function () {
                 expect(platform_munger_mock.prototype.add_config_changes).toHaveBeenCalled();
                 expect(platform_munger_save_mock).toHaveBeenCalled();
             }).fail(function (e) {
                 fail('unexpected failure handler invoked');
                 console.error(e);
-            }).done(done); 
+            }).done(done);
         });
     });
 
@@ -237,14 +237,14 @@ describe('cordova/prepare', function () {
             }).fail(function (e) {
                 fail('unexpected failure handler invoked');
                 console.error(e);
-            }).done(done); 
+            }).done(done);
         });
         it('should leverage platform API to remove and add any missing plugins identified', function (done) {
             is_plugin_installed_mock = jasmine.createSpy('is plugin installed mock');
             is_plugin_provider_get_mock = jasmine.createSpy('is plugin provider get mock');
             // mock platform json value below
             PlatformJson.load.and.callFake(function (platformJsonPath, plat) {
-                //set different installed plugins to simulate missing plugins
+                // set different installed plugins to simulate missing plugins
                 var missingPlugins;
                 if (platformJsonPath === '/some/path/platforms/android') {
                     missingPlugins = {'cordova-plugin-device': {}};
@@ -270,7 +270,7 @@ describe('cordova/prepare', function () {
             }).fail(function (e) {
                 fail('unexpected failure handler invoked');
                 console.error(e);
-            }).done(done); 
+            }).done(done);
         });
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/project-metadata-apis.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/project-metadata-apis.spec.js b/spec/cordova/project-metadata-apis.spec.js
index 80314b1..45b7d75 100644
--- a/spec/cordova/project-metadata-apis.spec.js
+++ b/spec/cordova/project-metadata-apis.spec.js
@@ -17,8 +17,8 @@
  under the License.
  */
 
-var cordova = require('../../src/cordova/cordova'),
-    path = require('path');
+var cordova = require('../../src/cordova/cordova');
+var path = require('path');
 
 describe('retrieval of project metadata', function () {
     var projectRoot = path.resolve(__dirname, 'Projects/ProjectMetadata');
@@ -98,7 +98,7 @@ describe('retrieval of project metadata', function () {
     });
 });
 
-function findPlatform(platforms, platformName) {
+function findPlatform (platforms, platformName) {
     for (var i = 0; i < platforms.length; i++) {
         if (platforms[i].name === platformName) {
             return platforms[i];
@@ -107,7 +107,7 @@ function findPlatform(platforms, platformName) {
     return null;
 }
 
-function findPlugin(plugins, pluginId) {
+function findPlugin (plugins, pluginId) {
     for (var i = 0; i < plugins.length; i++) {
         if (plugins[i].name === pluginId) {
             return plugins[i];

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/run.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/run.spec.js b/spec/cordova/run.spec.js
index 01c3536..a19540e 100644
--- a/spec/cordova/run.spec.js
+++ b/spec/cordova/run.spec.js
@@ -16,20 +16,20 @@
     specific language governing permissions and limitations
     under the License.
 */
-var cordova = require('../../src/cordova/cordova'),
-    platforms = require('../../src/platforms/platforms'),
-    HooksRunner = require('../../src/hooks/HooksRunner'),
-    Q = require('q'),
-    util = require('../../src/cordova/util');
+var cordova = require('../../src/cordova/cordova');
+var platforms = require('../../src/platforms/platforms');
+var HooksRunner = require('../../src/hooks/HooksRunner');
+var Q = require('q');
+var util = require('../../src/cordova/util');
 
-var supported_platforms = Object.keys(platforms).filter(function(p) { return p != 'www'; });
+var supported_platforms = Object.keys(platforms).filter(function (p) { return p !== 'www'; });
 
-describe('run command', function() {
+describe('run command', function () {
     var is_cordova, cd_project_root, list_platforms, fire, platformApi, getPlatformApi;
     var project_dir = '/some/path';
     var prepare_spy;
 
-    beforeEach(function() {
+    beforeEach(function () {
         is_cordova = spyOn(util, 'isCordova').and.returnValue(project_dir);
         cd_project_root = spyOn(util, 'cdProjectRoot').and.returnValue(project_dir);
         list_platforms = spyOn(util, 'listPlatforms').and.returnValue(supported_platforms);
@@ -41,145 +41,146 @@ describe('run command', function() {
         };
         getPlatformApi = spyOn(platforms, 'getPlatformApi').and.returnValue(platformApi);
     });
-    describe('failure', function() {
-        it('Test 001 : should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function(done) {
+    describe('failure', function () {
+        it('Test 001 : should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function (done) {
             list_platforms.and.returnValue([]);
-            Q().then(cordova.run).then(function() {
+            Q().then(cordova.run).then(function () {
                 expect('this call').toBe('fail');
-            }, function(err) {
+            }, function (err) {
                 expect(err.message).toEqual('No platforms added to this project. Please use `cordova platform add <platform>`.');
             }).fin(done);
         });
-        it('Test 002 : should not run outside of a Cordova-based project', function(done) {
+        it('Test 002 : should not run outside of a Cordova-based project', function (done) {
             var msg = 'Dummy message about not being in a cordova dir.';
             cd_project_root.and.throwError(new Error(msg));
             is_cordova.and.returnValue(false);
-            Q().then(cordova.run).then(function() {
+            Q().then(cordova.run).then(function () {
                 expect('this call').toBe('fail');
-            }, function(err) {
+            }, function (err) {
                 expect(err.message).toEqual(msg);
             }).fin(done);
         });
     });
 
-    describe('success', function() {
-        it('Test 003 : should call prepare before actually run platform ', function(done) {
-            cordova.run(['android','ios']).then(function() {
+    describe('success', function () {
+        it('Test 003 : should call prepare before actually run platform ', function (done) {
+            cordova.run(['android', 'ios']).then(function () {
                 expect(prepare_spy.calls.argsFor(0)).toEqual([ { platforms: [ 'android', 'ios' ], verbose: false, options: {} } ]);
-            }, function(err) {
+            }, function (err) {
                 expect(err).toBeUndefined();
             }).fin(done);
         });
-        it('Test 004 : should get PlatformApi instance for each platform and call its\' run method', function(done) {
-            cordova.run(['android','ios']).then(function() {
+        it('Test 004 : should get PlatformApi instance for each platform and call its\' run method', function (done) {
+            cordova.run(['android', 'ios']).then(function () {
                 expect(getPlatformApi).toHaveBeenCalledWith('android');
                 expect(getPlatformApi).toHaveBeenCalledWith('ios');
                 expect(platformApi.build).toHaveBeenCalled();
                 expect(platformApi.run).toHaveBeenCalled();
-            }, function(err) {
+            }, function (err) {
                 expect(err).toBeUndefined();
             }).fin(done);
         });
-        it('Test 005 : should pass down parameters', function(done) {
-            cordova.run({platforms: ['blackberry10'], options:{password: '1q1q'}}).then(function() {
+        it('Test 005 : should pass down parameters', function (done) {
+            cordova.run({platforms: ['blackberry10'], options: {password: '1q1q'}}).then(function () {
                 expect(prepare_spy).toHaveBeenCalledWith({ platforms: [ 'blackberry10' ], options: { password: '1q1q' }, verbose: false });
                 expect(platformApi.build).toHaveBeenCalledWith({password: '1q1q'});
                 expect(platformApi.run).toHaveBeenCalledWith({password: '1q1q', nobuild: true});
-            }, function(err) {
+            }, function (err) {
                 expect(err).toBeUndefined();
             }).fin(done);
         });
         it('Test 006 : should convert parameters from old format and warn user about this', function (done) {
-            function warnSpy(message) {
+            function warnSpy (message) {
                 expect(message).toMatch('The format of cordova.* methods "options" argument was changed');
             }
 
             cordova.on('warn', warnSpy);
-            cordova.run({platforms: ['blackberry10'], options:['--password=1q1q']}).then(function() {
+            cordova.run({platforms: ['blackberry10'], options: ['--password=1q1q']}).then(function () {
                 expect(prepare_spy).toHaveBeenCalledWith({ platforms: [ 'blackberry10' ],
-                    options: jasmine.objectContaining({argv:['--password=1q1q']}), verbose: false });
-                expect(platformApi.run).toHaveBeenCalledWith(jasmine.objectContaining({argv:['--password=1q1q']}));
-            }, function(err) {
+                    options: jasmine.objectContaining({argv: ['--password=1q1q']}),
+                    verbose: false });
+                expect(platformApi.run).toHaveBeenCalledWith(jasmine.objectContaining({argv: ['--password=1q1q']}));
+            }, function (err) {
                 expect(err).toBeUndefined();
             })
-            .fin(function () {
-                cordova.off('warn', warnSpy);
-                done();
-            });
+                .fin(function () {
+                    cordova.off('warn', warnSpy);
+                    done();
+                });
         });
 
         it('Test 007 : should call platform\'s build method', function (done) {
             cordova.run({platforms: ['blackberry10']})
-            .then(function() {
-                expect(prepare_spy).toHaveBeenCalled();
-                expect(platformApi.build).toHaveBeenCalledWith({});
-                expect(platformApi.run).toHaveBeenCalledWith(jasmine.objectContaining({nobuild: true}));
-            }, function(err) {
-                expect(err).toBeUndefined();
-            })
-            .fin(done);
+                .then(function () {
+                    expect(prepare_spy).toHaveBeenCalled();
+                    expect(platformApi.build).toHaveBeenCalledWith({});
+                    expect(platformApi.run).toHaveBeenCalledWith(jasmine.objectContaining({nobuild: true}));
+                }, function (err) {
+                    expect(err).toBeUndefined();
+                })
+                .fin(done);
         });
 
         it('Test 008 : should not call build if --nobuild option is passed', function (done) {
             cordova.run({platforms: ['blackberry10'], options: { nobuild: true }})
-            .then(function() {
-                expect(prepare_spy).toHaveBeenCalled();
-                expect(platformApi.build).not.toHaveBeenCalled();
-                expect(platformApi.run).toHaveBeenCalledWith(jasmine.objectContaining({nobuild: true}));
-            }, function(err) {
-                expect(err).toBeUndefined();
-            })
-            .fin(done);
+                .then(function () {
+                    expect(prepare_spy).toHaveBeenCalled();
+                    expect(platformApi.build).not.toHaveBeenCalled();
+                    expect(platformApi.run).toHaveBeenCalledWith(jasmine.objectContaining({nobuild: true}));
+                }, function (err) {
+                    expect(err).toBeUndefined();
+                })
+                .fin(done);
         });
 
-        describe('run parameters should not be altered by intermediate build command', function() {
+        describe('run parameters should not be altered by intermediate build command', function () {
             var originalBuildSpy;
-            beforeEach(function() {
+            beforeEach(function () {
                 originalBuildSpy = platformApi.build;
-                platformApi.build = jasmine.createSpy('build').and.callFake(function(opts) {
+                platformApi.build = jasmine.createSpy('build').and.callFake(function (opts) {
                     opts.couldBeModified = 'insideBuild';
                     return Q();
                 });
             });
-            afterEach(function() {
+            afterEach(function () {
                 platformApi.build = originalBuildSpy;
             });
-            it('Test 009 : should leave parameters unchanged', function(done) {
-                cordova.run({platforms: ['blackberry10'], options:{password: '1q1q'}}).then(function() {
+            it('Test 009 : should leave parameters unchanged', function (done) {
+                cordova.run({platforms: ['blackberry10'], options: {password: '1q1q'}}).then(function () {
                     expect(prepare_spy).toHaveBeenCalledWith({ platforms: [ 'blackberry10' ], options: { password: '1q1q', 'couldBeModified': 'insideBuild' }, verbose: false });
                     expect(platformApi.build).toHaveBeenCalledWith({password: '1q1q', 'couldBeModified': 'insideBuild'});
                     expect(platformApi.run).toHaveBeenCalledWith({password: '1q1q', nobuild: true});
-                }, function(err) {
+                }, function (err) {
                     expect(err).toBeUndefined();
                 }).fin(done);
             });
         });
     });
 
-    describe('hooks', function() {
-        describe('when platforms are added', function() {
-            it('Test 010 : should fire before hooks through the hooker module', function(done) {
-                cordova.run(['android', 'ios']).then(function() {
+    describe('hooks', function () {
+        describe('when platforms are added', function () {
+            it('Test 010 : should fire before hooks through the hooker module', function (done) {
+                cordova.run(['android', 'ios']).then(function () {
                     expect(fire.calls.argsFor(0)).toEqual([ 'before_run', { platforms: [ 'android', 'ios' ], verbose: false, options: {} } ]);
-                }, function(err) {
+                }, function (err) {
                     expect(err).toBeUndefined();
                 }).fin(done);
             });
-            it('Test 011 : should fire after hooks through the hooker module', function(done) {
-                cordova.run('android').then(function() {
+            it('Test 011 : should fire after hooks through the hooker module', function (done) {
+                cordova.run('android').then(function () {
                     expect(fire.calls.argsFor(2)).toEqual([ 'after_run', { platforms: [ 'android' ], verbose: false, options: {} } ]);
-                }, function(err) {
+                }, function (err) {
                     expect(err).toBeUndefined();
                 }).fin(done);
             });
         });
 
-        describe('with no platforms added', function() {
-            it('Test 012 : should not fire the hooker', function(done) {
+        describe('with no platforms added', function () {
+            it('Test 012 : should not fire the hooker', function (done) {
                 list_platforms.and.returnValue([]);
-                Q().then(cordova.run).then(function() {
+                Q().then(cordova.run).then(function () {
                     expect('this call').toBe('fail');
-                }, function(err) {
+                }, function (err) {
                     expect(fire).not.toHaveBeenCalled();
                     expect(err.message).toEqual('No platforms added to this project. Please use `cordova platform add <platform>`.');
                 }).fin(done);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/serve.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/serve.spec.js b/spec/cordova/serve.spec.js
index 45165b0..45d6dd6 100644
--- a/spec/cordova/serve.spec.js
+++ b/spec/cordova/serve.spec.js
@@ -17,81 +17,81 @@
     under the License.
 */
 
-/* jshint expr: true */
 /* global xdescribe */
 
-var cordova = require('../../src/cordova/cordova'),
-    console = require('console'),
-    path = require('path'),
-    shell = require('shelljs'),
-    fs = require('fs'),
-    Q = require('q'),
-    tempDir,
-    http = require('http');
+var cordova = require('../../src/cordova/cordova');
+var console = require('console');
+var path = require('path');
+var shell = require('shelljs');
+var fs = require('fs');
+var Q = require('q');
+var tempDir;
+var http = require('http');
 
 var cwd = process.cwd();
 
-//skipped because of CB-7078
-xdescribe('serve command', function() {
-    var payloads = {},
-        consoleSpy;
-    beforeEach(function() {
+// skipped because of CB-7078
+xdescribe('serve command', function () {
+    var payloads = {};
+    var consoleSpy; // eslint-disable-line  no-unused-vars
+    beforeEach(function () {
         // Make a temp directory
         tempDir = path.join(__dirname, '..', 'temp-' + Date.now());
         shell.rm('-rf', tempDir);
         shell.mkdir('-p', tempDir);
         consoleSpy = spyOn(console, 'log');
     });
-    afterEach(function() {
+    afterEach(function () {
         process.chdir(cwd);
         process.env.PWD = cwd;
         shell.rm('-rf', tempDir);
     });
-    it('Test 001 : should not run outside of a Cordova-based project', function() {
+    it('Test 001 : should not run outside of a Cordova-based project', function () {
         process.chdir(tempDir);
 
-        expect(function() {
-            cordova.serve().then(function(server) {
+        expect(function () {
+            cordova.serve().then(function (server) {
                 expect(server).toBe(null);
                 server.close();
             });
         }).toThrow('Current working directory is not a Cordova-based project.');
     });
 
-    describe('`serve`', function() {
-        var done = false, failed = false;
-        beforeEach(function() {
+    describe('`serve`', function () {
+        var done = false; // eslint-disable-line  no-unused-vars
+        var failed = false;
+        beforeEach(function () {
             done = false;
             failed = false;
         });
 
-        afterEach(function() {
+        afterEach(function () {
             payloads = {};
         });
 
-        function cit(cond) {
+        function cit (cond) {
             if (cond) {
                 return it;
             }
             return xit;
         }
-        function itifapps(apps) {
-            return cit(apps.every(function (bin) {return shell.which(bin);}));
+        function itifapps (apps) {
+            return cit(apps.every(function (bin) { return shell.which(bin); }));
         }
 
-        function test_serve(platform, ref, expectedContents, opts) {
-            var timeout = opts && 'timeout' in opts && opts.timeout || 1000;
-            return function() {
+        function test_serve (platform, ref, expectedContents, opts) {
+            var timeout = (opts && 'timeout' in opts && opts.timeout) || (1000);
+            return function () {
                 var server;
-                runs(function() {
+                runs(function () {
                     cordova.create(tempDir).then(function () {
                         process.chdir(tempDir);
                         process.env.PWD = tempDir;
                         var plats = [];
-                        Object.getOwnPropertyNames(payloads).forEach(function(plat) {
+                        Object.getOwnPropertyNames(payloads).forEach(function (plat) {
                             var d = Q.defer();
                             plats.push(d.promise);
-                            cordova.platform('add', plat, {spawnoutput:'ignore'}).then(function () {
+                            cordova.platform('add', plat, {spawnoutput: 'ignore'}).then(function () {
                                 var dir = path.join(tempDir, 'merges', plat);
                                 shell.mkdir('-p', dir);
                                 // Write testing HTML files into the directory.
@@ -117,12 +117,12 @@ xdescribe('serve command', function() {
                     });
                 });
 
-                waitsFor(function() {
+                waitsFor(function () {
                     return server || failed;
                 }, 'the server should start', timeout);
 
                 var done, errorCB;
-                runs(function() {
+                runs(function () {
                     if (failed) {
                         return;
                     }
@@ -133,12 +133,12 @@ xdescribe('serve command', function() {
                         port: opts && 'port' in opts ? opts.port : 8000,
                         path: '/' + platform + '/www' + ref,
                         connection: 'Close'
-                    }).on('response', function(res) {
+                    }).on('response', function (res) {
                         var response = '';
-                        res.on('data', function(data) {
+                        res.on('data', function (data) {
                             response += data;
                         });
-                        res.on('end', function() {
+                        res.on('end', function () {
                             expect(response).toEqual(expectedContents);
                             if (response === expectedContents) {
                                 expect(res.statusCode).toEqual(200);
@@ -148,11 +148,11 @@ xdescribe('serve command', function() {
                     }).on('error', errorCB);
                 });
 
-                waitsFor(function() {
+                waitsFor(function () {
                     return done || failed;
                 }, 'the HTTP request should complete', timeout);
 
-                runs(function() {
+                runs(function () {
                     if (!failed) {
                         expect(done).toBeTruthy();
                         expect(errorCB).not.toHaveBeenCalled();
@@ -165,8 +165,8 @@ xdescribe('serve command', function() {
 
         itifapps([
             'android',
-            'ant',
-        ])('should fall back to assets/www on Android', function() {
+            'ant'
+        ])('should fall back to assets/www on Android', function () {
             payloads.android = 'This is the Android test file.';
             test_serve('android', '/test.html', payloads.android, {timeout: 20000})();
         });
@@ -175,18 +175,17 @@ xdescribe('serve command', function() {
             'blackberry-nativepackager',
             'blackberry-deploy',
             'blackberry-signer',
-            'blackberry-debugtokenrequest',
-        ])('should fall back to www on BlackBerry10', function() {
+            'blackberry-debugtokenrequest'
+        ])('should fall back to www on BlackBerry10', function () {
             payloads.blackberry10 = 'This is the BlackBerry10 test file.';
             test_serve('blackberry10', '/test.html', payloads.blackberry10, {timeout: 10000})();
         });
 
         itifapps([
-            'xcodebuild',
-        ])('should fall back to www on iOS', function() {
+            'xcodebuild'
+        ])('should fall back to www on iOS', function () {
             payloads.ios = 'This is the iOS test file.';
             test_serve('ios', '/test.html', payloads.ios, {timeout: 10000})();
         });
     });
 });
-

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/util.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/util.spec.js b/spec/cordova/util.spec.js
index a66f04a..6c63421 100644
--- a/spec/cordova/util.spec.js
+++ b/spec/cordova/util.spec.js
@@ -17,50 +17,48 @@
     under the License.
 */
 
-/* jshint sub: true */
-
-var shell = require('shelljs'),
-    path = require('path'),
-    fs = require('fs'),
-    util = require('../../src/cordova/util'),
-    events = require('../../cordova-lib').events,
-    helpers = require('../helpers'),
-    temp = path.join(__dirname, '..', 'temp');
+var shell = require('shelljs');
+var path = require('path');
+var fs = require('fs');
+var util = require('../../src/cordova/util');
+var events = require('../../cordova-lib').events;
+var helpers = require('../helpers');
+var temp = path.join(__dirname, '..', 'temp');
 
 var cwd = process.cwd();
-var home = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];
+var home = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];
 var origPWD = process.env['PWD'];
 
-describe('util module', function() {
-    describe('isCordova method', function() {
-        afterEach(function() {
+describe('util module', function () {
+    describe('isCordova method', function () {
+        afterEach(function () {
             process.env['PWD'] = origPWD;
             process.chdir(cwd);
         });
-        function removeDir(directory) {
+        function removeDir (directory) {
             shell.rm('-rf', directory);
         }
-        it('Test 001 : should return false if it hits the home directory', function() {
+        it('Test 001 : should return false if it hits the home directory', function () {
             var somedir = path.join(home, 'somedir');
             removeDir(somedir);
             shell.mkdir(somedir);
             expect(util.isCordova(somedir)).toEqual(false);
         });
-        it('Test 002 : should return false if it cannot find a .cordova directory up the directory tree', function() {
+        it('Test 002 : should return false if it cannot find a .cordova directory up the directory tree', function () {
             var somedir = path.join(home, '..');
             expect(util.isCordova(somedir)).toEqual(false);
         });
-        it('Test 003 : should return the first directory it finds with a .cordova folder in it', function() {
-            var somedir = path.join(home,'somedir');
+        it('Test 003 : should return the first directory it finds with a .cordova folder in it', function () {
+            var somedir = path.join(home, 'somedir');
             var anotherdir = path.join(somedir, 'anotherdir');
             removeDir(somedir);
             shell.mkdir('-p', anotherdir);
             shell.mkdir('-p', path.join(somedir, 'www', 'config.xml'));
             expect(util.isCordova(somedir)).toEqual(somedir);
         });
-        it('Test 004 : should ignore PWD when its undefined', function() {
+        it('Test 004 : should ignore PWD when its undefined', function () {
             delete process.env['PWD'];
-            var somedir = path.join(home,'somedir');
+            var somedir = path.join(home, 'somedir');
             var anotherdir = path.join(somedir, 'anotherdir');
             removeDir(somedir);
             shell.mkdir('-p', anotherdir);
@@ -69,8 +67,8 @@ describe('util module', function() {
             process.chdir(anotherdir);
             expect(util.isCordova()).toEqual(somedir);
         });
-        it('Test 005 : should use PWD when available', function() {
-            var somedir = path.join(home,'somedir');
+        it('Test 005 : should use PWD when available', function () {
+            var somedir = path.join(home, 'somedir');
             var anotherdir = path.join(somedir, 'anotherdir');
             removeDir(somedir);
             shell.mkdir('-p', anotherdir);
@@ -79,8 +77,8 @@ describe('util module', function() {
             process.chdir(path.sep);
             expect(util.isCordova()).toEqual(somedir);
         });
-        it('Test 006 : should use cwd as a fallback when PWD is not a cordova dir', function() {
-            var somedir = path.join(home,'somedir');
+        it('Test 006 : should use cwd as a fallback when PWD is not a cordova dir', function () {
+            var somedir = path.join(home, 'somedir');
             var anotherdir = path.join(somedir, 'anotherdir');
             removeDir(somedir);
             shell.mkdir('-p', anotherdir);
@@ -89,8 +87,8 @@ describe('util module', function() {
             process.chdir(anotherdir);
             expect(util.isCordova()).toEqual(somedir);
         });
-        it('Test 007 : should ignore platform www/config.xml', function() {
-            var somedir = path.join(home,'somedir');
+        it('Test 007 : should ignore platform www/config.xml', function () {
+            var somedir = path.join(home, 'somedir');
             var anotherdir = path.join(somedir, 'anotherdir');
             removeDir(somedir);
             shell.mkdir('-p', anotherdir);
@@ -100,11 +98,11 @@ describe('util module', function() {
             expect(util.isCordova(anotherdir)).toEqual(somedir);
         });
     });
-    describe('deleteSvnFolders method', function() {
-        afterEach(function() {
+    describe('deleteSvnFolders method', function () {
+        afterEach(function () {
             shell.rm('-rf', temp);
         });
-        it('Test 008 : should delete .svn folders in any subdirectory of specified dir', function() {
+        it('Test 008 : should delete .svn folders in any subdirectory of specified dir', function () {
             var one = path.join(temp, 'one');
             var two = path.join(temp, 'two');
             var one_svn = path.join(one, '.svn');
@@ -116,11 +114,11 @@ describe('util module', function() {
             expect(fs.existsSync(two_svn)).toEqual(false);
         });
     });
-    describe('listPlatforms method', function() {
-        afterEach(function() {
+    describe('listPlatforms method', function () {
+        afterEach(function () {
             shell.rm('-rf', temp);
         });
-        it('Test 009 : should only return supported platform directories present in a cordova project dir', function() {
+        it('Test 009 : should only return supported platform directories present in a cordova project dir', function () {
             var platforms = path.join(temp, 'platforms');
 
             shell.mkdir('-p', path.join(platforms, 'android'));
@@ -129,17 +127,17 @@ describe('util module', function() {
             shell.mkdir('-p', path.join(platforms, 'atari'));
 
             // create a typical platforms.json file, it should not be returned as a platform
-            shell.exec('touch ' + path.join(platforms,'platforms.json'));
+            shell.exec('touch ' + path.join(platforms, 'platforms.json'));
 
             var res = util.listPlatforms(temp);
             expect(res.length).toEqual(4);
         });
     });
-    describe('getInstalledPlatformsWithVersions method', function() {
-        afterEach(function() {
+    describe('getInstalledPlatformsWithVersions method', function () {
+        afterEach(function () {
             shell.rm('-rf', temp);
         });
-        it('Test 010 : should get the supported platforms in the cordova project dir along with their reported versions', function(done) {
+        it('Test 010 : should get the supported platforms in the cordova project dir along with their reported versions', function (done) {
             var platforms = path.join(temp, 'platforms');
             var android = path.join(platforms, 'android');
 
@@ -148,16 +146,16 @@ describe('util module', function() {
             shell.cp('-R',
                 path.join(__dirname, 'fixtures', 'platforms', helpers.testPlatform), platforms);
             util.getInstalledPlatformsWithVersions(temp)
-            .then(function(platformMap) {
-                expect(platformMap['android']).toBe('3.1.0');
-            }).fin(done);
+                .then(function (platformMap) {
+                    expect(platformMap['android']).toBe('3.1.0');
+                }).fin(done);
         });
     });
-    describe('findPlugins method', function() {
-        afterEach(function() {
+    describe('findPlugins method', function () {
+        afterEach(function () {
             shell.rm('-rf', temp);
         });
-        it('Test 011 : should only return plugin directories present in a cordova project dir', function() {
+        it('Test 011 : should only return plugin directories present in a cordova project dir', function () {
             var plugins = path.join(temp, 'plugins');
             var android = path.join(plugins, 'android');
             var ios = path.join(plugins, 'ios');
@@ -170,7 +168,7 @@ describe('util module', function() {
             var res = util.findPlugins(plugins);
             expect(res.length).toEqual(4);
         });
-        it('Test 012 : should not return ".svn" directories', function() {
+        it('Test 012 : should not return ".svn" directories', function () {
             var plugins = path.join(temp, 'plugins');
             var android = path.join(plugins, 'android');
             var ios = path.join(plugins, 'ios');
@@ -182,7 +180,7 @@ describe('util module', function() {
             expect(res.length).toEqual(2);
             expect(res.indexOf('.svn')).toEqual(-1);
         });
-        it('Test 013 : should not return "CVS" directories', function() {
+        it('Test 013 : should not return "CVS" directories', function () {
             var plugins = path.join(temp, 'plugins');
             var android = path.join(plugins, 'android');
             var ios = path.join(plugins, 'ios');
@@ -196,7 +194,7 @@ describe('util module', function() {
         });
     });
 
-    describe('preprocessOptions method', function() {
+    describe('preprocessOptions method', function () {
 
         var isCordova, listPlatforms;
         var DEFAULT_OPTIONS = {
@@ -206,59 +204,59 @@ describe('util module', function() {
             verbose: false
         };
 
-        beforeEach(function() {
+        beforeEach(function () {
             isCordova = spyOn(util, 'isCordova').and.returnValue('/fake/path');
             listPlatforms = spyOn(util, 'listPlatforms').and.returnValue(['android']);
         });
 
-        it('Test 014 : should throw if called outside of cordova project', function() {
+        it('Test 014 : should throw if called outside of cordova project', function () {
             isCordova.and.returnValue(false);
-            expect(function() { util.preProcessOptions(); }).toThrow();
+            expect(function () { util.preProcessOptions(); }).toThrow();
         });
 
-        it('Test 015 : should throw when no platforms added to project', function() {
+        it('Test 015 : should throw when no platforms added to project', function () {
             listPlatforms.and.returnValue([]);
             expect(function () { util.preProcessOptions(); }).toThrow();
         });
 
-        it('Test 016 : should return default options when no arguments passed', function() {
+        it('Test 016 : should return default options when no arguments passed', function () {
             expect(util.preProcessOptions()).toEqual(jasmine.objectContaining(DEFAULT_OPTIONS));
         });
 
-        it('Test 017 : should accept single string argument as platform name', function() {
+        it('Test 017 : should accept single string argument as platform name', function () {
             expect(util.preProcessOptions('ios')).toEqual(jasmine.objectContaining({platforms: ['ios']}));
         });
 
-        it('Test 018 : should accept array of strings as platform names', function() {
+        it('Test 018 : should accept array of strings as platform names', function () {
             expect(util.preProcessOptions(['ios', 'windows'])).toEqual(jasmine.objectContaining({platforms: ['ios', 'windows']}));
         });
 
-        it('Test 019 : should fall back to installed platform if input doesn\'t contain platforms list', function() {
+        it('Test 019 : should fall back to installed platform if input doesn\'t contain platforms list', function () {
             expect(util.preProcessOptions({verbose: true}))
                 .toEqual(jasmine.objectContaining({platforms: ['android'], verbose: true}));
         });
 
-        it('Test 020 : should pick buildConfig if no option is provided, but buildConfig.json exists', function() {
+        it('Test 020 : should pick buildConfig if no option is provided, but buildConfig.json exists', function () {
             spyOn(fs, 'existsSync').and.returnValue(true);
             // Using path.join below to normalize path separators
             expect(util.preProcessOptions())
                 .toEqual(jasmine.objectContaining({options: {buildConfig: path.join('/fake/path/build.json')}}));
         });
 
-        describe('ensurePlatformOptionsCompatible', function() {
+        describe('ensurePlatformOptionsCompatible', function () {
 
             var unknownOptions = ['--foo', '--appx=uap', '--gradleArg=--no-daemon'];
             var validOptions = ['--debug', '--release', '--device', '--emulator', '--nobuild', '--list',
-                    '--buildConfig=/fake/path/build.json', '--target=foo', '--archs="x86 x64"'];
+                '--buildConfig=/fake/path/build.json', '--target=foo', '--archs="x86 x64"'];
 
-            it('Test 021 : should return \'options\' unchanged if they are not an array', function() {
+            it('Test 021 : should return \'options\' unchanged if they are not an array', function () {
                 ['foo', true, {bar: true}].forEach(function (optionValue) {
                     expect(util.preProcessOptions({options: optionValue}))
                         .toEqual(jasmine.objectContaining({options: optionValue}));
                 });
             });
 
-            it('Test 022 : should emit \'warn\' event if \'options\' is an Array', function() {
+            it('Test 022 : should emit \'warn\' event if \'options\' is an Array', function () {
                 var warnSpy = jasmine.createSpy('warnSpy');
                 events.on('warn', warnSpy);
                 util.preProcessOptions({options: ['foo']});
@@ -267,20 +265,25 @@ describe('util module', function() {
                 events.removeListener('warn', warnSpy);
             });
 
-            it('Test 023 : should convert options Array into object with \'argv\' field', function() {
+            it('Test 023 : should convert options Array into object with \'argv\' field', function () {
                 expect(util.preProcessOptions({options: []}))
                     .toEqual(jasmine.objectContaining({options: {argv: []}}));
             });
 
             it('Test 024 : should convert known options (platform-agnostic) into resultant object\'s fields', function () {
+                /* eslint-disable no-useless-escape */
                 var expectedResult = {
-                    'debug': true, 'release': true,
-                    'device': true, 'emulator': true,
-                    'nobuild': true, 'list': true,
+                    'debug': true,
+                    'release': true,
+                    'device': true,
+                    'emulator': true,
+                    'nobuild': true,
+                    'list': true,
                     'buildConfig': '/fake/path/build.json',
                     'target': 'foo',
                     'archs': '\"x86 x64\"'
                 };
+                /* eslint-disable no-useless-escape */
 
                 expect(util.preProcessOptions({options: validOptions}).options)
                     .toEqual(jasmine.objectContaining(expectedResult));

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/helpers.js
----------------------------------------------------------------------
diff --git a/spec/helpers.js b/spec/helpers.js
index 76686df..f9fd7cd 100644
--- a/spec/helpers.js
+++ b/spec/helpers.js
@@ -17,18 +17,18 @@
     under the License.
 */
 
-var path         = require('path'),
-    fs           = require('fs'),
-    shell        = require('shelljs'),
-    os           = require('os'),
-    ConfigParser = require('cordova-common').ConfigParser;
+var path = require('path');
+var fs = require('fs');
+var shell = require('shelljs');
+var os = require('os');
+var ConfigParser = require('cordova-common').ConfigParser;
 
 // Just use Android everywhere; we're mocking out any calls to the `android` binary.
 module.exports.testPlatform = 'android';
 
-function getConfigPath(dir) {
+function getConfigPath (dir) {
     // if path ends with 'config.xml', return it
-    if (dir.indexOf('config.xml') == dir.length - 10) {
+    if (dir.indexOf('config.xml') === dir.length - 10) {
         return dir;
     }
     // otherwise, add 'config.xml' to the end of it
@@ -40,7 +40,7 @@ module.exports.tmpDir = function (subdir) {
     if (subdir) {
         dir = path.join(dir, subdir);
     }
-    if(fs.existsSync(dir)) {
+    if (fs.existsSync(dir)) {
         shell.rm('-rf', dir);
     }
     shell.mkdir('-p', dir);
@@ -70,8 +70,8 @@ module.exports.setEngineSpec = function (appPath, engine, spec) {
 
 module.exports.getEngineSpec = function (appPath, engine) {
     appPath = getConfigPath(appPath);
-    var parser = new ConfigParser(appPath),
-        engines = parser.getEngines();
+    var parser = new ConfigParser(appPath);
+    var engines = parser.getEngines();
 
     for (var i = 0; i < engines.length; i++) {
         if (engines[i].name === module.exports.testPlatform) {
@@ -91,9 +91,9 @@ module.exports.removeEngine = function (appPath, engine) {
 
 module.exports.setPluginSpec = function (appPath, plugin, spec) {
     appPath = getConfigPath(appPath);
-    var parser = new ConfigParser(appPath),
-        p = parser.getPlugin(plugin),
-        variables = [];
+    var parser = new ConfigParser(appPath);
+    var p = parser.getPlugin(plugin);
+    var variables = [];
 
     if (p) {
         parser.removePlugin(p.name);
@@ -108,8 +108,8 @@ module.exports.setPluginSpec = function (appPath, plugin, spec) {
 
 module.exports.getPluginSpec = function (appPath, plugin) {
     appPath = getConfigPath(appPath);
-    var parser = new ConfigParser(appPath),
-        p = parser.getPlugin(plugin);
+    var parser = new ConfigParser(appPath);
+    var p = parser.getPlugin(plugin);
 
     if (p) {
         return p.spec;
@@ -119,8 +119,8 @@ module.exports.getPluginSpec = function (appPath, plugin) {
 
 module.exports.getPluginVariable = function (appPath, plugin, variable) {
     appPath = getConfigPath(appPath);
-    var parser = new ConfigParser(appPath),
-        p = parser.getPlugin(plugin);
+    var parser = new ConfigParser(appPath);
+    var p = parser.getPlugin(plugin);
 
     if (p && p.variables) {
         return p.variables[variable];
@@ -151,12 +151,12 @@ beforeEach(function () {
     jasmine.addMatchers({
         'toExist': function () {
             return {
-                compare: function(actual, expected) {
+                compare: function (actual, expected) {
                     var result = {};
 
                     result.pass = fs.existsSync(actual);
 
-                    if(result.pass) {
+                    if (result.pass) {
                         result.message = 'expected ' + actual + ' to not exist';
                     } else {
                         result.message = 'expected ' + actual + ' to exist';

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/add_platform.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/add_platform.spec.js b/spec/plugman/add_platform.spec.js
index ccef788..9631d2c 100644
--- a/spec/plugman/add_platform.spec.js
+++ b/spec/plugman/add_platform.spec.js
@@ -16,14 +16,14 @@
     specific language governing permissions and limitations
     under the License.
 */
-var platform = require('../../src/plugman/platform'),
-    Q = require('q'),
-    fs = require('fs');
+var platform = require('../../src/plugman/platform');
+var Q = require('q');
+var fs = require('fs');
 
-describe( 'platform add/remove', function() {
-    it( 'Test 001 : should call platform add', function() {
-        var sPlatformA = spyOn( platform, 'add' ).and.returnValue(Q()),
-            sPlatformR = spyOn( platform, 'remove' ).and.returnValue(Q());
+describe('platform add/remove', function () {
+    it('Test 001 : should call platform add', function () {
+        var sPlatformA = spyOn(platform, 'add').and.returnValue(Q());
+        var sPlatformR = spyOn(platform, 'remove').and.returnValue(Q());
         platform.add();
         expect(sPlatformA).toHaveBeenCalled();
         platform.remove();
@@ -31,43 +31,45 @@ describe( 'platform add/remove', function() {
     });
 });
 
+describe('platform add', function () {
+    /* eslint-disable no-unused-vars */
+    var done = false;
+    var existsSync;
+    /* eslint-enable no-unused-vars */
 
-describe( 'platform add', function() {
-    var done = false,
-        existsSync;
-
-    beforeEach( function() {
-        existsSync = spyOn( fs, 'existsSync' ).and.returnValue( false );
+    beforeEach(function () {
+        existsSync = spyOn(fs, 'existsSync').and.returnValue(false);
         done = false;
     });
-    it( 'Test 002 : should error on non existing plugin.xml', function(done) {
-        platform.add().then(function(result){
+    it('Test 002 : should error on non existing plugin.xml', function (done) {
+        platform.add().then(function (result) {
             expect(false).toBe(true);
             done();
         },
-        function err(errMsg) {
+        function err (errMsg) {
             expect(errMsg.toString()).toContain('can\'t find a plugin.xml.  Are you in the plugin?');
             done();
         });
     }, 6000);
 });
 
+describe('platform remove', function () {
+    /* eslint-disable no-unused-vars */
+    var done = false;
+    var existsSync;
+    /* eslint-enable no-unused-vars */
 
-describe( 'platform remove', function() {
-    var done = false,
-        existsSync;
-        
-    beforeEach( function() {
-        existsSync = spyOn( fs, 'existsSync' ).and.returnValue( false );
+    beforeEach(function () {
+        existsSync = spyOn(fs, 'existsSync').and.returnValue(false);
         done = false;
     });
-    it( 'Test 003 : should error on non existing plugin.xml', function(done) {
-        platform.remove().then(function(result) {
+    it('Test 003 : should error on non existing plugin.xml', function (done) {
+        platform.remove().then(function (result) {
             expect(false).toBe(true);
             done();
         },
-        function err(errMsg) {
-            expect(errMsg.toString()).toContain( 'can\'t find a plugin.xml.  Are you in the plugin?'  );
+        function err (errMsg) {
+            expect(errMsg.toString()).toContain('can\'t find a plugin.xml.  Are you in the plugin?');
             done();
         });
     }, 6000);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/config.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/config.spec.js b/spec/plugman/config.spec.js
index f8b087c..46c4a03 100644
--- a/spec/plugman/config.spec.js
+++ b/spec/plugman/config.spec.js
@@ -16,12 +16,12 @@
     specific language governing permissions and limitations
     under the License.
 */
-var config = require('../../src/plugman/config'),
-    Q = require('q'),
-    registry = require('../../src/plugman/registry/registry');
+var config = require('../../src/plugman/config');
+var Q = require('q');
+var registry = require('../../src/plugman/registry/registry');
 
-describe('config', function() {
-    it('Test 001 : should run config', function() {
+describe('config', function () {
+    it('Test 001 : should run config', function () {
         var sConfig = spyOn(registry, 'config').and.returnValue(Q());
         var params = ['set', 'registry', 'http://registry.cordova.io'];
         config(params);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/create.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/create.spec.js b/spec/plugman/create.spec.js
index 0aac688..e538851 100644
--- a/spec/plugman/create.spec.js
+++ b/spec/plugman/create.spec.js
@@ -16,62 +16,66 @@
     specific language governing permissions and limitations
     under the License.
 */
-var create = require('../../src/plugman/create'),
-    Q = require('q'),
-    fs = require('fs'),
-    shell = require('shelljs'),
-    plugman = require('../../src/plugman/plugman');
+var create = require('../../src/plugman/create');
+var Q = require('q');
+var fs = require('fs');
+var shell = require('shelljs');
+var plugman = require('../../src/plugman/plugman');
 
-describe( 'create', function() {
-    it( 'Test 001 : should call create', function() {
-        var sCreate = spyOn( plugman, 'create' ).and.returnValue(Q());
+describe('create', function () {
+    it('Test 001 : should call create', function () {
+        var sCreate = spyOn(plugman, 'create').and.returnValue(Q());
         plugman.create();
         expect(sCreate).toHaveBeenCalled();
     });
 });
 
-describe( 'create plugin', function() {
-    var done = false,
-        existsSync,
-        mkdir,
-        writeFileSync;
+describe('create plugin', function () {
+    /* eslint-disable no-unused-vars */
+    var done = false;
+    var existsSync;
+    var mkdir;
+    var writeFileSync;
+    /* eslint-enable no-unused-vars */
 
-    beforeEach( function() {
-        existsSync = spyOn( fs, 'existsSync' ).and.returnValue( false );
-        mkdir = spyOn( shell, 'mkdir' ).and.returnValue( true );
-        writeFileSync = spyOn( fs, 'writeFileSync' );
+    beforeEach(function () {
+        existsSync = spyOn(fs, 'existsSync').and.returnValue(false);
+        mkdir = spyOn(shell, 'mkdir').and.returnValue(true);
+        writeFileSync = spyOn(fs, 'writeFileSync');
         done = false;
     });
 
-    it( 'Test 002 : should be successful', function(done) {
+    it('Test 002 : should be successful', function (done) {
         create('name', 'org.plugin.id', '0.0.0', '.', [])
-        .then(function(result) {
-            expect( writeFileSync.calls.count() ).toEqual( 2 );
-            done();
-        }).fail(function err(errMsg) {
-            expect(errMsg).toBeUndefined();
-            done();
-        });
+            .then(function (result) {
+                expect(writeFileSync.calls.count()).toEqual(2);
+                done();
+            }).fail(function err (errMsg) {
+                expect(errMsg).toBeUndefined();
+                done();
+            });
     }, 6000);
 });
 
-describe( 'create plugin in existing plugin', function() {
-    var done = false,
-        existsSync;
+describe('create plugin in existing plugin', function () {
+    /* eslint-disable no-unused-vars */
+    var done = false;
+    var existsSync;
+    /* eslint-enable no-unused-vars */
 
-    beforeEach( function() {
-        existsSync = spyOn( fs, 'existsSync' ).and.returnValue( true );
-        done = false;
+    beforeEach(function () {
+        existsSync = spyOn(fs, 'existsSync').and.returnValue(true); // eslint-disable-line  no-unused-vars
+        done = false; // eslint-disable-line  no-unused-vars
     });
 
-    it( 'Test 003 : should fail due to an existing plugin.xml', function(done) {
+    it('Test 003 : should fail due to an existing plugin.xml', function (done) {
         create()
-        .then(function(result) {
-            expect(false).toBe(true);
-            done();
-        }).fail(function err(errMsg) {
-            expect(errMsg.toString()).toContain( 'plugin.xml already exists. Are you already in a plugin?'  );
-            done();
-        });
+            .then(function (result) {
+                expect(false).toBe(true);
+                done();
+            }).fail(function err (errMsg) {
+                expect(errMsg.toString()).toContain('plugin.xml already exists. Are you already in a plugin?');
+                done();
+            });
     }, 6000);
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/info.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/info.spec.js b/spec/plugman/info.spec.js
index b8505db..8f45b28 100644
--- a/spec/plugman/info.spec.js
+++ b/spec/plugman/info.spec.js
@@ -16,12 +16,12 @@
     specific language governing permissions and limitations
     under the License.
 */
-var search = require('../../src/plugman/info'),
-    Q = require('q'),
-    registry = require('../../src/plugman/registry/registry');
+var search = require('../../src/plugman/info');
+var Q = require('q');
+var registry = require('../../src/plugman/registry/registry');
 
-describe('info', function() {
-    it('Test 001 : should show plugin info', function() {
+describe('info', function () {
+    it('Test 001 : should show plugin info', function () {
         var sSearch = spyOn(registry, 'info').and.returnValue(Q({
             name: 'fakePlugin',
             version: '1.0.0',


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


[07/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/CordovaExternalToolErrorContext.js
----------------------------------------------------------------------
diff --git a/src/CordovaExternalToolErrorContext.js b/src/CordovaExternalToolErrorContext.js
index ca9a4aa..73d007e 100644
--- a/src/CordovaExternalToolErrorContext.js
+++ b/src/CordovaExternalToolErrorContext.js
@@ -17,8 +17,6 @@
  under the License.
  */
 
-/* jshint proto:true */
-
 var path = require('path');
 
 /**
@@ -27,7 +25,7 @@ var path = require('path');
  * @param {String} [cwd] Command working directory
  * @constructor
  */
-function CordovaExternalToolErrorContext(cmd, args, cwd) {
+function CordovaExternalToolErrorContext (cmd, args, cwd) {
     this.cmd = cmd;
     // Helper field for readability
     this.cmdShortName = path.basename(cmd);
@@ -35,8 +33,8 @@ function CordovaExternalToolErrorContext(cmd, args, cwd) {
     this.cwd = cwd;
 }
 
-CordovaExternalToolErrorContext.prototype.toString = function(isVerbose) {
-    if(isVerbose) {
+CordovaExternalToolErrorContext.prototype.toString = function (isVerbose) {
+    if (isVerbose) {
         return 'External tool \'' + this.cmdShortName + '\'' +
             '\nCommand full path: ' + this.cmd + '\nCommand args: ' + this.args +
             (typeof this.cwd !== 'undefined' ? '\nCommand cwd: ' + this.cwd : '');

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/build.js
----------------------------------------------------------------------
diff --git a/src/cordova/build.js b/src/cordova/build.js
index 2293f9f..b33cf21 100644
--- a/src/cordova/build.js
+++ b/src/cordova/build.js
@@ -17,25 +17,25 @@
     under the License.
 */
 
-var Q = require('q'),
-    cordovaUtil = require('./util'),
-    HooksRunner = require('../hooks/HooksRunner');
+var Q = require('q');
+var cordovaUtil = require('./util');
+var HooksRunner = require('../hooks/HooksRunner');
 
 // Returns a promise.
-module.exports = function build(options) {
-    return Q().then(function() {
+module.exports = function build (options) {
+    return Q().then(function () {
         var projectRoot = cordovaUtil.cdProjectRoot();
         options = cordovaUtil.preProcessOptions(options);
 
         // fire build hooks
         var hooksRunner = new HooksRunner(projectRoot);
         return hooksRunner.fire('before_build', options)
-        .then(function() {
-            return require('./cordova').prepare(options);
-        }).then(function() {
-            return require('./cordova').compile(options);
-        }).then(function() {
-            return hooksRunner.fire('after_build', options);
-        });
+            .then(function () {
+                return require('./cordova').prepare(options);
+            }).then(function () {
+                return require('./cordova').compile(options);
+            }).then(function () {
+                return hooksRunner.fire('after_build', options);
+            });
     });
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/clean.js
----------------------------------------------------------------------
diff --git a/src/cordova/clean.js b/src/cordova/clean.js
index 4ed8962..3f6a52c 100644
--- a/src/cordova/clean.js
+++ b/src/cordova/clean.js
@@ -17,31 +17,31 @@
     under the License.
 */
 
-var Q = require('q'),
-    cordova_util = require('./util'),
-    HooksRunner  = require('../hooks/HooksRunner'),
-    events       = require('cordova-common').events,
-    chain        = require('../util/promise-util').Q_chainmap,
-    platform_lib = require('../platforms/platforms');
+var Q = require('q');
+var cordova_util = require('./util');
+var HooksRunner = require('../hooks/HooksRunner');
+var events = require('cordova-common').events;
+var chain = require('../util/promise-util').Q_chainmap;
+var platform_lib = require('../platforms/platforms');
 
 // Returns a promise.
-module.exports = function clean(options) {
-    return Q().then(function() {
+module.exports = function clean (options) {
+    return Q().then(function () {
         var projectRoot = cordova_util.cdProjectRoot();
         options = cordova_util.preProcessOptions(options);
 
         var hooksRunner = new HooksRunner(projectRoot);
         return hooksRunner.fire('before_clean', options)
-        .then(function () {
-            return chain(options.platforms, function (platform) {
-                events.emit('verbose', 'Running cleanup for ' + platform + ' platform.');
-                return platform_lib
-                    .getPlatformApi(platform)
-                    .clean();
+            .then(function () {
+                return chain(options.platforms, function (platform) {
+                    events.emit('verbose', 'Running cleanup for ' + platform + ' platform.');
+                    return platform_lib
+                        .getPlatformApi(platform)
+                        .clean();
+                });
+            })
+            .then(function () {
+                return hooksRunner.fire('after_clean', options);
             });
-        })
-        .then(function() {
-            return hooksRunner.fire('after_clean', options);
-        });
     });
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/compile.js
----------------------------------------------------------------------
diff --git a/src/cordova/compile.js b/src/cordova/compile.js
index a9b41ba..7ad1b8e 100644
--- a/src/cordova/compile.js
+++ b/src/cordova/compile.js
@@ -17,29 +17,30 @@
     under the License.
 */
 
-var Q            = require('q'),
-    cordova_util = require('./util'),
-    HooksRunner  = require('../hooks/HooksRunner'),
-    promiseUtil  = require('../util/promise-util'),
-    platform_lib = require('../platforms/platforms'),
-    _ = require('underscore');
+var Q = require('q');
+var cordova_util = require('./util');
+var HooksRunner = require('../hooks/HooksRunner');
+var promiseUtil = require('../util/promise-util');
+var platform_lib = require('../platforms/platforms');
+var _ = require('underscore');
 
 // Returns a promise.
-module.exports = function compile(options) {
-    return Q().then(function() {
-        var projectRoot = cordova_util.cdProjectRoot();
-        options = cordova_util.preProcessOptions(options);
-
-        var hooksRunner = new HooksRunner(projectRoot);
-        return hooksRunner.fire('before_compile', options)
+module.exports = function compile (options) {
+    return Q()
         .then(function () {
-            return promiseUtil.Q_chainmap(options.platforms, function (platform) {
-                return platform_lib
-                    .getPlatformApi(platform)
-                    .build(_.clone(options.options));
-            });
-        }).then(function() {
-            return hooksRunner.fire('after_compile', options);
+            var projectRoot = cordova_util.cdProjectRoot();
+            options = cordova_util.preProcessOptions(options);
+
+            var hooksRunner = new HooksRunner(projectRoot);
+            return hooksRunner.fire('before_compile', options)
+                .then(function () {
+                    return promiseUtil.Q_chainmap(options.platforms, function (platform) {
+                        return platform_lib
+                            .getPlatformApi(platform)
+                            .build(_.clone(options.options));
+                    });
+                }).then(function () {
+                    return hooksRunner.fire('after_compile', options);
+                });
         });
-    });
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/config.js
----------------------------------------------------------------------
diff --git a/src/cordova/config.js b/src/cordova/config.js
index d75664b..9b369a5 100644
--- a/src/cordova/config.js
+++ b/src/cordova/config.js
@@ -17,16 +17,16 @@
     under the License.
 */
 
-var path          = require('path'),
-    fs            = require('fs'),
-    url           = require('url'),
-    shell         = require('shelljs');
+var path = require('path');
+var fs = require('fs');
+var url = require('url');
+var shell = require('shelljs');
 
 // Map of project_root -> JSON
 var configCache = {};
 var autoPersist = true;
 
-function config(project_root, opts) {
+function config (project_root, opts) {
     var json = config.read(project_root);
     for (var p in opts) {
         json[p] = opts[p];
@@ -39,15 +39,15 @@ function config(project_root, opts) {
     return json;
 }
 
-config.getAutoPersist = function() {
+config.getAutoPersist = function () {
     return autoPersist;
 };
 
-config.setAutoPersist = function(value) {
+config.setAutoPersist = function (value) {
     autoPersist = value;
 };
 
-config.read = function get_config(project_root) {
+config.read = function get_config (project_root) {
     var data = configCache[project_root];
     if (data === undefined) {
         var configPath = path.join(project_root, '.cordova', 'config.json');
@@ -61,24 +61,24 @@ config.read = function get_config(project_root) {
     return JSON.parse(data);
 };
 
-config.write = function set_config(project_root, json) {
+config.write = function set_config (project_root, json) {
     var configPath = path.join(project_root, '.cordova', 'config.json');
     var contents = JSON.stringify(json, null, 2);
     configCache[project_root] = contents;
     // Don't write the file for an empty config.
-    if (contents != '{}' || fs.existsSync(configPath)) {
+    if (contents !== '{}' || fs.existsSync(configPath)) {
         shell.mkdir('-p', path.join(project_root, '.cordova'));
         fs.writeFileSync(configPath, contents, 'utf-8');
     }
     return json;
 };
 
-config.has_custom_path = function(project_root, platform) {
+config.has_custom_path = function (project_root, platform) {
     var json = config.read(project_root);
     if (json.lib && json.lib[platform]) {
         var uri = url.parse(json.lib[platform].url || json.lib[platform].uri);
         if (!(uri.protocol)) return uri.path;
-        else if (uri.protocol && uri.protocol[1] ==':') return uri.href;
+        else if (uri.protocol && uri.protocol[1] === ':') return uri.href;
     }
     return false;
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/cordova.js
----------------------------------------------------------------------
diff --git a/src/cordova/cordova.js b/src/cordova/cordova.js
index 5b091e3..9b20f3c 100644
--- a/src/cordova/cordova.js
+++ b/src/cordova/cordova.js
@@ -21,28 +21,28 @@ var cordova_events = require('cordova-common').events;
 var cordova_util = require('./util');
 var aliasMethodToRawWithDeprecationNotice = require('../util/alias');
 
-var off = function() {
+var off = function () {
     cordova_events.removeListener.apply(cordova_events, arguments);
 };
 
-var emit = function() {
+var emit = function () {
     cordova_events.emit.apply(cordova_events, arguments);
 };
 
 exports = module.exports = {
-    get binname() { return cordova_util.binname; },
-    set binname(name) { cordova_util.binname = name; },
-    on:        function() {
+    get binname () { return cordova_util.binname; },
+    set binname (name) { cordova_util.binname = name; },
+    on: function () {
         cordova_events.on.apply(cordova_events, arguments);
     },
-    off:       off,
-    removeListener:off,
-    removeAllListeners: function() {
+    off: off,
+    removeListener: off,
+    removeAllListeners: function () {
         cordova_events.removeAllListeners.apply(cordova_events, arguments);
     },
-    emit:      emit,
-    trigger:   emit,
-    findProjectRoot: function(opt_startDir) {
+    emit: emit,
+    trigger: emit,
+    findProjectRoot: function (opt_startDir) {
         return cordova_util.isCordova(opt_startDir);
     },
     prepare: require('./prepare'),
@@ -72,6 +72,6 @@ var modulesToAlias = ['prepare', 'build', 'config', 'emulate', 'plugin',
     'plugins', 'serve', 'platform', 'platforms', 'compile', 'run', 'info',
     'targets', 'requirements', 'projectMetadata', 'clean'];
 
-modulesToAlias.forEach(function(mod) {
+modulesToAlias.forEach(function (mod) {
     aliasMethodToRawWithDeprecationNotice(mod, module.exports, 'cordova');
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/create.js
----------------------------------------------------------------------
diff --git a/src/cordova/create.js b/src/cordova/create.js
index a7d1e7c..af1f044 100644
--- a/src/cordova/create.js
+++ b/src/cordova/create.js
@@ -20,7 +20,7 @@
 var create = require('cordova-create');
 var events = require('cordova-common').events;
 
-module.exports = function(dir, optionalId, optionalName, cfg, extEvents){
+module.exports = function (dir, optionalId, optionalName, cfg, extEvents) {
     if (extEvents) {
         return create(dir, optionalId, optionalName, cfg, extEvents);
     } else {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/emulate.js
----------------------------------------------------------------------
diff --git a/src/cordova/emulate.js b/src/cordova/emulate.js
index 9f65058..85936a1 100644
--- a/src/cordova/emulate.js
+++ b/src/cordova/emulate.js
@@ -17,16 +17,15 @@
     under the License.
 */
 
-var cordova_util = require('./util'),
-    HooksRunner  = require('../hooks/HooksRunner'),
-    Q            = require('q'),
-    platform_lib = require('../platforms/platforms'),
-    _ = require('underscore');
-
+var cordova_util = require('./util');
+var HooksRunner = require('../hooks/HooksRunner');
+var Q = require('q');
+var platform_lib = require('../platforms/platforms');
+var _ = require('underscore');
 
 // Returns a promise.
-module.exports = function emulate(options) {
-    return Q().then(function() {
+module.exports = function emulate (options) {
+    return Q().then(function () {
         var projectRoot = cordova_util.cdProjectRoot();
         options = cordova_util.preProcessOptions(options);
         options.options.device = false;
@@ -38,28 +37,28 @@ module.exports = function emulate(options) {
 
         var hooksRunner = new HooksRunner(projectRoot);
         return hooksRunner.fire('before_emulate', options)
-        .then(function() {
-            if (!options.options.noprepare) {
-                // Run a prepare first!
-                return require('./cordova').prepare(options);
-            }
-        }).then(function() {
-            // Deploy in parallel (output gets intermixed though...)
-            return Q.all(options.platforms.map(function(platform) {
+            .then(function () {
+                if (!options.options.noprepare) {
+                    // Run a prepare first!
+                    return require('./cordova').prepare(options);
+                }
+            }).then(function () {
+                // Deploy in parallel (output gets intermixed though...)
+                return Q.all(options.platforms.map(function (platform) {
 
-                var buildPromise = options.options.nobuild ? Q() :
-                    platform_lib.getPlatformApi(platform).build(options.options);
+                    var buildPromise = options.options.nobuild ? Q() :
+                        platform_lib.getPlatformApi(platform).build(options.options);
 
-                return buildPromise
-                .then(function() {
-                    return hooksRunner.fire('before_deploy', options);
-                })
-                .then(function() {
-                    return platform_lib.getPlatformApi(platform).run(optsClone);
-                });
-            }));
-        }).then(function() {
-            return hooksRunner.fire('after_emulate', options);
-        });
+                    return buildPromise
+                        .then(function () {
+                            return hooksRunner.fire('before_deploy', options);
+                        })
+                        .then(function () {
+                            return platform_lib.getPlatformApi(platform).run(optsClone);
+                        });
+                }));
+            }).then(function () {
+                return hooksRunner.fire('after_emulate', options);
+            });
     });
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/info.js
----------------------------------------------------------------------
diff --git a/src/cordova/info.js b/src/cordova/info.js
index 4e1dac6..8468736 100644
--- a/src/cordova/info.js
+++ b/src/cordova/info.js
@@ -22,23 +22,23 @@ A utility funciton to help output the information needed
 when submitting a help request.
 Outputs to a file
  */
-var cordova_util = require('./util'),
-    superspawn   = require('cordova-common').superspawn,
-    package      = require('../../package'),
-    path         = require('path'),
-    fs           = require('fs'),
-    Q            = require('q');
+var cordova_util = require('./util');
+var superspawn = require('cordova-common').superspawn;
+var pkg = require('../../package');
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
 
 // Execute using a child_process exec, for any async command
-function execSpawn(command, args, resultMsg, errorMsg) {
-    return superspawn.spawn(command, args).then(function(result) {
+function execSpawn (command, args, resultMsg, errorMsg) {
+    return superspawn.spawn(command, args).then(function (result) {
         return resultMsg + result;
-    }, function(error) {
+    }, function (error) {
         return errorMsg + error;
     });
 }
 
-function getPlatformInfo(platform, projectRoot) {
+function getPlatformInfo (platform, projectRoot) {
     switch (platform) {
     case 'ios':
         return execSpawn('xcodebuild', ['-version'], 'iOS platform:\n\n', 'Error retrieving iOS platform information: ');
@@ -47,54 +47,53 @@ function getPlatformInfo(platform, projectRoot) {
     }
 }
 
-
-module.exports = function info() {
-    //Get projectRoot
+module.exports = function info () {
+    // Get projectRoot
     var projectRoot = cordova_util.cdProjectRoot();
     var output = '';
     if (!projectRoot) {
         return Q.reject(new Error('Current working directory is not a Cordova-based project.'));
     }
 
-    //Array of functions, Q.allSettled
+    // Array of functions, Q.allSettled
     console.log('Collecting Data...\n\n');
     return Q.allSettled([
-            //Get Node version
-            Q('Node version: ' + process.version),
-            //Get Cordova version
-            Q('Cordova version: ' + package.version),
-            //Get project config.xml file using ano
-            getProjectConfig(projectRoot),
-            //Get list of plugins
-            listPlugins(projectRoot),
-            //Get Platforms information
-            getPlatforms(projectRoot)
-        ]).then(function(promises) {
-            promises.forEach(function(p) {
-                output += p.state === 'fulfilled' ? p.value + '\n\n' : p.reason + '\n\n';
-            });
-            console.info(output);
-            fs.writeFile(path.join(projectRoot, 'info.txt'), output, 'utf-8', function (err) {
-                if (err) throw err;
-            });
+        // Get Node version
+        Q('Node version: ' + process.version),
+        // Get Cordova version
+        Q('Cordova version: ' + pkg.version),
+        // Get project config.xml file using ano
+        getProjectConfig(projectRoot),
+        // Get list of plugins
+        listPlugins(projectRoot),
+        // Get Platforms information
+        getPlatforms(projectRoot)
+    ]).then(function (promises) {
+        promises.forEach(function (p) {
+            output += p.state === 'fulfilled' ? p.value + '\n\n' : p.reason + '\n\n';
+        });
+        console.info(output);
+        fs.writeFile(path.join(projectRoot, 'info.txt'), output, 'utf-8', function (err) {
+            if (err) throw err;
         });
+    });
 };
 
-function getPlatforms(projectRoot) {
+function getPlatforms (projectRoot) {
     var platforms = cordova_util.listPlatforms(projectRoot);
     if (platforms.length) {
-        return Q.all(platforms.map(function(p) {
+        return Q.all(platforms.map(function (p) {
             return getPlatformInfo(p, projectRoot);
-        })).then(function(outs) {
+        })).then(function (outs) {
             return outs.join('\n\n');
         });
     }
     return Q.reject('No Platforms Currently Installed');
 }
 
-function listPlugins(projectRoot) {
-    var pluginPath = path.join(projectRoot, 'plugins'),
-        plugins    = cordova_util.findPlugins(pluginPath);
+function listPlugins (projectRoot) {
+    var pluginPath = path.join(projectRoot, 'plugins');
+    var plugins = cordova_util.findPlugins(pluginPath);
 
     if (!plugins.length) {
         return Q.reject('No Plugins Currently Installed');
@@ -102,8 +101,8 @@ function listPlugins(projectRoot) {
     return Q('Plugins: \n\n' + plugins);
 }
 
-function getProjectConfig(projectRoot) {
-    if (!fs.existsSync(projectRoot)  ) {
+function getProjectConfig (projectRoot) {
+    if (!fs.existsSync(projectRoot)) {
         return Q.reject('Config.xml file not found');
     }
     return Q('Config.xml file: \n\n' + (fs.readFileSync(cordova_util.projectConfig(projectRoot), 'utf-8')));

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/lazy_load.js
----------------------------------------------------------------------
diff --git a/src/cordova/lazy_load.js b/src/cordova/lazy_load.js
index db55b68..e1509fc 100644
--- a/src/cordova/lazy_load.js
+++ b/src/cordova/lazy_load.js
@@ -18,31 +18,31 @@
 */
 
 // The URL:true below prevents jshint error "Redefinition or 'URL'."
-// globals URL:true 
+// globals URL:true
 
-var path          = require('path'),
-    _             = require('underscore'),
-    fs            = require('fs'),
-    shell         = require('shelljs'),
-    platforms     = require('../platforms/platforms'),
-    events        = require('cordova-common').events,
-    request       = require('request'),
-    config        = require('./config'),
-    HooksRunner   = require('../hooks/HooksRunner'),
-    zlib          = require('zlib'),
-    tar           = require('tar'),
-    URL           = require('url'),
-    Q             = require('q'),
-    npm           = require('npm'),
-    npmhelper     = require('../util/npm-helper'),
-    util          = require('./util'),
-    gitclone      = require('../gitclone'),
-    stubplatform  = {
-        url    : undefined,
-        version: undefined,
-        altplatform: undefined,
-        subdirectory: ''
-    };
+var path = require('path');
+var _ = require('underscore');
+var fs = require('fs');
+var shell = require('shelljs');
+var platforms = require('../platforms/platforms');
+var events = require('cordova-common').events;
+var request = require('request');
+var config = require('./config');
+var HooksRunner = require('../hooks/HooksRunner');
+var zlib = require('zlib');
+var tar = require('tar');
+var URL = require('url');
+var Q = require('q');
+var npm = require('npm');
+var npmhelper = require('../util/npm-helper');
+var util = require('./util');
+var gitclone = require('../gitclone');
+var stubplatform = {
+    url: undefined,
+    version: undefined,
+    altplatform: undefined,
+    subdirectory: ''
+};
 
 exports.cordova = cordova;
 exports.cordova_git = cordova_git;
@@ -51,12 +51,12 @@ exports.cordova_npm = cordova_npm;
 exports.custom = custom;
 exports.based_on_config = based_on_config;
 
-function Platform(platformString) {
+function Platform (platformString) {
     var name,
         platform,
         parts,
         version;
-    if (platformString.indexOf('@') != -1) {
+    if (platformString.indexOf('@') !== -1) {
         parts = platformString.split('@');
         name = parts[0];
         version = parts[1];
@@ -71,12 +71,12 @@ function Platform(platformString) {
 }
 
 // Returns a promise for the path to the lazy-loaded directory.
-function based_on_config(project_root, platform, opts) {
+function based_on_config (project_root, platform, opts) {
     var custom_path = config.has_custom_path(project_root, platform);
     if (custom_path) {
-        var dot_file = config.read(project_root),
-            mixed_platforms = _.extend({}, platforms);
-        mixed_platforms[platform] = _.extend({}, mixed_platforms[platform], dot_file.lib && dot_file.lib[platform] || {});
+        var dot_file = config.read(project_root);
+        var mixed_platforms = _.extend({}, platforms);
+        mixed_platforms[platform] = _.extend(({}, mixed_platforms[platform], dot_file.lib && dot_file.lib[platform])) || ({});
         return module.exports.custom(mixed_platforms, platform);
     } else {
         return module.exports.cordova(platform, opts);
@@ -84,19 +84,19 @@ function based_on_config(project_root, platform, opts) {
 }
 
 // Returns a promise for the path to the lazy-loaded directory.
-function cordova(platform, opts) {
+function cordova (platform, opts) {
     platform = new Platform(platform);
     var use_git = platform.source === 'git';
-    if ( use_git ) {
+    if (use_git) {
         return module.exports.cordova_git(platform);
     } else {
         return module.exports.cordova_npm(platform);
     }
 }
 
-function cordova_git(platform) {
-    var mixed_platforms = _.extend({}, platforms),
-        plat;
+function cordova_git (platform) {
+    var mixed_platforms = _.extend({}, platforms);
+    var plat;
     if (!(platform.name in platforms)) {
         return Q.reject(new Error('Cordova library "' + platform.name + '" not recognized.'));
     }
@@ -113,8 +113,8 @@ function cordova_git(platform) {
     });
 }
 
-function cordova_npm(platform) {
-    if ( !(platform.name in platforms) ) {
+function cordova_npm (platform) {
+    if (!(platform.name in platforms)) {
         return Q.reject(new Error('Cordova library "' + platform.name + '" not recognized.'));
     }
     // Check if this version was already downloaded from git, if yes, use that copy.
@@ -140,7 +140,7 @@ function cordova_npm(platform) {
 }
 
 // Returns a promise for the path to the lazy-loaded directory.
-function custom(platforms, platform) {
+function custom (platforms, platform) {
     var plat;
     var id;
     var uri;
@@ -167,7 +167,7 @@ function custom(platforms, platform) {
     platdir = plat.altplatform || platform;
     // Return early for already-cached remote URL, or for local URLs.
     uri = URL.parse(url);
-    isUri = uri.protocol && uri.protocol[1] != ':'; // second part of conditional is for awesome windows support. fuuu windows
+    isUri = uri.protocol && uri.protocol[1] !== ':'; // second part of conditional is for awesome windows support. fuuu windows
     if (isUri) {
         download_dir = path.join(util.libDirectory, platdir, id, version);
         lib_dir = path.join(download_dir, subdir);
@@ -182,19 +182,19 @@ function custom(platforms, platform) {
     }
 
     return HooksRunner.fire('before_library_download', {
-        platform:platform,
-        url:url,
-        id:id,
-        version:version
-    }).then(function() {
+        platform: platform,
+        url: url,
+        id: id,
+        version: version
+    }).then(function () {
         var uri = URL.parse(url);
         var d = Q.defer();
-        npm.load(function(err) {
+        npm.load(function (err) { // eslint-disable-line handle-callback-err
             // Check if NPM proxy settings are set. If so, include them in the request() call.
             var proxy;
-            if (uri.protocol == 'https:') {
+            if (uri.protocol === 'https:') {
                 proxy = npm.config.get('https-proxy');
-            } else if (uri.protocol == 'http:') {
+            } else if (uri.protocol === 'http:') {
                 proxy = npm.config.get('proxy');
             }
             var strictSSL = npm.config.get('strict-ssl');
@@ -207,20 +207,20 @@ function custom(platforms, platform) {
             shell.mkdir('-p', tmp_dir);
 
             var size = 0;
-            var request_options = {url:url};
+            var request_options = {url: url};
             if (proxy) {
                 request_options.proxy = proxy;
             }
-            if (typeof strictSSL == 'boolean') {
+            if (typeof strictSSL === 'boolean') {
                 request_options.strictSSL = strictSSL;
             }
             events.emit('verbose', 'Requesting ' + JSON.stringify(request_options) + '...');
             events.emit('log', 'Downloading ' + id + ' library for ' + platform + '...');
-            var req = request.get(request_options, function(err, res, body) {
+            var req = request.get(request_options, function (err, res, body) {
                 if (err) {
                     shell.rm('-rf', tmp_dir);
                     d.reject(err);
-                } else if (res.statusCode != 200) {
+                } else if (res.statusCode !== 200) {
                     shell.rm('-rf', tmp_dir);
                     d.reject(new Error('HTTP error ' + res.statusCode + ' retrieving version ' + version + ' of ' + id + ' for ' + platform));
                 } else {
@@ -228,44 +228,44 @@ function custom(platforms, platform) {
                 }
             });
             req.pipe(zlib.createUnzip())
-            .on('error', function(err) {
-                // Sometimes if the URL is bad (most likely unavailable version), and git-wip-us.apache.org is
-                // particularly slow at responding, we hit an error because of bad data piped to zlib.createUnzip()
-                // before we hit the request.get() callback above (with a 404 error). Handle that gracefully. It is
-                // likely that we will end up calling d.reject() for an HTTP error in the request() callback above, but
-                // in case not, reject with a useful error here.
-                d.reject(new Error('Unable to fetch platform ' + platform + '@' + version + ': Error: version not found.'));
-            })
-            .pipe(tar.Extract({path:tmp_dir}))
-            .on('error', function(err) {
-                shell.rm('-rf', tmp_dir);
-                d.reject(err);
-            })
-            .on('end', function() {
-                events.emit('verbose', 'Downloaded, unzipped and extracted ' + size + ' byte response.');
-                events.emit('log', 'Download complete');
-                var entries = fs.readdirSync(tmp_dir);
-                var entry = path.join(tmp_dir, entries[0]);
-                shell.mkdir('-p', download_dir);
-                shell.mv('-f', path.join(entry, '*'), download_dir);
-                shell.rm('-rf', tmp_dir);
-                d.resolve(HooksRunner.fire('after_library_download', {
-                    platform:platform,
-                    url:url,
-                    id:id,
-                    version:version,
-                    path: lib_dir,
-                    size:size,
-                    symlink:false
-                }));
-            });
+                .on('error', function (err) { // eslint-disable-line handle-callback-err
+                    // Sometimes if the URL is bad (most likely unavailable version), and git-wip-us.apache.org is
+                    // particularly slow at responding, we hit an error because of bad data piped to zlib.createUnzip()
+                    // before we hit the request.get() callback above (with a 404 error). Handle that gracefully. It is
+                    // likely that we will end up calling d.reject() for an HTTP error in the request() callback above, but
+                    // in case not, reject with a useful error here.
+                    d.reject(new Error('Unable to fetch platform ' + platform + '@' + version + ': Error: version not found.'));
+                })
+                .pipe(tar.Extract({path: tmp_dir}))
+                .on('error', function (err) {
+                    shell.rm('-rf', tmp_dir);
+                    d.reject(err);
+                })
+                .on('end', function () {
+                    events.emit('verbose', 'Downloaded, unzipped and extracted ' + size + ' byte response.');
+                    events.emit('log', 'Download complete');
+                    var entries = fs.readdirSync(tmp_dir);
+                    var entry = path.join(tmp_dir, entries[0]);
+                    shell.mkdir('-p', download_dir);
+                    shell.mv('-f', path.join(entry, '*'), download_dir);
+                    shell.rm('-rf', tmp_dir);
+                    d.resolve(HooksRunner.fire('after_library_download', {
+                        platform: platform,
+                        url: url,
+                        id: id,
+                        version: version,
+                        path: lib_dir,
+                        size: size,
+                        symlink: false
+                    }));
+                });
         });
         return d.promise.then(function () { return lib_dir; });
     });
 }
 
 // Returns a promise
-function git_clone_platform(git_url, branch) {
+function git_clone_platform (git_url, branch) {
     // Create a tmp dir. Using /tmp is a problem because it's often on a different partition and sehll.mv()
     // fails in this case with "EXDEV, cross-device link not permitted".
     var tmp_subidr = 'tmp_cordova_git_' + process.pid + '_' + (new Date()).valueOf();
@@ -290,5 +290,3 @@ function git_clone_platform(git_url, branch) {
         return Q.reject(err);
     });
 }
-
-

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/metadata/blackberry10_parser.js
----------------------------------------------------------------------
diff --git a/src/cordova/metadata/blackberry10_parser.js b/src/cordova/metadata/blackberry10_parser.js
index af42afe..0cb25b4 100644
--- a/src/cordova/metadata/blackberry10_parser.js
+++ b/src/cordova/metadata/blackberry10_parser.js
@@ -17,17 +17,17 @@
     under the License.
 */
 
-var fs            = require('fs'),
-    path          = require('path'),
-    shell         = require('shelljs'),
-    util          = require('../util'),
-    Q             = require('q'),
-    Parser        = require('./parser'),
-    ConfigParser = require('cordova-common').ConfigParser,
-    CordovaError = require('cordova-common').CordovaError,
-    events = require('cordova-common').events;
-
-function blackberry_parser(project) {
+var fs = require('fs');
+var path = require('path');
+var shell = require('shelljs');
+var util = require('../util');
+var Q = require('q');
+var Parser = require('./parser');
+var ConfigParser = require('cordova-common').ConfigParser;
+var CordovaError = require('cordova-common').CordovaError;
+var events = require('cordova-common').events;
+
+function blackberry_parser (project) {
     if (!fs.existsSync(path.join(project, 'www'))) {
         throw new CordovaError('The provided path "' + project + '" is not a Cordova BlackBerry10 project.');
     }
@@ -44,18 +44,18 @@ require('util').inherits(blackberry_parser, Parser);
 
 module.exports = blackberry_parser;
 
-blackberry_parser.prototype.update_from_config = function(config) {
-    var projectRoot = util.isCordova(this.path),
-        resDir = path.join(this.path, 'platform_www', 'res'),
-        platform_www = path.join(this.path, 'platform_www'),
-        icons,
-        splashscreens;
+blackberry_parser.prototype.update_from_config = function (config) {
+    var projectRoot = util.isCordova(this.path);
+    var resDir = path.join(this.path, 'platform_www', 'res');
+    var platform_www = path.join(this.path, 'platform_www');
+    var icons;
+    var splashscreens;
 
-    var copyResources = function(resList) {
+    var copyResources = function (resList) {
         for (var i = 0; i < resList.length; i++) {
-                var src = path.join(projectRoot, resList[i].src),
-                dest = path.join(platform_www, resList[i].src),
-                destFolder = path.dirname(dest);
+            var src = path.join(projectRoot, resList[i].src);
+            var dest = path.join(platform_www, resList[i].src);
+            var destFolder = path.dirname(dest);
 
             if (!fs.existsSync(destFolder)) {
                 shell.mkdir('-p', destFolder); // make sure target dir exists
@@ -84,12 +84,12 @@ blackberry_parser.prototype.update_from_config = function(config) {
 };
 
 // Returns a promise.
-blackberry_parser.prototype.update_project = function(cfg) {
+blackberry_parser.prototype.update_project = function (cfg) {
     var self = this;
 
     try {
         self.update_from_config(cfg);
-    } catch(e) {
+    } catch (e) {
         return Q.reject(e);
     }
     self.update_overrides();
@@ -98,27 +98,27 @@ blackberry_parser.prototype.update_project = function(cfg) {
 };
 
 // Returns the platform-specific www directory.
-blackberry_parser.prototype.www_dir = function() {
+blackberry_parser.prototype.www_dir = function () {
     return path.join(this.path, 'www');
 };
 
-blackberry_parser.prototype.config_xml = function(){
+blackberry_parser.prototype.config_xml = function () {
     return this.config_path;
 };
 
 // Used for creating platform_www in projects created by older versions.
-blackberry_parser.prototype.cordovajs_path = function(libDir) {
+blackberry_parser.prototype.cordovajs_path = function (libDir) {
     var jsPath = path.join(libDir, 'javascript', 'cordova.blackberry10.js');
     return path.resolve(jsPath);
 };
 
-blackberry_parser.prototype.cordovajs_src_path = function(libDir) {
+blackberry_parser.prototype.cordovajs_src_path = function (libDir) {
     var jsPath = path.join(libDir, 'cordova-js-src');
     return path.resolve(jsPath);
 };
 
 // Replace the www dir with contents of platform_www and app www.
-blackberry_parser.prototype.update_www = function() {
+blackberry_parser.prototype.update_www = function () {
     var projectRoot = util.isCordova(this.path);
     var app_www = util.projectWww(projectRoot);
     var platform_www = path.join(this.path, 'platform_www');
@@ -131,12 +131,12 @@ blackberry_parser.prototype.update_www = function() {
     shell.cp('-rf', path.join(app_www, '*'), this.www_dir());
     // Copy over stock platform www assets (cordova.js)
     shell.cp('-rf', path.join(platform_www, '*'), this.www_dir());
-    //Re-Write config.xml
+    // Re-Write config.xml
     platform_cfg_backup.write();
 };
 
 // update the overrides folder into the www folder
-blackberry_parser.prototype.update_overrides = function() {
+blackberry_parser.prototype.update_overrides = function () {
     var projectRoot = util.isCordova(this.path);
     var merges_path = path.join(util.appDir(projectRoot), 'merges', 'blackberry10');
     if (fs.existsSync(merges_path)) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/metadata/browser_parser.js
----------------------------------------------------------------------
diff --git a/src/cordova/metadata/browser_parser.js b/src/cordova/metadata/browser_parser.js
index c57b6d5..94f91e8 100644
--- a/src/cordova/metadata/browser_parser.js
+++ b/src/cordova/metadata/browser_parser.js
@@ -17,21 +17,19 @@
     under the License.
 */
 
-/* jshint sub:true */
-
-var fs = require('fs'),
-    path = require('path'),
-    shell = require('shelljs'),
-    util = require('../util'),
-    CordovaError = require('cordova-common').CordovaError,
-    Q = require('q'),
-    Parser = require('./parser');
-
-function dirExists(dir) {
+var fs = require('fs');
+var path = require('path');
+var shell = require('shelljs');
+var util = require('../util');
+var CordovaError = require('cordova-common').CordovaError;
+var Q = require('q');
+var Parser = require('./parser');
+
+function dirExists (dir) {
     return fs.existsSync(dir) && fs.statSync(dir).isDirectory();
 }
 
-function browser_parser(project) {
+function browser_parser (project) {
     if (!module.exports.dirExists(project) || !module.exports.dirExists(path.join(project, 'cordova'))) {
         throw new CordovaError('The provided path "' + project + '" is not a valid browser project.');
     }
@@ -47,27 +45,27 @@ require('util').inherits(browser_parser, Parser);
 module.exports = browser_parser;
 
 // Returns a promise.
-browser_parser.prototype.update_from_config = function() {
+browser_parser.prototype.update_from_config = function () {
     return Q();
 };
 
-browser_parser.prototype.www_dir = function() {
+browser_parser.prototype.www_dir = function () {
     return path.join(this.path, 'www');
 };
 
 // Used for creating platform_www in projects created by older versions.
-browser_parser.prototype.cordovajs_path = function(libDir) {
+browser_parser.prototype.cordovajs_path = function (libDir) {
     var jsPath = path.join(libDir, 'cordova-lib', 'cordova.js');
     return path.resolve(jsPath);
 };
 
-browser_parser.prototype.cordovajs_src_path = function(libDir) {
+browser_parser.prototype.cordovajs_src_path = function (libDir) {
     var jsPath = path.join(libDir, 'cordova-js-src');
     return path.resolve(jsPath);
 };
 
 // Replace the www dir with contents of platform_www and app www.
-browser_parser.prototype.update_www = function() {
+browser_parser.prototype.update_www = function () {
     var projectRoot = util.isCordova(this.path);
     var app_www = util.projectWww(projectRoot);
     var platform_www = path.join(this.path, 'platform_www');
@@ -81,23 +79,23 @@ browser_parser.prototype.update_www = function() {
     shell.cp('-rf', path.join(platform_www, '*'), this.www_dir());
 };
 
-browser_parser.prototype.update_overrides = function() {
+browser_parser.prototype.update_overrides = function () {
     var projectRoot = util.isCordova(this.path);
     var mergesPath = path.join(util.appDir(projectRoot), 'merges', 'browser');
-    if(fs.existsSync(mergesPath)) {
+    if (fs.existsSync(mergesPath)) {
         var overrides = path.join(mergesPath, '*');
         shell.cp('-rf', overrides, this.www_dir());
     }
 };
 
-browser_parser.prototype.config_xml = function(){
+browser_parser.prototype.config_xml = function () {
     return path.join(this.path, 'config.xml');
 };
 
 // Returns a promise.
-browser_parser.prototype.update_project = function(cfg) {
+browser_parser.prototype.update_project = function (cfg) {
     return this.update_from_config()
-        .then(function(){
+        .then(function () {
             this.update_overrides();
             util.deleteSvnFolders(this.www_dir());
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/metadata/parser.js
----------------------------------------------------------------------
diff --git a/src/cordova/metadata/parser.js b/src/cordova/metadata/parser.js
index a1c5bc4..d1abd68 100644
--- a/src/cordova/metadata/parser.js
+++ b/src/cordova/metadata/parser.js
@@ -17,8 +17,6 @@
     under the License.
 */
 
-/* jshint sub:true */
-
 'use strict';
 
 var ParserHelper = require('./parserhelper/ParserHelper');

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/metadata/parserhelper/ParserHelper.js
----------------------------------------------------------------------
diff --git a/src/cordova/metadata/parserhelper/ParserHelper.js b/src/cordova/metadata/parserhelper/ParserHelper.js
index efb3641..e061ba6 100644
--- a/src/cordova/metadata/parserhelper/ParserHelper.js
+++ b/src/cordova/metadata/parserhelper/ParserHelper.js
@@ -17,8 +17,6 @@
     under the License.
 */
 
-/* jshint sub:true */
-
 'use strict';
 
 var extend = require('underscore').extend;
@@ -29,7 +27,7 @@ var preferences = require('./preferences');
  *
  * @param {String} [platform] Platform name (e.g. android)
  */
-function ParserHelper(platform) {
+function ParserHelper (platform) {
     this.platform = platform || '';
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/metadata/parserhelper/preferences.js
----------------------------------------------------------------------
diff --git a/src/cordova/metadata/parserhelper/preferences.js b/src/cordova/metadata/parserhelper/preferences.js
index 54920ff..a9e9627 100644
--- a/src/cordova/metadata/parserhelper/preferences.js
+++ b/src/cordova/metadata/parserhelper/preferences.js
@@ -17,8 +17,6 @@
     under the License.
 */
 
-/* jshint sub:true */
-
 'use strict';
 
 var events = require('cordova-common').events;
@@ -32,21 +30,21 @@ var _ORIENTATION_LANDSCAPE = 'landscape';
 var _ORIENTATION_GLOBAL_ORIENTATIONS = [ _ORIENTATION_DEFAULT, _ORIENTATION_PORTRAIT, _ORIENTATION_LANDSCAPE ];
 
 var _ORIENTATION_SPECIFIC_TO_A_PLATFORM_ORIENTATIONS = {
-    'ios' : [ _ORIENTATION_ALL ],
-    'android' : [ _ORIENTATION_SENSOR_LANDSCAPE ]
+    'ios': [ _ORIENTATION_ALL ],
+    'android': [ _ORIENTATION_SENSOR_LANDSCAPE ]
 };
 
 module.exports = {
 
-    // Specific to a platform 
+    // Specific to a platform
     ORIENTATION_ALL: _ORIENTATION_ALL, // iOS
-    ORIENTATION_SENSOR_LANDSCAPE : _ORIENTATION_SENSOR_LANDSCAPE, // Android
-    
+    ORIENTATION_SENSOR_LANDSCAPE: _ORIENTATION_SENSOR_LANDSCAPE, // Android
+
     // Global
     ORIENTATION_DEFAULT: _ORIENTATION_DEFAULT,
     ORIENTATION_PORTRAIT: _ORIENTATION_PORTRAIT,
     ORIENTATION_LANDSCAPE: _ORIENTATION_LANDSCAPE,
-    
+
     // Collections
     ORIENTATION_GLOBAL_ORIENTATIONS: _ORIENTATION_GLOBAL_ORIENTATIONS,
     ORIENTATION_SPECIFIC_TO_A_PLATFORM_ORIENTATIONS: _ORIENTATION_SPECIFIC_TO_A_PLATFORM_ORIENTATIONS,
@@ -75,11 +73,11 @@ module.exports = {
      */
     isOrientationSpecificToAPlatform: function (orientation, platform) {
         var platformArray = this.ORIENTATION_SPECIFIC_TO_A_PLATFORM_ORIENTATIONS[ platform ];
-        
+
         if (!platformArray) {
             return false;
-        } 
-        
+        }
+
         return platformArray.some(function (supportedOrientation) {
             return orientation.toLowerCase() === supportedOrientation.toLowerCase();
         });
@@ -105,8 +103,8 @@ module.exports = {
 
         // Check if the given global orientation is supported, or if the orientation is supported for a platform
         if ((globalOrientation && !this.isGlobalOrientation(globalOrientation)) && !this.isOrientationSpecificToAPlatform(globalOrientation, platform)) {
-            events.emit( 'warn', [ 'Unsupported global orientation:', globalOrientation ].join(' ') );
-            events.emit( 'warn', [ 'Defaulting to value:', this.ORIENTATION_DEFAULT ].join(' ') );
+            events.emit('warn', [ 'Unsupported global orientation:', globalOrientation ].join(' '));
+            events.emit('warn', [ 'Defaulting to value:', this.ORIENTATION_DEFAULT ].join(' '));
             globalOrientation = this.ORIENTATION_DEFAULT;
         }
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/metadata/ubuntu_parser.js
----------------------------------------------------------------------
diff --git a/src/cordova/metadata/ubuntu_parser.js b/src/cordova/metadata/ubuntu_parser.js
index 429f144..1313f87 100644
--- a/src/cordova/metadata/ubuntu_parser.js
+++ b/src/cordova/metadata/ubuntu_parser.js
@@ -17,18 +17,16 @@
  *
 */
 
-/* jshint sub:true */
+var fs = require('fs');
+var path = require('path');
+var util = require('../util');
+var shell = require('shelljs');
+var Q = require('q');
+var Parser = require('./parser');
+var os = require('os');
+var ConfigParser = require('cordova-common').ConfigParser;
 
-var fs            = require('fs'),
-    path          = require('path'),
-    util          = require('../util'),
-    shell         = require('shelljs'),
-    Q             = require('q'),
-    Parser        = require('./parser'),
-    os            = require('os'),
-    ConfigParser = require('cordova-common').ConfigParser;
-
-function ubuntu_parser(project) {
+function ubuntu_parser (project) {
 
     // Call the base class constructor
     Parser.call(this, 'ubuntu', project);
@@ -38,7 +36,7 @@ function ubuntu_parser(project) {
     this.update_manifest();
 }
 
-function sanitize(str) {
+function sanitize (str) {
     return str.replace(/\n/g, ' ').replace(/^\s+|\s+$/g, '');
 }
 
@@ -46,7 +44,7 @@ require('util').inherits(ubuntu_parser, Parser);
 
 module.exports = ubuntu_parser;
 
-ubuntu_parser.prototype.update_from_config = function(config) {
+ubuntu_parser.prototype.update_from_config = function (config) {
     if (config instanceof ConfigParser) {
     } else {
         return Q.reject(new Error('update_from_config requires a ConfigParser object'));
@@ -63,48 +61,41 @@ ubuntu_parser.prototype.update_from_config = function(config) {
     return this.update_manifest();
 };
 
-ubuntu_parser.prototype.cordovajs_path = function(libDir) {
+ubuntu_parser.prototype.cordovajs_path = function (libDir) {
     var jsPath = path.join(libDir, 'www', 'cordova.js');
     return path.resolve(jsPath);
 };
 
-ubuntu_parser.prototype.cordovajs_src_path = function(libDir) {
+ubuntu_parser.prototype.cordovajs_src_path = function (libDir) {
     var jsPath = path.join(libDir, 'cordova-js-src');
     return path.resolve(jsPath);
 };
 
-ubuntu_parser.prototype.update_manifest = function() {
+ubuntu_parser.prototype.update_manifest = function () {
     var nodearch2debarch = { 'arm': 'armhf',
-                             'ia32': 'i386',
-                             'x64': 'amd64'};
+        'ia32': 'i386',
+        'x64': 'amd64'};
     var arch;
-    if (os.arch() in nodearch2debarch)
-        arch = nodearch2debarch[os.arch()];
-    else
-        return Q.reject(new Error('unknown cpu arch'));
+    if (os.arch() in nodearch2debarch) { arch = nodearch2debarch[os.arch()]; } else { return Q.reject(new Error('unknown cpu arch')); }
 
-    if (!this.config.author())
-        return Q.reject(new Error('config.xml should contain author'));
+    if (!this.config.author()) { return Q.reject(new Error('config.xml should contain author')); }
 
     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 + '>',
-                     architecture: arch,
-                     description: sanitize(this.config.description()) };
-
-    var name = sanitize(this.config.name()); //FIXME: escaping
+        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 + '>',
+        architecture: arch,
+        description: sanitize(this.config.description()) };
+
+    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';
 
     if (this.config.doc.find('icon') && this.config.doc.find('icon').attrib.src) {
         var iconPath = path.join(this.path, '../..', this.config.doc.find('icon').attrib.src);
-        if (fs.existsSync(iconPath))
-            content += '\nIcon=' + this.config.doc.find('icon').attrib.src;
-        else
-            return Q.reject(new Error('icon does not exist: ' + iconPath));
+        if (fs.existsSync(iconPath)) { content += '\nIcon=' + this.config.doc.find('icon').attrib.src; } else { return Q.reject(new Error('icon does not exist: ' + iconPath)); }
     } else {
         content += '\nIcon=qmlscene';
         console.warn('missing icon element in config.xml');
@@ -115,8 +106,7 @@ ubuntu_parser.prototype.update_manifest = function() {
     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)
-            policy.policy_groups.push(element.attrib.policy_group);
+        if (element.attrib.policy_group && policy.policy_groups.indexOf(element.attrib.policy_group) === -1) { policy.policy_groups.push(element.attrib.policy_group); }
     });
 
     fs.writeFileSync(path.join(this.path, 'apparmor.json'), JSON.stringify(policy));
@@ -124,15 +114,15 @@ ubuntu_parser.prototype.update_manifest = function() {
     return Q();
 };
 
-ubuntu_parser.prototype.config_xml = function(){
+ubuntu_parser.prototype.config_xml = function () {
     return path.join(this.path, 'config.xml');
 };
 
-ubuntu_parser.prototype.www_dir = function() {
+ubuntu_parser.prototype.www_dir = function () {
     return path.join(this.path, 'www');
 };
 
-ubuntu_parser.prototype.update_www = function() {
+ubuntu_parser.prototype.update_www = function () {
     var projectRoot = util.isCordova(this.path);
     var www = util.projectWww(projectRoot);
 
@@ -140,22 +130,22 @@ ubuntu_parser.prototype.update_www = function() {
     shell.cp('-rf', www, this.path);
 };
 
-ubuntu_parser.prototype.update_overrides = function() {
+ubuntu_parser.prototype.update_overrides = function () {
     var projectRoot = util.isCordova(this.path);
     var mergesPath = path.join(util.appDir(projectRoot), 'merges', 'ubuntu');
-    if(fs.existsSync(mergesPath)) {
+    if (fs.existsSync(mergesPath)) {
         var overrides = path.join(mergesPath, '*');
         shell.cp('-rf', overrides, this.www_dir());
     }
 };
 
 // Returns a promise.
-ubuntu_parser.prototype.update_project = function(cfg) {
+ubuntu_parser.prototype.update_project = function (cfg) {
     var self = this;
 
     return this.update_from_config(cfg)
-    .then(function() {
-        self.update_overrides();
-        util.deleteSvnFolders(self.www_dir());
-    });
+        .then(function () {
+            self.update_overrides();
+            util.deleteSvnFolders(self.www_dir());
+        });
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/metadata/webos_parser.js
----------------------------------------------------------------------
diff --git a/src/cordova/metadata/webos_parser.js b/src/cordova/metadata/webos_parser.js
index fc57287..64d776f 100755
--- a/src/cordova/metadata/webos_parser.js
+++ b/src/cordova/metadata/webos_parser.js
@@ -17,19 +17,14 @@
     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'),
-    util = require('../util'),
-    Q = require('q'),
-    Parser = require('./parser');
-
-function webos_parser(project) {
+var fs = require('fs');
+var path = require('path');
+var shell = require('shelljs');
+var util = require('../util');
+var Q = require('q');
+var Parser = require('./parser');
+
+function webos_parser (project) {
     // Call the base class constructor
     Parser.call(this, 'webos', project);
     this.path = project;
@@ -40,10 +35,10 @@ require('util').inherits(webos_parser, Parser);
 module.exports = webos_parser;
 
 // Returns a promise.
-webos_parser.prototype.update_from_config = function(config) {
+webos_parser.prototype.update_from_config = function (config) {
     var www = this.www_dir();
     var manifestPath = path.join(www, 'appinfo.json');
-    var manifest = {type: 'web', uiRevision:2};
+    var manifest = {type: 'web', uiRevision: 2};
 
     // Load existing manifest
     if (fs.existsSync(manifestPath)) {
@@ -53,12 +48,12 @@ webos_parser.prototype.update_from_config = function(config) {
     // overwrite properties existing in config.xml
     manifest.id = config.packageName() || 'org.apache.cordova.example';
     var contentNode = config.doc.find('content');
-    var contentSrc = contentNode && contentNode.attrib['src'] || 'index.html';
+    var contentSrc = (contentNode && contentNode.attrib['src']) || ('index.html');
     manifest.main = contentSrc;
     manifest.version = config.version() || '0.0.1';
     manifest.title = config.name() || 'CordovaExample';
-    manifest.appDescription = config.description() || '';
-    manifest.vendor = config.author() || 'My Company';
+    manifest.appDescription = (config.description()) || ('');
+    manifest.vendor = (config.author()) || ('My Company');
 
     var authorNode = config.doc.find('author');
     var authorUrl = authorNode && authorNode.attrib['href'];
@@ -67,10 +62,10 @@ webos_parser.prototype.update_from_config = function(config) {
     }
 
     var projectRoot = util.isCordova(this.path);
-    var copyImg = function(src, type) {
+    var copyImg = function (src, type) {
         var index = src.indexOf('www');
-        if(index===0 || index===1) {
-            return src.substring(index+4);
+        if (index === 0 || index === 1) {
+            return src.substring(index + 4);
         } else {
             var newSrc = type + '.png';
             shell.cp('-f', path.join(projectRoot, src), path.join(www, newSrc));
@@ -81,13 +76,13 @@ webos_parser.prototype.update_from_config = function(config) {
     var icons = config.getIcons('webos');
     // if there are icon elements in config.xml
     if (icons) {
-        var setIcon = function(type, size) {
+        var setIcon = function (type, size) {
             var item = icons.getBySize(size, size);
-            if(item && item.src) {
+            if (item && item.src) {
                 manifest[type] = copyImg(item.src, type);
             } else {
                 item = icons.getDefault();
-                if(item && item.src) {
+                if (item && item.src) {
                     manifest[type] = copyImg(item.src, type);
                 }
             }
@@ -100,7 +95,7 @@ webos_parser.prototype.update_from_config = function(config) {
     // if there are icon elements in config.xml
     if (splash) {
         var splashImg = splash.getBySize(1920, 1080);
-        if(splashImg && splashImg.src) {
+        if (splashImg && splashImg.src) {
             manifest.splashBackground = copyImg(splashImg.src, 'splash');
         }
     }
@@ -110,23 +105,23 @@ webos_parser.prototype.update_from_config = function(config) {
     return Q();
 };
 
-webos_parser.prototype.www_dir = function() {
+webos_parser.prototype.www_dir = function () {
     return path.join(this.path, 'www');
 };
 
 // Used for creating platform_www in projects created by older versions.
-webos_parser.prototype.cordovajs_path = function(libDir) {
+webos_parser.prototype.cordovajs_path = function (libDir) {
     var jsPath = path.join(libDir, 'cordova-lib', 'cordova.js');
     return path.resolve(jsPath);
 };
 
-webos_parser.prototype.cordovajs_src_path = function(libDir) {
+webos_parser.prototype.cordovajs_src_path = function (libDir) {
     var jsPath = path.join(libDir, 'cordova-js-src');
     return path.resolve(jsPath);
 };
 
 // Replace the www dir with contents of platform_www and app www.
-webos_parser.prototype.update_www = function() {
+webos_parser.prototype.update_www = function () {
     var projectRoot = util.isCordova(this.path);
     var app_www = util.projectWww(projectRoot);
     var platform_www = path.join(this.path, 'platform_www');
@@ -135,19 +130,19 @@ webos_parser.prototype.update_www = function() {
     shell.rm('-rf', this.www_dir());
     shell.mkdir(this.www_dir());
     // Copy over all app www assets
-    if(fs.lstatSync(app_www).isSymbolicLink()) {
+    if (fs.lstatSync(app_www).isSymbolicLink()) {
         var real_www = fs.realpathSync(app_www);
-        if(fs.existsSync(path.join(real_www, 'build/enyo.js'))) {
+        if (fs.existsSync(path.join(real_www, 'build/enyo.js'))) {
             // symlinked Enyo bootplate; resolve to bootplate root for
             // ares-webos-sdk to handle the minification
-            if(fs.existsSync(path.join(real_www, '../enyo'))) {
+            if (fs.existsSync(path.join(real_www, '../enyo'))) {
                 app_www = path.join(real_www, '..');
             } else if (fs.existsSync(path.join(real_www, '../../enyo'))) {
                 app_www = path.join(real_www, '../..');
             }
-            //double check existence of deploy
-            if(!fs.existsSync(path.join(app_www, 'deploy'))) {
-                app_www = real_www; //fallback
+            // double check existence of deploy
+            if (!fs.existsSync(path.join(app_www, 'deploy'))) {
+                app_www = real_www; // fallback
             }
         }
     }
@@ -157,54 +152,52 @@ webos_parser.prototype.update_www = function() {
 
     // prepare and update deploy.json for cordova components
     var deploy = path.join(this.www_dir(), 'deploy.json');
-    if(fs.existsSync(deploy)) {
+    if (fs.existsSync(deploy)) {
         try {
             // make stub file entries to guarantee the dir/files are there
             shell.mkdir('-p', path.join(this.www_dir(), 'plugins'));
             var pluginFile = path.join(this.www_dir(), 'cordova_plugins.js');
-            if(!fs.existsSync(pluginFile)) {
+            if (!fs.existsSync(pluginFile)) {
                 fs.writeFileSync(pluginFile, '');
             }
             // add to json if not already there, so they don't get minified out during build
-            var obj = JSON.parse(fs.readFileSync(deploy, {encoding:'utf8'}));
+            var obj = JSON.parse(fs.readFileSync(deploy, {encoding: 'utf8'}));
             obj.assets = obj.assets || [];
             var assets = ['plugins', 'cordova.js', 'cordova_plugins.js'];
-            for(var i=0; i<assets.length; i++) {
+            for (var i = 0; i < assets.length; i++) {
                 var index = obj.assets.indexOf(assets[i]);
-                if(index<0) {
+                if (index < 0) {
                     index = obj.assets.indexOf('./' + assets[i]);
                 }
-                if(index<0) {
+                if (index < 0) {
                     obj.assets.push('./' + assets[i]);
                 }
                 fs.writeFileSync(deploy, JSON.stringify(obj, null, 2));
             }
-        } catch(e) {
+        } catch (e) {
             console.error('Unable to update deploy.json: ' + e);
         }
     }
 };
 
-webos_parser.prototype.update_overrides = function() {
+webos_parser.prototype.update_overrides = function () {
     var projectRoot = util.isCordova(this.path);
     var mergesPath = path.join(util.appDir(projectRoot), 'merges', 'webosos');
-    if(fs.existsSync(mergesPath)) {
+    if (fs.existsSync(mergesPath)) {
         var overrides = path.join(mergesPath, '*');
         shell.cp('-rf', overrides, this.www_dir());
     }
 };
 
-webos_parser.prototype.config_xml = function(){
+webos_parser.prototype.config_xml = function () {
     return path.join(this.path, 'config.xml');
 };
 
 // Returns a promise.
-webos_parser.prototype.update_project = function(cfg) {
+webos_parser.prototype.update_project = function (cfg) {
     return this.update_from_config(cfg)
-        .then(function(){
+        .then(function () {
             this.update_overrides();
             util.deleteSvnFolders(this.www_dir());
         }.bind(this));
 };
-
-

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/platform/addHelper.js
----------------------------------------------------------------------
diff --git a/src/cordova/platform/addHelper.js b/src/cordova/platform/addHelper.js
index b439cd2..adfb33f 100644
--- a/src/cordova/platform/addHelper.js
+++ b/src/cordova/platform/addHelper.js
@@ -27,8 +27,8 @@ var ConfigParser = require('cordova-common').ConfigParser;
 var PlatformJson = require('cordova-common').PlatformJson;
 var events = require('cordova-common').events;
 var cordova_util = require('../util');
-//delete require.cache[require.resolve('../prepare')];
-//var prepare = require('../prepare');
+// delete require.cache[require.resolve('../prepare')];
+// var prepare = require('../prepare');
 var promiseutil = require('../../util/promise-util');
 var config = require('../config');
 var lazy_load = require('../lazy_load');
@@ -69,211 +69,211 @@ function addHelper (cmd, hooksRunner, projectRoot, targets, opts) {
     shell.mkdir('-p', platformsDir);
 
     return hooksRunner.fire('before_platform_' + cmd, opts)
-    .then(function () {
-        var platformsToSave = [];
-
-        return promiseutil.Q_chainmap(targets, function (target) {
-            // For each platform, download it and call its helper script.
-            var pkgJson;
-            var platform;
-            var spec;
-            var parts = target.split('@');
-            if (parts.length > 1 && parts[0] === '') {
-                // scoped package
-                platform = '@' + parts[1];
-                spec = parts[2];
-            } else {
-                platform = parts[0];
-                spec = parts[1];
-            }
-            return Q.when().then(function () {
-                // if platform is a local path or url, it should be assigned
-                // to spec
-                if (cordova_util.isDirectory(path.resolve(platform)) ||
-                    cordova_util.isUrl(platform)) {
-                    spec = platform;
-                    platform = null;
+        .then(function () {
+            var platformsToSave = [];
+
+            return promiseutil.Q_chainmap(targets, function (target) {
+                // For each platform, download it and call its helper script.
+                var pkgJson;
+                var platform;
+                var spec;
+                var parts = target.split('@');
+                if (parts.length > 1 && parts[0] === '') {
+                    // scoped package
+                    platform = '@' + parts[1];
+                    spec = parts[2];
+                } else {
+                    platform = parts[0];
+                    spec = parts[1];
                 }
+                return Q.when().then(function () {
+                    // if platform is a local path or url, it should be assigned
+                    // to spec
+                    if (cordova_util.isDirectory(path.resolve(platform)) ||
+                        cordova_util.isUrl(platform)) {
+                        spec = platform;
+                        platform = null;
+                    }
 
-                if (platform === 'ubuntu' || platform === 'blackberry10') {
-                    events.emit(platform + ' has been deprecated and will be removed in the next major release of cordova.');
-                }
+                    if (platform === 'ubuntu' || platform === 'blackberry10') {
+                        events.emit(platform + ' has been deprecated and will be removed in the next major release of cordova.');
+                    }
 
-                if (fs.existsSync(path.join(projectRoot, 'package.json'))) {
-                    pkgJson = cordova_util.requireNoCache(path.join(projectRoot, 'package.json'));
-                }
+                    if (fs.existsSync(path.join(projectRoot, 'package.json'))) {
+                        pkgJson = cordova_util.requireNoCache(path.join(projectRoot, 'package.json'));
+                    }
 
-                // If there is no spec specified, try to get spec from package.json
-                // else, if there is no spec specified, try to get spec from config.xml
-                if (spec === undefined && pkgJson && pkgJson.dependencies && cmd === 'add') {
-                    if (pkgJson.dependencies['cordova-' + platform]) {
-                        spec = pkgJson.dependencies['cordova-' + platform];
-                    } else if (pkgJson.dependencies[platform]) {
-                        spec = pkgJson.dependencies[platform];
+                    // If there is no spec specified, try to get spec from package.json
+                    // else, if there is no spec specified, try to get spec from config.xml
+                    if (spec === undefined && pkgJson && pkgJson.dependencies && cmd === 'add') {
+                        if (pkgJson.dependencies['cordova-' + platform]) {
+                            spec = pkgJson.dependencies['cordova-' + platform];
+                        } else if (pkgJson.dependencies[platform]) {
+                            spec = pkgJson.dependencies[platform];
+                        }
+                    } else if (platform && spec === undefined && cmd === 'add') {
+                        events.emit('verbose', 'No version supplied. Retrieving version from config.xml...');
+                        spec = module.exports.getVersionFromConfigFile(platform, cfg);
                     }
-                } else if (platform && spec === undefined && cmd === 'add') {
-                    events.emit('verbose', 'No version supplied. Retrieving version from config.xml...');
-                    spec = module.exports.getVersionFromConfigFile(platform, cfg);
-                }
 
-                // If spec still doesn't exist, try to use pinned version
-                if (!spec && platforms[platform]) {
-                    events.emit('verbose', 'Grabbing pinned version.');
-                    spec = platforms[platform].version;
-                }
+                    // If spec still doesn't exist, try to use pinned version
+                    if (!spec && platforms[platform]) {
+                        events.emit('verbose', 'Grabbing pinned version.');
+                        spec = platforms[platform].version;
+                    }
 
-                // Handle local paths
-                if (spec) {
-                    var maybeDir = cordova_util.fixRelativePath(spec);
-                    if (cordova_util.isDirectory(maybeDir)) {
-                        if (opts.fetch) {
-                            return fetch(path.resolve(maybeDir), projectRoot, opts)
-                            .then(function (directory) {
-                                return require('./index').getPlatformDetailsFromDir(directory, platform);
-                            });
-                        } else {
-                            return require('./index').getPlatformDetailsFromDir(maybeDir, platform);
+                    // Handle local paths
+                    if (spec) {
+                        var maybeDir = cordova_util.fixRelativePath(spec);
+                        if (cordova_util.isDirectory(maybeDir)) {
+                            if (opts.fetch) {
+                                return fetch(path.resolve(maybeDir), projectRoot, opts)
+                                    .then(function (directory) {
+                                        return require('./index').getPlatformDetailsFromDir(directory, platform);
+                                    });
+                            } else {
+                                return require('./index').getPlatformDetailsFromDir(maybeDir, platform);
+                            }
                         }
                     }
-                }
-                return module.exports.downloadPlatform(projectRoot, platform, spec, opts);
-            }).then(function (platDetails) {
-                platform = platDetails.platform;
-                var platformPath = path.join(projectRoot, 'platforms', platform);
-                var platformAlreadyAdded = fs.existsSync(platformPath);
-
-                if (cmd === 'add') {
-                    // TODO: Can we check for this before downloading the platform?
-                    if (platformAlreadyAdded) {
-                        throw new CordovaError('Platform ' + platform + ' already added.');
+                    return module.exports.downloadPlatform(projectRoot, platform, spec, opts);
+                }).then(function (platDetails) {
+                    platform = platDetails.platform;
+                    var platformPath = path.join(projectRoot, 'platforms', platform);
+                    var platformAlreadyAdded = fs.existsSync(platformPath);
+
+                    if (cmd === 'add') {
+                        // TODO: Can we check for this before downloading the platform?
+                        if (platformAlreadyAdded) {
+                            throw new CordovaError('Platform ' + platform + ' already added.');
+                        }
+
+                        // Remove the <platform>.json file from the plugins directory, so we start clean (otherwise we
+                        // can get into trouble not installing plugins if someone deletes the platform folder but
+                        // <platform>.json still exists).
+                        cordova_util.removePlatformPluginsJson(projectRoot, target);
+                    } else if (cmd === 'update') {
+                        // TODO: can we check for this before downloading the platform?
+                        if (!platformAlreadyAdded) {
+                            throw new CordovaError('Platform "' + platform + '" is not yet added. See `' +
+                                cordova_util.binname + ' platform list`.');
+                        }
                     }
 
-                    // Remove the <platform>.json file from the plugins directory, so we start clean (otherwise we
-                    // can get into trouble not installing plugins if someone deletes the platform folder but
-                    // <platform>.json still exists).
-                    cordova_util.removePlatformPluginsJson(projectRoot, target);
-                } else if (cmd === 'update') {
-                    // TODO: can we check for this before downloading the platform?
-                    if (!platformAlreadyAdded) {
-                        throw new CordovaError('Platform "' + platform + '" is not yet added. See `' +
-                            cordova_util.binname + ' platform list`.');
+                    if (/-nightly|-dev$/.exec(platDetails.version)) {
+                        msg = 'Warning: using prerelease platform ' + platform +
+                              '@' + platDetails.version +
+                              '.\nUse \'cordova platform add ' +
+                              platform + '@latest\' to add the latest published version instead.';
+                        events.emit('warn', msg);
                     }
-                }
 
-                if (/-nightly|-dev$/.exec(platDetails.version)) {
-                    msg = 'Warning: using prerelease platform ' + platform +
-                          '@' + platDetails.version +
-                          '.\nUse \'cordova platform add ' +
-                          platform + '@latest\' to add the latest published version instead.';
-                    events.emit('warn', msg);
-                }
+                    // TODO: NIT: can we rename this to platformapi options so as to not confuse with addHelper options?
+                    var options = {
+                        // We need to pass a platformDetails into update/create
+                        // since PlatformApiPoly needs to know something about
+                        // platform, it is going to create.
+                        platformDetails: platDetails,
+                        link: opts.link
+                    };
+
+                    if (config_json && config_json.lib && config_json.lib[platform] &&
+                        config_json.lib[platform].template) {
+                        options.customTemplate = config_json.lib[platform].template;
+                    }
 
-                // TODO: NIT: can we rename this to platformapi options so as to not confuse with addHelper options?
-                var options = {
-                    // We need to pass a platformDetails into update/create
-                    // since PlatformApiPoly needs to know something about
-                    // platform, it is going to create.
-                    platformDetails: platDetails,
-                    link: opts.link
-                };
-
-                if (config_json && config_json.lib && config_json.lib[platform] &&
-                    config_json.lib[platform].template) {
-                    options.customTemplate = config_json.lib[platform].template;
+                    events.emit('log', (cmd === 'add' ? 'Adding ' : 'Updating ') + platform + ' project...');
+                    var PlatformApi = cordova_util.getPlatformApiFunction(platDetails.libDir, platform);
+                    var destination = path.resolve(projectRoot, 'platforms', platform);
+                    var promise = cmd === 'add' ? PlatformApi.createPlatform.bind(null, destination, cfg, options, events)
+                        : PlatformApi.updatePlatform.bind(null, destination, options, events);
+                    // TODO: if we return the promise immediately, can we not unindent the promise .then()s by one indent?
+                    return promise()
+                        .then(function () {
+                            if (!opts.restoring) {
+                                return require('../prepare').preparePlatforms([platform], projectRoot, { searchpath: opts.searchpath });
+                            }
+                        })
+                        .then(function () {
+                            if (cmd === 'add') {
+                                return module.exports.installPluginsForNewPlatform(platform, projectRoot, opts);
+                            }
+                        })
+                        .then(function () {
+                            // TODO: didnt we just do this two promise then's ago?
+                            if (!opts.restoring) {
+                                // Call prepare for the current platform if we're not restoring from config.xml.
+                                var prepOpts = {
+                                    platforms: [platform],
+                                    searchpath: opts.searchpath,
+                                    fetch: opts.fetch || false,
+                                    save: opts.save || false
+                                };
+                                // delete require.cache[require.resolve('../cordova')]
+                                return require('../prepare')(prepOpts);
+                            }
+                        })
+                        .then(function () {
+                            var saveVersion = !spec || semver.validRange(spec, true);
+                            // Save platform@spec into platforms.json, where 'spec' is a version or a soure location. If a
+                            // source location was specified, we always save that. Otherwise we save the version that was
+                            // actually installed.
+                            var versionToSave = saveVersion ? platDetails.version : spec;
+                            events.emit('verbose', 'Saving ' + platform + '@' + versionToSave + ' into platforms.json');
+                            platformMetadata.save(projectRoot, platform, versionToSave);
+
+                            if (opts.save || autosave) {
+                                // Similarly here, we save the source location if that was specified, otherwise the version that
+                                // was installed. However, we save it with the "~" attribute (this allows for patch updates).
+                                spec = saveVersion ? '~' + platDetails.version : spec;
+
+                                // Save target into config.xml, overriding already existing settings.
+                                events.emit('log', '--save flag or autosave detected');
+                                events.emit('log', 'Saving ' + platform + '@' + spec + ' into config.xml file ...');
+                                cfg.removeEngine(platform);
+                                cfg.addEngine(platform, spec);
+                                cfg.write();
+
+                                // Save to add to pacakge.json's cordova.platforms array in the next then.
+                                platformsToSave.push(platform);
+                            }
+                        });
+                });
+            }).then(function () {
+                // save installed platforms to cordova.platforms array in package.json
+                var pkgJson;
+                var pkgJsonPath = path.join(projectRoot, 'package.json');
+                var modifiedPkgJson = false;
+
+                if (fs.existsSync(pkgJsonPath)) {
+                    pkgJson = cordova_util.requireNoCache(path.join(pkgJsonPath));
                 }
 
-                events.emit('log', (cmd === 'add' ? 'Adding ' : 'Updating ') + platform + ' project...');
-                var PlatformApi = cordova_util.getPlatformApiFunction(platDetails.libDir, platform);
-                var destination = path.resolve(projectRoot, 'platforms', platform);
-                var promise = cmd === 'add' ? PlatformApi.createPlatform.bind(null, destination, cfg, options, events)
-                    : PlatformApi.updatePlatform.bind(null, destination, options, events);
-                // TODO: if we return the promise immediately, can we not unindent the promise .then()s by one indent?
-                return promise()
-                .then(function () {
-                    if (!opts.restoring) {
-                        return require('../prepare').preparePlatforms([platform], projectRoot, { searchpath: opts.searchpath });
-                    }
-                })
-                .then(function () {
-                    if (cmd === 'add') {
-                        return module.exports.installPluginsForNewPlatform(platform, projectRoot, opts);
-                    }
-                })
-                .then(function () {
-                    // TODO: didnt we just do this two promise then's ago?
-                    if (!opts.restoring) {
-                        // Call prepare for the current platform if we're not restoring from config.xml.
-                        var prepOpts = {
-                            platforms: [platform],
-                            searchpath: opts.searchpath,
-                            fetch: opts.fetch || false,
-                            save: opts.save || false
-                        };
-                        //delete require.cache[require.resolve('../cordova')]
-                        return require('../prepare')(prepOpts);
-                    }
-                })
-                .then(function () {
-                    var saveVersion = !spec || semver.validRange(spec, true);
-                    // Save platform@spec into platforms.json, where 'spec' is a version or a soure location. If a
-                    // source location was specified, we always save that. Otherwise we save the version that was
-                    // actually installed.
-                    var versionToSave = saveVersion ? platDetails.version : spec;
-                    events.emit('verbose', 'Saving ' + platform + '@' + versionToSave + ' into platforms.json');
-                    platformMetadata.save(projectRoot, platform, versionToSave);
-
-                    if (opts.save || autosave) {
-                        // Similarly here, we save the source location if that was specified, otherwise the version that
-                        // was installed. However, we save it with the "~" attribute (this allows for patch updates).
-                        spec = saveVersion ? '~' + platDetails.version : spec;
-
-                        // Save target into config.xml, overriding already existing settings.
-                        events.emit('log', '--save flag or autosave detected');
-                        events.emit('log', 'Saving ' + platform + '@' + spec + ' into config.xml file ...');
-                        cfg.removeEngine(platform);
-                        cfg.addEngine(platform, spec);
-                        cfg.write();
-
-                        // Save to add to pacakge.json's cordova.platforms array in the next then.
-                        platformsToSave.push(platform);
+                if (pkgJson === undefined) {
+                    return;
+                }
+                if (pkgJson.cordova === undefined) {
+                    pkgJson.cordova = {};
+                }
+                if (pkgJson.cordova.platforms === undefined) {
+                    pkgJson.cordova.platforms = [];
+                }
+                platformsToSave.forEach(function (plat) {
+                    if (pkgJson.cordova.platforms.indexOf(plat) === -1) {
+                        events.emit('verbose', 'adding ' + plat + ' to cordova.platforms array in package.json');
+                        pkgJson.cordova.platforms.push(plat);
+                        modifiedPkgJson = true;
                     }
                 });
-            });
-        }).then(function () {
-            // save installed platforms to cordova.platforms array in package.json
-            var pkgJson;
-            var pkgJsonPath = path.join(projectRoot, 'package.json');
-            var modifiedPkgJson = false;
-
-            if (fs.existsSync(pkgJsonPath)) {
-                pkgJson = cordova_util.requireNoCache(path.join(pkgJsonPath));
-            }
-
-            if (pkgJson === undefined) {
-                return;
-            }
-            if (pkgJson.cordova === undefined) {
-                pkgJson.cordova = {};
-            }
-            if (pkgJson.cordova.platforms === undefined) {
-                pkgJson.cordova.platforms = [];
-            }
-            platformsToSave.forEach(function (plat) {
-                if (pkgJson.cordova.platforms.indexOf(plat) === -1) {
-                    events.emit('verbose', 'adding ' + plat + ' to cordova.platforms array in package.json');
-                    pkgJson.cordova.platforms.push(plat);
-                    modifiedPkgJson = true;
+                // Save to package.json.
+                if (modifiedPkgJson === true) {
+                    pkgJson.cordova.platforms = pkgJson.cordova.platforms.sort();
+                    fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2), 'utf8');
                 }
             });
-            // Save to package.json.
-            if (modifiedPkgJson === true) {
-                pkgJson.cordova.platforms = pkgJson.cordova.platforms.sort();
-                fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2), 'utf8');
-            }
+        }).then(function () {
+            return hooksRunner.fire('after_platform_' + cmd, opts);
         });
-    }).then(function () {
-        return hooksRunner.fire('after_platform_' + cmd, opts);
-    });
 }
 
 function getVersionFromConfigFile (platform, cfg) {


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


[04/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/browserify.js
----------------------------------------------------------------------
diff --git a/src/plugman/browserify.js b/src/plugman/browserify.js
index 450edd1..1a77371 100644
--- a/src/plugman/browserify.js
+++ b/src/plugman/browserify.js
@@ -17,24 +17,22 @@
     under the License.
 */
 
-/* jshint expr:true */
-
-var path               = require('path'),
-    aliasify           = require('aliasify'),
-    common             = require('./platforms/common'),
-    fs                 = require('fs'),
-    childProcess       = require('child_process'),
-    events             = require('cordova-common').events,
-    bundle             = require('cordova-js/tasks/lib/bundle-browserify'),
-    writeLicenseHeader = require('cordova-js/tasks/lib/write-license-header'),
-    Q                  = require('q'),
-    computeCommitId    = require('cordova-js/tasks/lib/compute-commit-id'),
-    Readable           = require('stream').Readable;
+var path = require('path');
+var aliasify = require('aliasify');
+var common = require('./platforms/common');
+var fs = require('fs');
+var childProcess = require('child_process');
+var events = require('cordova-common').events;
+var bundle = require('cordova-js/tasks/lib/bundle-browserify');
+var writeLicenseHeader = require('cordova-js/tasks/lib/write-license-header');
+var Q = require('q');
+var computeCommitId = require('cordova-js/tasks/lib/compute-commit-id');
+var Readable = require('stream').Readable;
 
 var PlatformJson = require('cordova-common').PlatformJson;
 var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
 
-function generateFinalBundle(platform, libraryRelease, outReleaseFile, commitId, platformVersion) {
+function generateFinalBundle (platform, libraryRelease, outReleaseFile, commitId, platformVersion) {
     var deferred = Q.defer();
     var outReleaseFileStream = fs.createWriteStream(outReleaseFile);
     var time = new Date().valueOf();
@@ -45,33 +43,33 @@ function generateFinalBundle(platform, libraryRelease, outReleaseFile, commitId,
 
     releaseBundle.pipe(outReleaseFileStream);
 
-    outReleaseFileStream.on('finish', function() {
+    outReleaseFileStream.on('finish', function () {
         var newtime = new Date().valueOf() - time;
         events.emit('verbose', 'generated cordova.' + platform + '.js @ ' + commitId + ' in ' + newtime + 'ms');
         deferred.resolve();
         // TODO clean up all the *.browserify files
     });
 
-    outReleaseFileStream.on('error', function(err) {
+    outReleaseFileStream.on('error', function (err) {
         events.emit('warn', 'Error while generating cordova.js');
         deferred.reject(err);
     });
     return deferred.promise;
 }
 
-function computeCommitIdSync() {
+function computeCommitIdSync () {
     var deferred = Q.defer();
-    computeCommitId(function(cId){
+    computeCommitId(function (cId) {
         deferred.resolve(cId);
     });
     return deferred.promise;
 }
 
-function getPlatformVersion(cId, project_dir) {
+function getPlatformVersion (cId, project_dir) {
     var deferred = Q.defer();
-    //run version script for each platform to get platformVersion
+    // run version script for each platform to get platformVersion
     var versionPath = path.join(project_dir, '/cordova/version');
-    childProcess.exec('"' + versionPath + '"', function(err, stdout, stderr) {
+    childProcess.exec('"' + versionPath + '"', function (err, stdout, stderr) {
         if (err) {
             err.message = 'Failed to get platform version (will use \'N/A\' instead).\n' + err.message;
             events.emit('warn', err);
@@ -101,81 +99,81 @@ module.exports = function doBrowserify (project, platformApi, pluginInfoProvider
 
     var commitId;
     return computeCommitIdSync()
-    .then(function(cId){
-        commitId = cId;
-        return getPlatformVersion(commitId, platformApi.root);
-    }).then(function(platformVersion){
-        var libraryRelease = bundle(platform, false, commitId, platformVersion, platformApi.getPlatformInfo().locations.platformWww);
-
-        var pluginMetadata = {};
-        var modulesMetadata = [];
-
-        var plugins = Object.keys(platformJson.root.installed_plugins).concat(Object.keys(platformJson.root.dependent_plugins));
-        events.emit('verbose', 'Iterating over plugins in project:', plugins);
-        plugins.forEach(function (plugin) {
-            var pluginDir = path.join(project.locations.plugins, plugin);
-            var pluginInfo = pluginInfoProvider.get(pluginDir);
-            // pluginMetadata is a mapping from plugin IDs to versions.
-            pluginMetadata[pluginInfo.id] = pluginInfo.version;
-
-            // Copy www assets described in <asset> tags.
-            pluginInfo.getAssets(platform)
-            .forEach(function(asset) {
-                common.asset.install(asset, pluginDir, wwwDir);
+        .then(function (cId) {
+            commitId = cId;
+            return getPlatformVersion(commitId, platformApi.root);
+        }).then(function (platformVersion) {
+            var libraryRelease = bundle(platform, false, commitId, platformVersion, platformApi.getPlatformInfo().locations.platformWww);
+
+            var pluginMetadata = {};
+            var modulesMetadata = [];
+
+            var plugins = Object.keys(platformJson.root.installed_plugins).concat(Object.keys(platformJson.root.dependent_plugins));
+            events.emit('verbose', 'Iterating over plugins in project:', plugins);
+            plugins.forEach(function (plugin) {
+                var pluginDir = path.join(project.locations.plugins, plugin);
+                var pluginInfo = pluginInfoProvider.get(pluginDir);
+                // pluginMetadata is a mapping from plugin IDs to versions.
+                pluginMetadata[pluginInfo.id] = pluginInfo.version;
+
+                // Copy www assets described in <asset> tags.
+                pluginInfo.getAssets(platform)
+                    .forEach(function (asset) {
+                        common.asset.install(asset, pluginDir, wwwDir);
+                    });
+
+                pluginInfo.getJsModules(platform)
+                    .forEach(function (jsModule) {
+                        var moduleName = jsModule.name ? jsModule.name : path.basename(jsModule.src, '.js');
+                        var moduleId = pluginInfo.id + '.' + moduleName;
+                        var moduleMetadata = {
+                            file: jsModule.src,
+                            id: moduleId,
+                            name: moduleName,
+                            pluginId: pluginInfo.id
+                        };
+
+                        if (jsModule.clobbers.length > 0) {
+                            moduleMetadata.clobbers = jsModule.clobbers.map(function (o) { return o.target; });
+                        }
+                        if (jsModule.merges.length > 0) {
+                            moduleMetadata.merges = jsModule.merges.map(function (o) { return o.target; });
+                        }
+                        if (jsModule.runs) {
+                            moduleMetadata.runs = true;
+                        }
+
+                        modulesMetadata.push(moduleMetadata);
+                        libraryRelease.require(path.join(pluginDir, jsModule.src), { expose: moduleId });
+                    });
             });
 
-            pluginInfo.getJsModules(platform)
-            .forEach(function(jsModule) {
-                var moduleName = jsModule.name ? jsModule.name : path.basename(jsModule.src, '.js');
-                var moduleId = pluginInfo.id + '.' + moduleName;
-                var moduleMetadata = {
-                    file: jsModule.src,
-                    id: moduleId,
-                    name: moduleName,
-                    pluginId: pluginInfo.id
-                };
-
-                if (jsModule.clobbers.length > 0) {
-                    moduleMetadata.clobbers = jsModule.clobbers.map(function(o) { return o.target; });
-                }
-                if (jsModule.merges.length > 0) {
-                    moduleMetadata.merges = jsModule.merges.map(function(o) { return o.target; });
-                }
-                if (jsModule.runs) {
-                    moduleMetadata.runs = true;
-                }
-
-                modulesMetadata.push(moduleMetadata);
-                libraryRelease.require(path.join(pluginDir, jsModule.src), { expose: moduleId });
-            });
+            events.emit('verbose', 'Writing out cordova_plugins.js...');
+
+            // Create a stream and write plugin metadata into it
+            // instead of generating intermediate file on FS
+            var cordova_plugins = new Readable();
+            cordova_plugins.push(
+                'module.exports = ' + JSON.stringify(modulesMetadata, null, 2) + ';\n' +
+                'module.exports.metadata = ' + JSON.stringify(pluginMetadata, null, 2) + ';\n', 'utf8');
+            cordova_plugins.push(null);
+
+            var bootstrap = new Readable();
+            bootstrap.push('require(\'cordova/init\');\n', 'utf8');
+            bootstrap.push(null);
+
+            var moduleAliases = modulesMetadata
+                .reduce(function (accum, meta) {
+                    accum['./' + meta.name] = meta.id;
+                    return accum;
+                }, {});
+
+            libraryRelease
+                .add(cordova_plugins, {file: path.join(wwwDir, 'cordova_plugins.js'), expose: 'cordova/plugin_list'})
+                .add(bootstrap)
+                .transform(aliasify, {aliases: moduleAliases});
+
+            var outReleaseFile = path.join(wwwDir, 'cordova.js');
+            return generateFinalBundle(platform, libraryRelease, outReleaseFile, commitId, platformVersion);
         });
-
-        events.emit('verbose', 'Writing out cordova_plugins.js...');
-
-        // Create a stream and write plugin metadata into it
-        // instead of generating intermediate file on FS
-        var cordova_plugins = new Readable();
-        cordova_plugins.push(
-            'module.exports = ' + JSON.stringify(modulesMetadata, null, 2) + ';\n' +
-            'module.exports.metadata = ' + JSON.stringify(pluginMetadata, null, 2) + ';\n', 'utf8');
-        cordova_plugins.push(null);
-
-        var bootstrap = new Readable();
-        bootstrap.push('require(\'cordova/init\');\n', 'utf8');
-        bootstrap.push(null);
-
-        var moduleAliases = modulesMetadata
-        .reduce(function (accum, meta) {
-            accum['./' + meta.name] = meta.id;
-            return accum;
-        }, {});
-
-        libraryRelease
-            .add(cordova_plugins, {file: path.join(wwwDir, 'cordova_plugins.js'), expose: 'cordova/plugin_list'})
-            .add(bootstrap)
-            .transform(aliasify, {aliases: moduleAliases});
-
-        var outReleaseFile = path.join(wwwDir, 'cordova.js');
-        return generateFinalBundle(platform, libraryRelease, outReleaseFile, commitId, platformVersion);
-    });
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/config.js
----------------------------------------------------------------------
diff --git a/src/plugman/config.js b/src/plugman/config.js
index 5ade4ce..cbc71a8 100644
--- a/src/plugman/config.js
+++ b/src/plugman/config.js
@@ -19,6 +19,6 @@
 
 var registry = require('./registry/registry');
 
-module.exports = function(params) {
+module.exports = function (params) {
     return registry.config(params);
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/create.js
----------------------------------------------------------------------
diff --git a/src/plugman/create.js b/src/plugman/create.js
index ada1fb4..5f2e60f 100644
--- a/src/plugman/create.js
+++ b/src/plugman/create.js
@@ -17,68 +17,67 @@
     under the License.
 */
 
-var Q = require('q'),
-    fs = require('fs'),
-    path = require('path'),
-    shell = require('shelljs'),
-    et = require('elementtree'),
-    CordovaError  = require('cordova-common').CordovaError,
-    stripLicense = require('./util/strip-license');
+var Q = require('q');
+var fs = require('fs');
+var path = require('path');
+var shell = require('shelljs');
+var et = require('elementtree');
+var CordovaError = require('cordova-common').CordovaError;
+var stripLicense = require('./util/strip-license');
 
-
-module.exports = function create( name, id, version, pluginPath, options ) {
-    var cwd = pluginPath + '/' + name + '/',
-        templatesDir = path.join(__dirname, '..', '..', 'templates/'),
-        baseJS,
-        root,
-        pluginName,
-        clobber,
-        jsMod;
+module.exports = function create (name, id, version, pluginPath, options) {
+    var cwd = pluginPath + '/' + name + '/';
+    var templatesDir = path.join(__dirname, '..', '..', 'templates/');
+    var baseJS;
+    var root;
+    var pluginName;
+    var clobber;
+    var jsMod;
 
     // Check we are not already in a plugin
-    if( fs.existsSync( cwd + 'plugin.xml' ) ) {
-        return Q.reject( new CordovaError( 'plugin.xml already exists. Are you already in a plugin?' ) );
+    if (fs.existsSync(cwd + 'plugin.xml')) {
+        return Q.reject(new CordovaError('plugin.xml already exists. Are you already in a plugin?'));
     }
 
     // Create a plugin.xml file
-    root = et.Element( 'plugin' );
-    root.set( 'xmlns', 'http://apache.org/cordova/ns/plugins/1.0' );
-    root.set( 'xmlns:android', 'http://schemas.android.com/apk/res/android' );
-    root.set( 'id', id );
-    root.set( 'version', version );
+    root = et.Element('plugin');
+    root.set('xmlns', 'http://apache.org/cordova/ns/plugins/1.0');
+    root.set('xmlns:android', 'http://schemas.android.com/apk/res/android');
+    root.set('id', id);
+    root.set('version', version);
 
     // Add the name tag
-    pluginName = et.XML( '<name>' );
+    pluginName = et.XML('<name>');
     pluginName.text = name;
-    root.append( pluginName );
+    root.append(pluginName);
 
     // Loop through the options( variables ) for other tags
-    for( var key in options ) {
-        var temp = et.XML( '<' + key + '>');
+    for (var key in options) {
+        var temp = et.XML('<' + key + '>');
         temp.text = options[ key ];
-        root.append( temp );
+        root.append(temp);
     }
 
     // Setup the directory structure
-    shell.mkdir( '-p', cwd + 'www' );
-    shell.mkdir( '-p', cwd + 'src' );
+    shell.mkdir('-p', cwd + 'www');
+    shell.mkdir('-p', cwd + 'src');
 
     // Create a base plugin.js file
     baseJS = stripLicense.fromCode(fs.readFileSync(templatesDir + 'base.js', 'utf-8').replace(/%pluginName%/g, name));
-    fs.writeFileSync( cwd + 'www/' + name + '.js', baseJS, 'utf-8' );
+    fs.writeFileSync(cwd + 'www/' + name + '.js', baseJS, 'utf-8');
     // Add it to the xml as a js module
-    jsMod = et.Element( 'js-module' );
-    jsMod.set( 'src', 'www/' + name + '.js' );
-    jsMod.set( 'name', name );
+    jsMod = et.Element('js-module');
+    jsMod.set('src', 'www/' + name + '.js');
+    jsMod.set('name', name);
 
-    clobber = et.Element( 'clobbers' );
-    clobber.set( 'target', 'cordova.plugins.' + name );
-    jsMod.append( clobber );
+    clobber = et.Element('clobbers');
+    clobber.set('target', 'cordova.plugins.' + name);
+    jsMod.append(clobber);
 
-    root.append( jsMod );
+    root.append(jsMod);
 
     // Write out the plugin.xml file
-    fs.writeFileSync( cwd + 'plugin.xml', new et.ElementTree( root ).write( {indent: 4} ), 'utf-8' );
+    fs.writeFileSync(cwd + 'plugin.xml', new et.ElementTree(root).write({indent: 4}), 'utf-8');
 
     return Q();
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/createpackagejson.js
----------------------------------------------------------------------
diff --git a/src/plugman/createpackagejson.js b/src/plugman/createpackagejson.js
index 9e61d3c..7070b38 100644
--- a/src/plugman/createpackagejson.js
+++ b/src/plugman/createpackagejson.js
@@ -17,37 +17,37 @@
     under the License.
 */
 
-var Q = require('q'),
-    fs = require('fs'),
-    path = require('path'),
-    PluginInfo = require('cordova-common').PluginInfo,
-    events = require('cordova-common').events,
-    init = require('init-package-json');
-
-//returns a promise
-function createPackageJson(plugin_path) {
+var Q = require('q');
+var fs = require('fs');
+var path = require('path');
+var PluginInfo = require('cordova-common').PluginInfo;
+var events = require('cordova-common').events;
+var init = require('init-package-json');
+
+// returns a promise
+function createPackageJson (plugin_path) {
     var pluginInfo = new PluginInfo(plugin_path);
 
     var defaults = {
-        id:pluginInfo.id,
-        version:pluginInfo.version,
-        description:pluginInfo.description,
-        license:pluginInfo.license,
-        keywords:pluginInfo.getKeywordsAndPlatforms(),
-        repository:pluginInfo.repo,
-        bugs:pluginInfo.issue,
-        engines:pluginInfo.getEngines(),
+        id: pluginInfo.id,
+        version: pluginInfo.version,
+        description: pluginInfo.description,
+        license: pluginInfo.license,
+        keywords: pluginInfo.getKeywordsAndPlatforms(),
+        repository: pluginInfo.repo,
+        bugs: pluginInfo.issue,
+        engines: pluginInfo.getEngines(),
         platforms: pluginInfo.getPlatformsArray()
     };
 
-    fs.writeFile(path.join(__dirname,'defaults.json'), JSON.stringify(defaults), 'utf8', function (err) {
+    fs.writeFile(path.join(__dirname, 'defaults.json'), JSON.stringify(defaults), 'utf8', function (err) {
         if (err) throw err;
         events.emit('verbose', 'defaults.json created from plugin.xml');
         var initFile = require.resolve('./init-defaults');
         var dir = process.cwd();
 
         init(dir, initFile, {}, function (err, data) {
-            if(err) throw err;
+            if (err) throw err;
             events.emit('verbose', 'Package.json successfully created');
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/src/plugman/fetch.js b/src/plugman/fetch.js
index 48f7596..731509f 100644
--- a/src/plugman/fetch.js
+++ b/src/plugman/fetch.js
@@ -17,22 +17,22 @@
     under the License.
 */
 
-var shell   = require('shelljs'),
-    fs      = require('fs'),
-    url     = require('url'),
-    underscore = require('underscore'),
-    semver = require('semver'),
-    PluginInfoProvider = require('cordova-common').PluginInfoProvider,
-    plugins = require('./util/plugins'),
-    CordovaError = require('cordova-common').CordovaError,
-    events = require('cordova-common').events,
-    metadata = require('./util/metadata'),
-    path    = require('path'),
-    Q       = require('q'),
-    registry = require('./registry/registry'),
-    pluginSpec      = require('../cordova/plugin/plugin_spec_parser'),
-    fetch = require('cordova-fetch'),
-    cordovaUtil = require('../cordova/util');
+var shell = require('shelljs');
+var fs = require('fs');
+var url = require('url');
+var underscore = require('underscore');
+var semver = require('semver');
+var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
+var plugins = require('./util/plugins');
+var CordovaError = require('cordova-common').CordovaError;
+var events = require('cordova-common').events;
+var metadata = require('./util/metadata');
+var path = require('path');
+var Q = require('q');
+var registry = require('./registry/registry');
+var pluginSpec = require('../cordova/plugin/plugin_spec_parser');
+var fetch = require('cordova-fetch');
+var cordovaUtil = require('../cordova/util');
 
 var projectRoot;
 
@@ -42,13 +42,13 @@ var localPlugins = null;
 // possible options: link, subdir, git_ref, client, expected_id
 // Returns a promise.
 module.exports = fetchPlugin;
-function fetchPlugin(plugin_src, plugins_dir, options) {
+function fetchPlugin (plugin_src, plugins_dir, options) {
     // Ensure the containing directory exists.
     shell.mkdir('-p', plugins_dir);
     options = options || {};
     options.subdir = options.subdir || '.';
     options.searchpath = options.searchpath || [];
-    if ( typeof options.searchpath === 'string' ) {
+    if (typeof options.searchpath === 'string') {
         options.searchpath = options.searchpath.split(path.delimiter);
     }
 
@@ -63,11 +63,9 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
     if (uri.hash) {
         var result = uri.hash.match(/^#([^:]*)(?::\/?(.*?)\/?)?$/);
         if (result) {
-            if (result[1])
-                options.git_ref = result[1];
-            if (result[2])
-                options.subdir = result[2];
-            //if --fetch was used, throw error for subdirectories
+            if (result[1]) { options.git_ref = result[1]; }
+            if (result[2]) { options.subdir = result[2]; }
+            // if --fetch was used, throw error for subdirectories
 
             if (options.subdir && options.subdir !== '.') {
                 events.emit('warn', 'support for subdirectories is deprecated and will be removed in Cordova@7');
@@ -79,72 +77,72 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
             // Recurse and exit with the new options and truncated URL.
             var new_dir = plugin_src.substring(0, plugin_src.indexOf('#'));
 
-            //skip the return if user asked for --fetch
-            //cordova-fetch doesn't need to strip out git-ref
-            if(!options.fetch) {
+            // skip the return if user asked for --fetch
+            // cordova-fetch doesn't need to strip out git-ref
+            if (!options.fetch) {
                 return fetchPlugin(new_dir, plugins_dir, options);
             }
         }
     }
-    return Q.when().then(function() {
+    return Q.when().then(function () {
         // If it looks like a network URL, git clone it
         // skip git cloning if user passed in --fetch flag
-        if ( uri.protocol && uri.protocol != 'file:' && uri.protocol[1] != ':' && !plugin_src.match(/^\w+:\\/) && !options.fetch) {
+        if (uri.protocol && uri.protocol !== 'file:' && uri.protocol[1] !== ':' && !plugin_src.match(/^\w+:\\/) && !options.fetch) {
             events.emit('log', 'Fetching plugin "' + plugin_src + '" via git clone');
             if (options.link) {
                 events.emit('log', '--link is not supported for git URLs and will be ignored');
             }
 
             return plugins.clonePluginGit(plugin_src, plugins_dir, options)
-            .fail(function (error) {
-                var message = 'Failed to fetch plugin ' + plugin_src + ' via git.' +
-                    '\nEither there is a connection problems, or plugin spec is incorrect:\n\t' + error;
-                return Q.reject(new CordovaError(message));
-            })
-            .then(function(dir) {
-                return {
-                    pinfo: pluginInfoProvider.get(dir),
-                    dest: dir,
-                    fetchJsonSource: {
-                        type: 'git',
-                        url:  plugin_src,
-                        subdir: options.subdir,
-                        ref: options.git_ref
-                    }
-                };
-            });
+                .fail(function (error) {
+                    var message = 'Failed to fetch plugin ' + plugin_src + ' via git.' +
+                        '\nEither there is a connection problems, or plugin spec is incorrect:\n\t' + error;
+                    return Q.reject(new CordovaError(message));
+                })
+                .then(function (dir) {
+                    return {
+                        pinfo: pluginInfoProvider.get(dir),
+                        dest: dir,
+                        fetchJsonSource: {
+                            type: 'git',
+                            url: plugin_src,
+                            subdir: options.subdir,
+                            ref: options.git_ref
+                        }
+                    };
+                });
         }
         // If it's not a network URL, it's either a local path or a plugin ID.
         var plugin_dir = cordovaUtil.fixRelativePath(path.join(plugin_src, options.subdir));
-        return Q.when().then(function() {
+        return Q.when().then(function () {
             // check if it is a local path
             if (fs.existsSync(plugin_dir)) {
                 if (options.fetch) {
                     if (!fs.existsSync(path.join(plugin_dir, 'package.json'))) {
-                        return Q.reject(new CordovaError('Invalid Plugin! '+ plugin_dir + ' needs a valid package.json'));
+                        return Q.reject(new CordovaError('Invalid Plugin! ' + plugin_dir + ' needs a valid package.json'));
                     }
 
                     projectRoot = path.join(plugins_dir, '..');
-                    //Plugman projects need to go up two directories to reach project root. 
-                    //Plugman projects have an options.projectRoot variable
-                    if(options.projectRoot) {
+                    // Plugman projects need to go up two directories to reach project root.
+                    // Plugman projects have an options.projectRoot variable
+                    if (options.projectRoot) {
                         projectRoot = options.projectRoot;
                     }
                     return fetch(path.resolve(plugin_dir), projectRoot, options)
-                    .then(function(directory) {
-                        return {
-                            pinfo: pluginInfoProvider.get(directory),
-                            fetchJsonSource: {
-                                type: 'local',
-                                path: directory
-                            }
-                        };
-                    }).fail(function(error) {
-                        //something went wrong with cordova-fetch
-                        return Q.reject(new CordovaError(error.message));
-                    });
+                        .then(function (directory) {
+                            return {
+                                pinfo: pluginInfoProvider.get(directory),
+                                fetchJsonSource: {
+                                    type: 'local',
+                                    path: directory
+                                }
+                            };
+                        }).fail(function (error) {
+                            // something went wrong with cordova-fetch
+                            return Q.reject(new CordovaError(error.message));
+                        });
                 } else {
-                    //nofetch
+                    // nofetch
                     return {
                         pinfo: pluginInfoProvider.get(plugin_dir),
                         fetchJsonSource: {
@@ -167,7 +165,7 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
                         path: pinfo.dir
                     }
                 };
-            } else if ( options.noregistry ) {
+            } else if (options.noregistry) {
                 return Q.reject(new CordovaError(
                     'Plugin ' + plugin_src + ' not found locally. ' +
                     'Note, plugin registry was disabled by --noregistry flag.'
@@ -175,19 +173,21 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
             }
             // If not found in local search path, fetch from the registry.
             var parsedSpec = pluginSpec.parse(plugin_src);
-            var P, skipCopyingPlugin, specContainsSpecialCharacters = false;
+            var P;
+            var skipCopyingPlugin;
+            var specContainsSpecialCharacters = false;
             plugin_dir = path.join(plugins_dir, parsedSpec.id);
             // if the plugin has already been fetched, use it.
             if (fs.existsSync(plugin_dir)) {
                 P = Q(plugin_dir);
                 skipCopyingPlugin = true;
             } else {
-                //use cordova-fetch if --fetch was passed in
-                if(options.fetch) {
+                // use cordova-fetch if --fetch was passed in
+                if (options.fetch) {
                     projectRoot = path.join(plugins_dir, '..');
-                    //Plugman projects need to go up two directories to reach project root. 
-                    //Plugman projects have an options.projectRoot variable
-                    if(options.projectRoot) {
+                    // Plugman projects need to go up two directories to reach project root.
+                    // Plugman projects have an options.projectRoot variable
+                    if (options.projectRoot) {
                         projectRoot = options.projectRoot;
                     }
 
@@ -207,37 +207,37 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
                 skipCopyingPlugin = false;
             }
             return P
-            .fail(function (error) {
-                var message = 'Failed to fetch plugin ' + plugin_src + ' via registry.' +
-                    '\nProbably this is either a connection problem, or plugin spec is incorrect.' +
-                    '\nCheck your connection and plugin name/version/URL.' +
-                    '\n' + error;
-                return Q.reject(new CordovaError(message));
-            })
-            .then(function(dir) {
-                return {
-                    pinfo: pluginInfoProvider.get(dir),
-                    fetchJsonSource: {
-                        type: 'registry',
-                        id: plugin_src
-                    },
-                    skipCopyingPlugin: skipCopyingPlugin
-                };
-            });
-        }).then(function(result) {
+                .fail(function (error) {
+                    var message = 'Failed to fetch plugin ' + plugin_src + ' via registry.' +
+                        '\nProbably this is either a connection problem, or plugin spec is incorrect.' +
+                        '\nCheck your connection and plugin name/version/URL.' +
+                        '\n' + error;
+                    return Q.reject(new CordovaError(message));
+                })
+                .then(function (dir) {
+                    return {
+                        pinfo: pluginInfoProvider.get(dir),
+                        fetchJsonSource: {
+                            type: 'registry',
+                            id: plugin_src
+                        },
+                        skipCopyingPlugin: skipCopyingPlugin
+                    };
+                });
+        }).then(function (result) {
             options.plugin_src_dir = result.pinfo.dir;
             var P;
             if (result.skipCopyingPlugin) {
                 P = Q(options.plugin_src_dir);
             } else {
-                P = Q.when(copyPlugin(result.pinfo, plugins_dir, options.link && result.fetchJsonSource.type == 'local'));
+                P = Q.when(copyPlugin(result.pinfo, plugins_dir, options.link && result.fetchJsonSource.type === 'local'));
             }
-            return P.then(function(dir) {
+            return P.then(function (dir) {
                 result.dest = dir;
                 return result;
             });
         });
-    }).then(function(result){
+    }).then(function (result) {
         checkID(options.expected_id, result.pinfo);
         var data = { source: result.fetchJsonSource };
         data.is_top_level = options.is_top_level;
@@ -248,15 +248,15 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
 }
 
 // Helper function for checking expected plugin IDs against reality.
-function checkID(expectedIdAndVersion, pinfo) {
+function checkID (expectedIdAndVersion, pinfo) {
     if (!expectedIdAndVersion) return;
 
     var parsedSpec = pluginSpec.parse(expectedIdAndVersion);
 
-    if (parsedSpec.id != pinfo.id) {
+    if (parsedSpec.id !== pinfo.id) {
         throw new Error('Expected plugin to have ID "' + parsedSpec.id + '" but got "' + pinfo.id + '".');
     }
-    
+
     if (parsedSpec.version && !semver.satisfies(pinfo.version, parsedSpec.version)) {
         throw new Error('Expected plugin ' + pinfo.id + ' to satisfy version "' + parsedSpec.version + '" but got "' + pinfo.version + '".');
     }
@@ -265,11 +265,11 @@ function checkID(expectedIdAndVersion, pinfo) {
 // Note, there is no cache invalidation logic for local plugins.
 // As of this writing loadLocalPlugins() is never called with different
 // search paths and such case would not be handled properly.
-function loadLocalPlugins(searchpath, pluginInfoProvider) {
+function loadLocalPlugins (searchpath, pluginInfoProvider) {
     if (localPlugins) {
         // localPlugins already populated, nothing to do.
         // just in case, make sure it was loaded with the same search path
-        if ( !underscore.isEqual(localPlugins.searchpath, searchpath) ) {
+        if (!underscore.isEqual(localPlugins.searchpath, searchpath)) {
             var msg =
                 'loadLocalPlugins called twice with different search paths.' +
                 'Support for this is not implemented.  Using previously cached path.';
@@ -283,9 +283,9 @@ function loadLocalPlugins(searchpath, pluginInfoProvider) {
     localPlugins.searchpath = searchpath;
     localPlugins.plugins = {};
 
-    searchpath.forEach(function(dir) {
+    searchpath.forEach(function (dir) {
         var ps = pluginInfoProvider.getAllWithinSearchPath(dir);
-        ps.forEach(function(p) {
+        ps.forEach(function (p) {
             var versions = localPlugins.plugins[p.id] || [];
             versions.push(p);
             localPlugins.plugins[p.id] = versions;
@@ -293,14 +293,13 @@ function loadLocalPlugins(searchpath, pluginInfoProvider) {
     });
 }
 
-
 // If a plugin is fund in local search path, return a PluginInfo for it.
 // Ignore plugins that don't satisfy the required version spec.
 // If several versions are present in search path, return the latest.
 // Examples of accepted plugin_src strings:
 //      org.apache.cordova.file
 //      org.apache.cordova.file@>=1.2.0
-function findLocalPlugin(plugin_src, searchpath, pluginInfoProvider) {
+function findLocalPlugin (plugin_src, searchpath, pluginInfoProvider) {
     loadLocalPlugins(searchpath, pluginInfoProvider);
     var parsedSpec = pluginSpec.parse(plugin_src);
     var versionspec = parsedSpec.version || '*';
@@ -310,7 +309,7 @@ function findLocalPlugin(plugin_src, searchpath, pluginInfoProvider) {
 
     if (!versions) return null;
 
-    versions.forEach(function(pinfo) {
+    versions.forEach(function (pinfo) {
         // Ignore versions that don't satisfy the the requested version range.
         // Ignore -dev suffix because latest semver versions doesn't handle it properly (CB-9421)
         if (!semver.satisfies(pinfo.version.replace(/-dev$/, ''), versionspec)) {
@@ -328,19 +327,18 @@ function findLocalPlugin(plugin_src, searchpath, pluginInfoProvider) {
     return latest;
 }
 
-
 // Copy or link a plugin from plugin_dir to plugins_dir/plugin_id.
 // if alternative ID of plugin exists in plugins_dir/plugin_id, skip copying
-function copyPlugin(pinfo, plugins_dir, link) {
+function copyPlugin (pinfo, plugins_dir, link) {
 
     var plugin_dir = pinfo.dir;
     var dest = path.join(plugins_dir, pinfo.id);
 
     shell.rm('-rf', dest);
 
-    if(!link && dest.indexOf(path.resolve(plugin_dir)+path.sep) === 0) {
+    if (!link && dest.indexOf(path.resolve(plugin_dir) + path.sep) === 0) {
 
-        if(/^win/.test(process.platform)) {
+        if (/^win/.test(process.platform)) {
             /*
                 [CB-10423]
                 This is a special case. On windows we cannot create a symlink unless we are run as admin
@@ -350,33 +348,32 @@ function copyPlugin(pinfo, plugins_dir, link) {
             */
             var resolvedSrcPath = path.resolve(plugin_dir);
             var filenames = fs.readdirSync(resolvedSrcPath);
-            var relPath = path.relative(resolvedSrcPath,dest);
+            var relPath = path.relative(resolvedSrcPath, dest);
             var relativeRootFolder = relPath.split('\\')[0];
-            filenames.splice(filenames.indexOf(relativeRootFolder),1);
+            filenames.splice(filenames.indexOf(relativeRootFolder), 1);
             shell.mkdir('-p', dest);
             events.emit('verbose', 'Copying plugin "' + resolvedSrcPath + '" => "' + dest + '"');
             events.emit('verbose', 'Skipping folder "' + relativeRootFolder + '"');
 
-            filenames.forEach(function(elem) {
-                shell.cp('-R', path.join(resolvedSrcPath,elem) , dest);
+            filenames.forEach(function (elem) {
+                shell.cp('-R', path.join(resolvedSrcPath, elem), dest);
             });
             return dest;
-        }
-        else {
+        } else {
             events.emit('verbose', 'Copy plugin destination is child of src. Forcing --link mode.');
             link = true;
         }
     }
 
     if (link) {
-        var isRelativePath = plugin_dir.charAt(1) != ':' && plugin_dir.charAt(0) != path.sep;
+        var isRelativePath = plugin_dir.charAt(1) !== ':' && plugin_dir.charAt(0) !== path.sep;
         var fixedPath = isRelativePath ? path.join(path.relative(plugins_dir, process.env.PWD || process.cwd()), plugin_dir) : plugin_dir;
         events.emit('verbose', 'Linking "' + dest + '" => "' + fixedPath + '"');
         fs.symlinkSync(fixedPath, dest, 'dir');
     } else {
         shell.mkdir('-p', dest);
         events.emit('verbose', 'Copying plugin "' + plugin_dir + '" => "' + dest + '"');
-        shell.cp('-R', path.join(plugin_dir, '*') , dest);
+        shell.cp('-R', path.join(plugin_dir, '*'), dest);
     }
     return dest;
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/help.js
----------------------------------------------------------------------
diff --git a/src/plugman/help.js b/src/plugman/help.js
index a8b602d..e4718d4 100644
--- a/src/plugman/help.js
+++ b/src/plugman/help.js
@@ -16,10 +16,10 @@
     specific language governing permissions and limitations
     under the License.
 */
-var fs = require('fs'),
-    path = require('path');
+var fs = require('fs');
+var path = require('path');
 var doc_txt = path.join(__dirname, 'help.txt');
 
-module.exports = function help() {
+module.exports = function help () {
     return fs.readFileSync(doc_txt, 'utf-8');
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/info.js
----------------------------------------------------------------------
diff --git a/src/plugman/info.js b/src/plugman/info.js
index f0877de..7f87244 100644
--- a/src/plugman/info.js
+++ b/src/plugman/info.js
@@ -20,6 +20,6 @@
 var registry = require('./registry/registry');
 
 // Returns a promise.
-module.exports = function(plugin) {
+module.exports = function (plugin) {
     return registry.info(plugin);
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/init-defaults.js
----------------------------------------------------------------------
diff --git a/src/plugman/init-defaults.js b/src/plugman/init-defaults.js
index f925fb3..5fe01bc 100644
--- a/src/plugman/init-defaults.js
+++ b/src/plugman/init-defaults.js
@@ -19,16 +19,15 @@
 
 /* global dirname */
 /* global config */
-/* global package */
+/* global pkg */
 /* global basename */
 /* global yes */
 /* global prompt */
 // PromZard file that is used by createpackagejson and init-package-json module
 
-var fs = require('fs'),
-    path = require('path'),
-    defaults = require('./defaults.json');
-
+var fs = require('fs');
+var path = require('path');
+var defaults = require('./defaults.json');
 
 function readDeps (test) {
     return function (cb) {
@@ -43,8 +42,7 @@ function readDeps (test) {
                 var dp = path.join(dirname, 'node_modules', d, 'package.json');
                 fs.readFile(dp, 'utf8', function (er, p) {
                     if (er) return next();
-                    try { p = JSON.parse(p); }
-                    catch (e) { return next(); }
+                    try { p = JSON.parse(p); } catch (e) { return next(); }
                     if (!p.version) return next();
                     deps[d] = config.get('save-exact') ? p.version : config.get('save-prefix') + p.version;
                     return next();
@@ -57,47 +55,47 @@ function readDeps (test) {
     };
 }
 
-var name = package.name || defaults.id || basename;
+var name = pkg.name || defaults.id || basename;
 exports.name = yes ? name : prompt('name', name);
 
-var version = package.version ||
+var version = pkg.version ||
               defaults.version ||
               config.get('init.version') ||
               config.get('init-version') ||
               '1.0.0';
 exports.version = yes ? version : prompt('version', version);
 
-if (!package.description) {
-    if(defaults.description){
+if (!pkg.description) {
+    if (defaults.description) {
         exports.description = defaults.description;
     } else {
         exports.description = yes ? '' : prompt('description');
     }
 }
 
-if(!package.cordova) {
+if (!pkg.cordova) {
     exports.cordova = {};
-    if(defaults.id) {
+    if (defaults.id) {
         exports.cordova.id = defaults.id;
     }
-    if(defaults.platforms) {
+    if (defaults.platforms) {
         exports.cordova.platforms = defaults.platforms;
     }
 }
 
-if (!package.dependencies) {
+if (!pkg.dependencies) {
     exports.dependencies = readDeps(false);
 }
 
-if (!package.devDependencies) {
+if (!pkg.devDependencies) {
     exports.devDependencies = readDeps(true);
 }
 
-if (!package.repository) {
+if (!pkg.repository) {
     exports.repository = function (cb) {
         fs.readFile('.git/config', 'utf8', function (er, gconf) {
             if (er || !gconf) {
-                if(defaults.repository) {
+                if (defaults.repository) {
                     return cb(null, yes ? defaults.repository : prompt('git repository', defaults.repository));
                 }
                 return cb(null, yes ? '' : prompt('git repository'));
@@ -105,24 +103,23 @@ if (!package.repository) {
             gconf = gconf.split(/\r?\n/);
             var i = gconf.indexOf('[remote "origin"]');
             var u;
-            if(i !== -1) {
+            if (i !== -1) {
                 u = gconf[i + 1];
                 if (!u.match(/^\s*url =/)) u = gconf[i + 2];
                 if (!u.match(/^\s*url =/)) u = null;
                 else u = u.replace(/^\s*url = /, '');
             }
-            if (u && u.match(/^git@github.com:/))
-                u = u.replace(/^git@github.com:/, 'https://github.com/');
+            if (u && u.match(/^git@github.com:/)) { u = u.replace(/^git@github.com:/, 'https://github.com/'); }
 
             return cb(null, yes ? u : prompt('git repository', u));
         });
     };
 }
 
-if (!package.keywords) {
-    if(defaults.keywords) {
+if (!pkg.keywords) {
+    if (defaults.keywords) {
         exports.keywords = defaults.keywords;
-    }else {
+    } else {
         exports.keywords = yes ? '' : prompt('keywords', function (s) {
             if (!s) return undefined;
             if (Array.isArray(s)) s = s.join(' ');
@@ -132,27 +129,27 @@ if (!package.keywords) {
     }
 }
 
-if (!package.engines) {
-    if(defaults.engines && defaults.engines.length > 0) {
+if (!pkg.engines) {
+    if (defaults.engines && defaults.engines.length > 0) {
         exports.engines = defaults.engines;
     }
 }
 
-if (!package.author) {
+if (!pkg.author) {
     exports.author = (config.get('init.author.name') ||
                      config.get('init-author-name')) ?
-                     {
-                        'name' : config.get('init.author.name') ||
+        {
+            'name': config.get('init.author.name') ||
                             config.get('init-author-name'),
-                        'email' : config.get('init.author.email') ||
+            'email': config.get('init.author.email') ||
                             config.get('init-author-email'),
-                        'url' : config.get('init.author.url') ||
+            'url': config.get('init.author.url') ||
                             config.get('init-author-url')
-                     }
-                     : prompt('author');
+        }
+        : prompt('author');
 }
 
-var license = package.license ||
+var license = pkg.license ||
               defaults.license ||
               config.get('init.license') ||
               config.get('init-license') ||

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/install.js
----------------------------------------------------------------------
diff --git a/src/plugman/install.js b/src/plugman/install.js
index b00bc09..c70a99c 100644
--- a/src/plugman/install.js
+++ b/src/plugman/install.js
@@ -17,26 +17,24 @@
     under the License.
 */
 
-/* jshint laxcomma:true, sub:true, expr:true */
-
-var path = require('path'),
-    fs   = require('fs'),
-    action_stack = require('cordova-common').ActionStack,
-    dep_graph = require('dep-graph'),
-    child_process = require('child_process'),
-    semver = require('semver'),
-    PlatformJson = require('cordova-common').PlatformJson,
-    CordovaError = require('cordova-common').CordovaError,
-    Q = require('q'),
-    platform_modules = require('../platforms/platforms'),
-    os = require('os'),
-    underscore = require('underscore'),
-    shell   = require('shelljs'),
-    events = require('cordova-common').events,
-    HooksRunner = require('../hooks/HooksRunner'),
-    isWindows = (os.platform().substr(0,3) === 'win'),
-    pluginSpec = require('../cordova/plugin/plugin_spec_parser'),
-    cordovaUtil = require('../cordova/util');
+var path = require('path');
+var fs = require('fs');
+var action_stack = require('cordova-common').ActionStack;
+var dep_graph = require('dep-graph');
+var child_process = require('child_process');
+var semver = require('semver');
+var PlatformJson = require('cordova-common').PlatformJson;
+var CordovaError = require('cordova-common').CordovaError;
+var Q = require('q');
+var platform_modules = require('../platforms/platforms');
+var os = require('os');
+var underscore = require('underscore');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var HooksRunner = require('../hooks/HooksRunner');
+var isWindows = (os.platform().substr(0, 3) === 'win');
+var pluginSpec = require('../cordova/plugin/plugin_spec_parser');
+var cordovaUtil = require('../cordova/util');
 
 var superspawn = require('cordova-common').superspawn;
 var PluginInfo = require('cordova-common').PluginInfo;
@@ -66,7 +64,7 @@ var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
 
 // possible options: subdir, cli_variables, www_dir
 // Returns a promise.
-module.exports = function installPlugin(platform, project_dir, id, plugins_dir, options) {
+module.exports = function installPlugin (platform, project_dir, id, plugins_dir, options) {
     project_dir = cordovaUtil.convertToRealPathSafe(project_dir);
     plugins_dir = cordovaUtil.convertToRealPathSafe(plugins_dir);
     options = options || {};
@@ -74,16 +72,16 @@ module.exports = function installPlugin(platform, project_dir, id, plugins_dir,
 
     plugins_dir = plugins_dir || path.join(project_dir, 'cordova', 'plugins');
 
-    var current_stack = new action_stack();
-    return possiblyFetch(id, plugins_dir, options)
-    .then(function(plugin_dir) {
-        return module.exports.runInstall(current_stack, platform, project_dir, plugin_dir, plugins_dir, options);
-    });
+    var current_stack = new action_stack(); // eslint-disable-line new-cap
+    return possiblyFetch(id, plugins_dir, options) // eslint-disable-line new-cap
+        .then(function (plugin_dir) {
+            return module.exports.runInstall(current_stack, platform, project_dir, plugin_dir, plugins_dir, options);
+        });
 };
 
 // possible options: subdir, cli_variables, www_dir, git_ref, is_top_level
 // Returns a promise.
-function possiblyFetch(id, plugins_dir, options) {
+function possiblyFetch (id, plugins_dir, options) {
     var parsedSpec = pluginSpec.parse(id);
 
     // if plugin is a relative path, check if it already exists
@@ -93,7 +91,7 @@ function possiblyFetch(id, plugins_dir, options) {
     if (fs.existsSync(plugin_src_dir)) {
         return Q(plugin_src_dir);
     }
-    
+
     var opts = underscore.extend({}, options, {
         client: 'plugman'
     });
@@ -101,9 +99,9 @@ function possiblyFetch(id, plugins_dir, options) {
     return require('./plugman').fetch(id, plugins_dir, opts);
 }
 
-function checkEngines(engines) {
+function checkEngines (engines) {
 
-    for(var i = 0; i < engines.length; i++) {
+    for (var i = 0; i < engines.length; i++) {
         var engine = engines[i];
 
         // This is a hack to allow plugins with <engine> tag to be installed with
@@ -114,7 +112,7 @@ function checkEngines(engines) {
         // suffix is equal to one of range bounds, for example: 5.1.0-dev >= 5.1.0.
         // However this shouldn't be a problem, because this only should happen in dev workflow.
         engine.currentVersion = engine.currentVersion && engine.currentVersion.replace(/-dev|-nightly.*$/, '');
-        if ( semver.satisfies(engine.currentVersion, engine.minVersion, /*loose=*/true) || engine.currentVersion === null ) {
+        if (semver.satisfies(engine.currentVersion, engine.minVersion, /* loose= */true) || engine.currentVersion === null) {
             continue; // engine ok!
         } else {
             var msg = 'Plugin doesn\'t support this project\'s ' + engine.name + ' version. ' +
@@ -128,7 +126,7 @@ function checkEngines(engines) {
     return Q(true);
 }
 
-function cleanVersionOutput(version, name){
+function cleanVersionOutput (version, name) {
     var out = version.trim();
     var rc_index = out.indexOf('rc');
     var dev_index = out.indexOf('dev');
@@ -139,24 +137,24 @@ function cleanVersionOutput(version, name){
     // put a warning about using the dev branch
     if (dev_index > -1) {
         // some platform still lists dev branches as just dev, set to null and continue
-        if(out=='dev'){
+        if (out === 'dev') {
             out = null;
         }
-        events.emit('verbose', name+' has been detected as using a development branch. Attemping to install anyways.');
+        events.emit('verbose', name + ' has been detected as using a development branch. Attemping to install anyways.');
     }
 
     // add extra period/digits to conform to semver - some version scripts will output
     // just a major or major minor version number
-    var majorReg = /\d+/,
-        minorReg = /\d+\.\d+/,
-        patchReg = /\d+\.\d+\.\d+/;
+    var majorReg = /\d+/;
+    var minorReg = /\d+\.\d+/;
+    var patchReg = /\d+\.\d+\.\d+/;
 
-    if(patchReg.test(out)){
+    if (patchReg.test(out)) {
 
-    }else if(minorReg.test(out)){
-        out = out.match(minorReg)[0]+'.0';
-    }else if(majorReg.test(out)){
-        out = out.match(majorReg)[0]+'.0.0';
+    } else if (minorReg.test(out)) {
+        out = out.match(minorReg)[0] + '.0';
+    } else if (majorReg.test(out)) {
+        out = out.match(majorReg)[0] + '.0.0';
     }
 
     return out;
@@ -164,26 +162,26 @@ function cleanVersionOutput(version, name){
 
 // exec engine scripts in order to get the current engine version
 // Returns a promise for the array of engines.
-function callEngineScripts(engines, project_dir) {
+function callEngineScripts (engines, project_dir) {
 
     return Q.all(
-        engines.map(function(engine){
+        engines.map(function (engine) {
             // CB-5192; on Windows scriptSrc doesn't have file extension so we shouldn't check whether the script exists
             var scriptPath = engine.scriptSrc ? '"' + engine.scriptSrc + '"' : null;
-            if(scriptPath && (isWindows || fs.existsSync(engine.scriptSrc)) ) {
+            if (scriptPath && (isWindows || fs.existsSync(engine.scriptSrc))) {
 
                 var d = Q.defer();
-                if(!isWindows) { // not required on Windows
+                if (!isWindows) { // not required on Windows
                     fs.chmodSync(engine.scriptSrc, '755');
                 }
-                child_process.exec(scriptPath, function(error, stdout, stderr) {
+                child_process.exec(scriptPath, function (error, stdout, stderr) {
                     if (error) {
-                        events.emit('warn', engine.name +' version check failed ('+ scriptPath +'), continuing anyways.');
+                        events.emit('warn', engine.name + ' version check failed (' + scriptPath + '), continuing anyways.');
                         engine.currentVersion = null;
                     } else {
                         engine.currentVersion = cleanVersionOutput(stdout, engine.name);
                         if (engine.currentVersion === '') {
-                            events.emit('warn', engine.name +' version check returned nothing ('+ scriptPath +'), continuing anyways.');
+                            events.emit('warn', engine.name + ' version check returned nothing (' + scriptPath + '), continuing anyways.');
                             engine.currentVersion = null;
                         }
                     }
@@ -194,10 +192,10 @@ function callEngineScripts(engines, project_dir) {
 
             } else {
 
-                if(engine.currentVersion) {
+                if (engine.currentVersion) {
                     engine.currentVersion = cleanVersionOutput(engine.currentVersion, engine.name);
                 } else {
-                    events.emit('warn', engine.name +' version not detected (lacks script '+ scriptPath +' ), continuing.');
+                    events.emit('warn', engine.name + ' version not detected (lacks script ' + scriptPath + ' ), continuing.');
                 }
 
                 return Q(engine);
@@ -207,29 +205,29 @@ function callEngineScripts(engines, project_dir) {
 }
 
 // return only the engines we care about/need
-function getEngines(pluginInfo, platform, project_dir, plugin_dir){
+function getEngines (pluginInfo, platform, project_dir, plugin_dir) {
     var engines = pluginInfo.getEngines();
     var defaultEngines = require('./util/default-engines')(project_dir);
     var uncheckedEngines = [];
     var cordovaEngineIndex, cordovaPlatformEngineIndex, theName, platformIndex, defaultPlatformIndex;
     // load in known defaults and update when necessary
 
-    engines.forEach(function(engine) {
+    engines.forEach(function (engine) {
         theName = engine.name;
 
         // check to see if the engine is listed as a default engine
         if (defaultEngines[theName]) {
             // make sure engine is for platform we are installing on
             defaultPlatformIndex = defaultEngines[theName].platform.indexOf(platform);
-            if(defaultPlatformIndex > -1 || defaultEngines[theName].platform === '*'){
+            if (defaultPlatformIndex > -1 || defaultEngines[theName].platform === '*') {
                 defaultEngines[theName].minVersion = defaultEngines[theName].minVersion ? defaultEngines[theName].minVersion : engine.version;
                 defaultEngines[theName].currentVersion = defaultEngines[theName].currentVersion ? defaultEngines[theName].currentVersion : null;
                 defaultEngines[theName].scriptSrc = defaultEngines[theName].scriptSrc ? defaultEngines[theName].scriptSrc : null;
                 defaultEngines[theName].name = theName;
 
                 // set the indices so we can pop the cordova engine when needed
-                if(theName==='cordova') cordovaEngineIndex = uncheckedEngines.length;
-                if(theName==='cordova-'+platform) cordovaPlatformEngineIndex = uncheckedEngines.length;
+                if (theName === 'cordova') cordovaEngineIndex = uncheckedEngines.length;
+                if (theName === 'cordova-' + platform) cordovaPlatformEngineIndex = uncheckedEngines.length;
 
                 uncheckedEngines.push(defaultEngines[theName]);
             }
@@ -247,30 +245,29 @@ function getEngines(pluginInfo, platform, project_dir, plugin_dir){
                 throw new Error('Security violation: scriptSrc ' + scriptSrcPath + ' is out of plugin dir ' + plugin_dir);
             }
             if (platformIndex > -1 || engine.platform === '*') {
-                uncheckedEngines.push({ 'name': theName, 'platform': engine.platform, 'scriptSrc':scriptSrcPath, 'minVersion' :  engine.version});
+                uncheckedEngines.push({ 'name': theName, 'platform': engine.platform, 'scriptSrc': scriptSrcPath, 'minVersion': engine.version });
             }
         }
     });
 
     // make sure we check for platform req's and not just cordova reqs
-    if(cordovaEngineIndex && cordovaPlatformEngineIndex) uncheckedEngines.pop(cordovaEngineIndex);
+    if (cordovaEngineIndex && cordovaPlatformEngineIndex) uncheckedEngines.pop(cordovaEngineIndex);
     return uncheckedEngines;
 }
 
-
 // possible options: cli_variables, www_dir, is_top_level
 // Returns a promise.
 module.exports.runInstall = runInstall;
-function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, options) {
+function runInstall (actions, platform, project_dir, plugin_dir, plugins_dir, options) {
     project_dir = cordovaUtil.convertToRealPathSafe(project_dir);
     plugin_dir = cordovaUtil.convertToRealPathSafe(plugin_dir);
     plugins_dir = cordovaUtil.convertToRealPathSafe(plugins_dir);
     options = options || {};
-    options.graph = options.graph || new dep_graph();
+    options.graph = options.graph || new dep_graph(); // eslint-disable-line new-cap
     options.pluginInfoProvider = options.pluginInfoProvider || new PluginInfoProvider();
 
     var pluginInfoProvider = options.pluginInfoProvider;
-    var pluginInfo   = pluginInfoProvider.get(plugin_dir);
+    var pluginInfo = pluginInfoProvider.get(plugin_dir);
     var filtered_variables = {};
     var platformJson = PlatformJson.load(plugins_dir, platform);
 
@@ -303,59 +300,59 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
         top_plugin_dir: plugin_dir
     };
 
-    return Q().then(function() {
+    return Q().then(function () {
         if (options.platformVersion) {
             return Q(options.platformVersion);
         }
         return Q(superspawn.maybeSpawn(path.join(project_dir, 'cordova', 'version'), [], { chmod: true }));
-    }).then(function(platformVersion) {
+    }).then(function (platformVersion) {
         options.platformVersion = platformVersion;
         return callEngineScripts(theEngines, path.resolve(plugins_dir, '..'));
-    }).then(function(engines) {
+    }).then(function (engines) {
         return checkEngines(engines);
-    }).then(function() {
-            var prefs = pluginInfo.getPreferences(platform);
-            var keys = underscore.keys(prefs);
-
-            options.cli_variables = options.cli_variables || {};
-            var missing_vars = underscore.difference(keys, Object.keys(options.cli_variables));
-
-            underscore.each(missing_vars,function(_key) {
-                var def = prefs[_key];
-                if (def)
-                     // adding default variables
-                    options.cli_variables[_key]=def;
-            });
+    }).then(function () {
+        var prefs = pluginInfo.getPreferences(platform);
+        var keys = underscore.keys(prefs);
 
-            // test missing vars once again after having default
-            missing_vars = underscore.difference(keys, Object.keys(options.cli_variables));
+        options.cli_variables = options.cli_variables || {};
+        var missing_vars = underscore.difference(keys, Object.keys(options.cli_variables));
 
-            if (missing_vars.length > 0) {
-                throw new Error('Variable(s) missing: ' + missing_vars.join(', '));
+        underscore.each(missing_vars, function (_key) {
+            var def = prefs[_key];
+            if (def) {
+                options.cli_variables[_key] = def;
             }
+        });
 
-            filtered_variables = underscore.pick(options.cli_variables, keys);
-            install.filtered_variables = filtered_variables;
+        // test missing vars once again after having default
+        missing_vars = underscore.difference(keys, Object.keys(options.cli_variables));
 
-            // Check for dependencies
-            var dependencies = pluginInfo.getDependencies(platform);
-            if(dependencies.length) {
-                return installDependencies(install, dependencies, options);
-            }
-            return Q(true);
+        if (missing_vars.length > 0) {
+            throw new Error('Variable(s) missing: ' + missing_vars.join(', '));
         }
+
+        filtered_variables = underscore.pick(options.cli_variables, keys);
+        install.filtered_variables = filtered_variables;
+
+        // Check for dependencies
+        var dependencies = pluginInfo.getDependencies(platform);
+        if (dependencies.length) {
+            return installDependencies(install, dependencies, options);
+        }
+        return Q(true);
+    }
     ).then(
-        function(){
+        function () {
             var install_plugin_dir = path.join(plugins_dir, pluginInfo.id);
 
             // may need to copy to destination...
-            if ( !fs.existsSync(install_plugin_dir) ) {
+            if (!fs.existsSync(install_plugin_dir)) {
                 copyPlugin(plugin_dir, plugins_dir, options.link, pluginInfoProvider);
             }
 
             var projectRoot = cordovaUtil.isCordova();
 
-            if(projectRoot) {
+            if (projectRoot) {
                 // using unified hooksRunner
                 var hookOptions = {
                     cordova: { platforms: [ platform ] },
@@ -375,12 +372,12 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
 
                 var hooksRunner = new HooksRunner(projectRoot);
 
-                return hooksRunner.fire('before_plugin_install', hookOptions).then(function() {
+                return hooksRunner.fire('before_plugin_install', hookOptions).then(function () {
                     return handleInstall(actions, pluginInfo, platform, project_dir, plugins_dir, install_plugin_dir, filtered_variables, options);
-                }).then(function(installResult){
+                }).then(function (installResult) {
                     return hooksRunner.fire('after_plugin_install', hookOptions)
-                    // CB-11022 Propagate install result to caller to be able to avoid unnecessary prepare
-                    .thenResolve(installResult);
+                        // CB-11022 Propagate install result to caller to be able to avoid unnecessary prepare
+                        .thenResolve(installResult);
                 });
             } else {
                 return handleInstall(actions, pluginInfo, platform, project_dir, plugins_dir, install_plugin_dir, filtered_variables, options);
@@ -389,7 +386,7 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
     ).fail(
         function (error) {
 
-            if(error === 'skip') {
+            if (error === 'skip') {
                 events.emit('warn', 'Skipping \'' + pluginInfo.id + '\' for ' + platform);
             } else {
                 events.emit('warn', 'Failed to install \'' + pluginInfo.id + '\': ' + error.stack);
@@ -399,24 +396,23 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
     );
 }
 
-function installDependencies(install, dependencies, options) {
+function installDependencies (install, dependencies, options) {
     events.emit('verbose', 'Dependencies detected, iterating through them...');
 
     var top_plugins = path.join(options.plugin_src_dir || install.top_plugin_dir, '..');
 
     // Add directory of top-level plugin to search path
     options.searchpath = options.searchpath || [];
-    if( top_plugins != install.plugins_dir && options.searchpath.indexOf(top_plugins) == -1 )
-        options.searchpath.push(top_plugins);
+    if (top_plugins !== install.plugins_dir && options.searchpath.indexOf(top_plugins) === -1) { options.searchpath.push(top_plugins); }
 
     // Search for dependency by Id is:
     // a) Look for {$top_plugins}/{$depId} directory
     // b) Scan the top level plugin directory {$top_plugins} for matching id (searchpath)
     // c) Fetch from registry
 
-    return dependencies.reduce(function(soFar, dep) {
+    return dependencies.reduce(function (soFar, dep) {
         return soFar.then(
-            function() {
+            function () {
                 dep.git_ref = dep.commit;
 
                 if (dep.subdir) {
@@ -428,26 +424,26 @@ function installDependencies(install, dependencies, options) {
                 options.graph.getChain(install.top_plugin_id);
 
                 return tryFetchDependency(dep, install, options)
-                .then(
-                    function(url){
-                        dep.url = url;
-                        return installDependency(dep, install, options);
-                    }
-                );
+                    .then(
+                        function (url) {
+                            dep.url = url;
+                            return installDependency(dep, install, options);
+                        }
+                    );
             }
         );
 
     }, Q(true));
 }
 
-function tryFetchDependency(dep, install, options) {
+function tryFetchDependency (dep, install, options) {
 
     // Handle relative dependency paths by expanding and resolving them.
     // The easy case of relative paths is to have a URL of '.' and a different subdir.
     // TODO: Implement the hard case of different repo URLs, rather than the special case of
     // same-repo-different-subdir.
     var relativePath;
-    if ( dep.url == '.' ) {
+    if (dep.url === '.') {
 
         // Look up the parent plugin's fetch metadata and determine the correct URL.
         var fetchdata = require('./util/metadata').get_fetch_metadata(install.top_plugin_dir);
@@ -455,7 +451,7 @@ function tryFetchDependency(dep, install, options) {
 
             relativePath = dep.subdir || dep.id;
 
-            events.emit('warn', 'No fetch metadata found for plugin ' + install.top_plugin_id + '. checking for ' + relativePath + ' in '+ options.searchpath.join(','));
+            events.emit('warn', 'No fetch metadata found for plugin ' + install.top_plugin_id + '. checking for ' + relativePath + ' in ' + options.searchpath.join(','));
 
             return Q(relativePath);
         }
@@ -467,9 +463,9 @@ function tryFetchDependency(dep, install, options) {
 
             dep.url = fetchdata.source.path;
 
-            child_process.exec('git rev-parse --show-toplevel', { cwd:dep.url }, function(err, stdout, stderr) {
+            child_process.exec('git rev-parse --show-toplevel', { cwd: dep.url }, function (err, stdout, stderr) {
                 if (err) {
-                    if (err.code == 128) {
+                    if (err.code === 128) {
                         return d.reject(new Error('Plugin ' + dep.id + ' is not in git repository. All plugins must be in a git repository.'));
                     } else {
                         return d.reject(new Error('Failed to locate git repository for ' + dep.id + ' plugin.'));
@@ -478,12 +474,12 @@ function tryFetchDependency(dep, install, options) {
                 return d.resolve(stdout.trim());
             });
 
-            return d.promise.then(function(git_repo) {
-                //Clear out the subdir since the url now contains it
+            return d.promise.then(function (git_repo) {
+                // Clear out the subdir since the url now contains it
                 var url = path.join(git_repo, dep.subdir);
                 dep.subdir = '';
                 return Q(url);
-            }).fail(function(error){
+            }).fail(function (error) { // eslint-disable-line handle-callback-err
                 return Q(dep.url);
             });
 
@@ -501,85 +497,84 @@ function tryFetchDependency(dep, install, options) {
             tmpDir = tmpDir.replace('$tmpDir', os.tmpdir());
 
             var pluginSrc = '';
-            if(dep.subdir.length) {
+            if (dep.subdir.length) {
                 // Plugin is relative to directory
                 pluginSrc = path.join(tmpDir, dep.subdir);
             }
 
             // Try searchpath in dir, if that fails re-fetch
-            if( !pluginSrc.length || !fs.existsSync(pluginSrc) ) {
+            if (!pluginSrc.length || !fs.existsSync(pluginSrc)) {
                 pluginSrc = dep.id;
 
                 // Add search path
-                if( options.searchpath.indexOf(tmpDir) == -1 )
-                    options.searchpath.unshift(tmpDir); // place at top of search
+                if (options.searchpath.indexOf(tmpDir) === -1) { options.searchpath.unshift(tmpDir); } // place at top of search
             }
 
-            return Q( pluginSrc );
+            return Q(pluginSrc);
         }
     }
 
     // Test relative to parent folder
-    if( dep.url && !isAbsolutePath(dep.url) ) {
+    if (dep.url && !isAbsolutePath(dep.url)) {
         relativePath = path.resolve(install.top_plugin_dir, '../' + dep.url);
 
-        if( fs.existsSync(relativePath) ) {
+        if (fs.existsSync(relativePath)) {
             dep.url = relativePath;
         }
     }
 
     // CB-4770: registry fetching
-    if(dep.url === undefined) {
+    if (dep.url === undefined) {
         dep.url = dep.id;
     }
 
     return Q(dep.url);
 }
 
-function installDependency(dep, install, options) {
+function installDependency (dep, install, options) {
 
     var opts;
     dep.install_dir = path.join(install.plugins_dir, dep.id);
 
-    events.emit('verbose', 'Requesting plugin "' + (dep.version? dep.id+'@'+dep.version : dep.id) + '".' );
+    events.emit('verbose', 'Requesting plugin "' + (dep.version ? dep.id + '@' + dep.version : dep.id) + '".');
 
-    if (fs.existsSync(dep.install_dir) ) {
+    if (fs.existsSync(dep.install_dir)) {
         var pluginInfo = new PluginInfo(dep.install_dir);
         var version_installed = pluginInfo.version;
         var version_required = dep.version;
 
-        if(dep.version) {
-            if (Number(dep.version.replace('.',''))) {
+        if (dep.version) {
+            if (Number(dep.version.replace('.', ''))) {
                 version_required = '^' + dep.version;
             }
         }
-        //strip -dev from the installed plugin version so it properly passes
-        //semver.satisfies 
+        // strip -dev from the installed plugin version so it properly passes
+        // semver.satisfies
         var stripped_version;
-        if(version_installed.includes('-dev')) {
+        if (version_installed.includes('-dev')) {
             stripped_version = semver.inc(version_installed, 'patch');
         }
-        if (options.force || 
-            semver.satisfies(version_installed, version_required, /*loose=*/true) ||
-            semver.satisfies(stripped_version, version_required, /*loose=*/true) ||
-            version_required === null || 
+        if (options.force ||
+            semver.satisfies(version_installed, version_required, /* loose= */true) ||
+            semver.satisfies(stripped_version, version_required, /* loose= */true) ||
+            version_required === null ||
             version_required === undefined ||
-            version_required === '' ) {
-            events.emit('log', 'Plugin dependency "' + (version_installed ? dep.id+'@'+version_installed : dep.id) + '" already fetched, using that version.');
+            version_required === '') {
+            events.emit('log', 'Plugin dependency "' + (version_installed ? dep.id + '@' + version_installed : dep.id) + '" already fetched, using that version.');
         } else {
             var msg = 'Version of installed plugin: "' +
-                dep.id + '@'+ version_installed +
+                dep.id + '@' + version_installed +
                 '" does not satisfy dependency plugin requirement "' +
-                dep.id +'@'+ version_required +
+                dep.id + '@' + version_required +
                  '". Try --force to use installed plugin as dependency.';
             return Q()
-            .then(function() {
-                // Remove plugin
-                return shell.rm('-rf', path.join(install.plugins_dir, install.top_plugin_id));
-            }).then(function() {
-                // Return promise chain and finally reject
-                return Q.reject(new CordovaError(msg));
-            });
+                .then(function () {
+                    // Remove plugin
+                    return shell.rm('-rf', path.join(install.plugins_dir, install.top_plugin_id));
+                }).then(function () {
+                    // Return promise chain and finally reject
+                    return Q.reject(new CordovaError(msg));
+                });
         }
         opts = underscore.extend({}, options, {
             cli_variables: install.filtered_variables,
@@ -598,34 +593,33 @@ function installDependency(dep, install, options) {
             expected_id: dep.id
         });
 
-
-        var dep_src = dep.url.length ? dep.url : (dep.version? dep.id + '@'+dep.version: dep.id);
+        var dep_src = dep.url.length ? dep.url : (dep.version ? dep.id + '@' + dep.version : dep.id);
         return possiblyFetch(dep_src, install.plugins_dir, opts)
-        .then(
-            function(plugin_dir) {
-                return module.exports.runInstall(install.actions, install.platform, install.project_dir, plugin_dir, install.plugins_dir, opts);
-            }
-        );
+            .then(
+                function (plugin_dir) {
+                    return module.exports.runInstall(install.actions, install.platform, install.project_dir, plugin_dir, install.plugins_dir, opts);
+                }
+            );
     }
 }
 
-function handleInstall(actions, pluginInfo, platform, project_dir, plugins_dir, plugin_dir, filtered_variables, options) {
+function handleInstall (actions, pluginInfo, platform, project_dir, plugins_dir, plugin_dir, filtered_variables, options) {
 
     // @tests - important this event is checked spec/install.spec.js
     events.emit('verbose', 'Install start for "' + pluginInfo.id + '" on ' + platform + '.');
 
     options.variables = filtered_variables;
     return platform_modules.getPlatformApi(platform, project_dir)
-    .addPlugin(pluginInfo, options)
-    .then(function(result) {
-        events.emit('verbose', 'Install complete for ' + pluginInfo.id + ' on ' + platform + '.');
-        // Add plugin to installed list. This already done in platform,
-        // but need to be duplicated here to manage dependencies properly.
-        PlatformJson.load(plugins_dir, platform)
-            .addPlugin(pluginInfo.id, filtered_variables, options.is_top_level)
-            .save();
-
-        if (platform == 'android' &&
+        .addPlugin(pluginInfo, options)
+        .then(function (result) {
+            events.emit('verbose', 'Install complete for ' + pluginInfo.id + ' on ' + platform + '.');
+            // Add plugin to installed list. This already done in platform,
+            // but need to be duplicated here to manage dependencies properly.
+            PlatformJson.load(plugins_dir, platform)
+                .addPlugin(pluginInfo.id, filtered_variables, options.is_top_level)
+                .save();
+
+            if (platform === 'android' &&
                 semver.gte(options.platformVersion, '4.0.0-dev') &&
                 // CB-10533 since 5.2.0-dev prepBuildFiles is now called internally by android platform and
                 // no more exported from build module
@@ -633,46 +627,45 @@ function handleInstall(actions, pluginInfo, platform, project_dir, plugins_dir,
                 semver.lte(options.platformVersion, '5.2.0-dev') &&
                 pluginInfo.getFrameworks(platform).length > 0) {
 
-            events.emit('verbose', 'Updating build files since android plugin contained <framework>');
-            var buildModule;
-            try {
-                buildModule = require(path.join(project_dir, 'cordova', 'lib', 'build'));
-            } catch (e) {
-                // Should occur only in unit tests.
-            }
-            if (buildModule && buildModule.prepBuildFiles) {
-                buildModule.prepBuildFiles();
+                events.emit('verbose', 'Updating build files since android plugin contained <framework>');
+                var buildModule;
+                try {
+                    buildModule = require(path.join(project_dir, 'cordova', 'lib', 'build'));
+                } catch (e) {
+                    // Should occur only in unit tests.
+                }
+                if (buildModule && buildModule.prepBuildFiles) {
+                    buildModule.prepBuildFiles();
+                }
             }
-        }
 
-        // WIN!
-        // Log out plugin INFO element contents in case additional install steps are necessary
-        var info_strings = pluginInfo.getInfo(platform) || [];
-        info_strings.forEach( function(info) {
-            events.emit('results', interp_vars(filtered_variables, info));
-        });
+            // WIN!
+            // Log out plugin INFO element contents in case additional install steps are necessary
+            var info_strings = pluginInfo.getInfo(platform) || [];
+            info_strings.forEach(function (info) {
+                events.emit('results', interp_vars(filtered_variables, info));
+            });
 
-        // Propagate value, returned by platform's addPlugin method to caller
-        return Q(result);
-    });
+            // Propagate value, returned by platform's addPlugin method to caller
+            return Q(result);
+        });
 }
 
-function interp_vars(vars, text) {
-    vars && Object.keys(vars).forEach(function(key) {
+function interp_vars (vars, text) {
+    vars && Object.keys(vars).forEach(function (key) {
         var regExp = new RegExp('\\$' + key, 'g');
         text = text.replace(regExp, vars[key]);
     });
     return text;
 }
 
-function isAbsolutePath(_path) {
+function isAbsolutePath (_path) {
     // some valid abs paths: 'c:' '/' '\' and possibly ? 'file:' 'http:'
     return _path && (_path.charAt(0) === path.sep || _path.indexOf(':') > 0);
 }
 
-
 // Copy or link a plugin from plugin_dir to plugins_dir/plugin_id.
-function copyPlugin(plugin_src_dir, plugins_dir, link, pluginInfoProvider) {
+function copyPlugin (plugin_src_dir, plugins_dir, link, pluginInfoProvider) {
     var pluginInfo = new PluginInfo(plugin_src_dir);
     var dest = path.join(plugins_dir, pluginInfo.id);
     shell.rm('-rf', dest);
@@ -684,7 +677,7 @@ function copyPlugin(plugin_src_dir, plugins_dir, link, pluginInfoProvider) {
     } else {
         shell.mkdir('-p', dest);
         events.emit('verbose', 'Copying from location "' + plugin_src_dir + '" to location "' + dest + '"');
-        shell.cp('-R', path.join(plugin_src_dir, '*') , dest);
+        shell.cp('-R', path.join(plugin_src_dir, '*'), dest);
     }
     pluginInfo.dir = dest;
     pluginInfoProvider.put(pluginInfo);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/owner.js
----------------------------------------------------------------------
diff --git a/src/plugman/owner.js b/src/plugman/owner.js
index 84ad77c..17faf9d 100644
--- a/src/plugman/owner.js
+++ b/src/plugman/owner.js
@@ -20,6 +20,6 @@
 var registry = require('./registry/registry');
 
 // Returns a promise.
-module.exports = function(args) {
+module.exports = function (args) {
     return registry.owner(args);
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/platform.js
----------------------------------------------------------------------
diff --git a/src/plugman/platform.js b/src/plugman/platform.js
index b8cec07..05c71d2 100644
--- a/src/plugman/platform.js
+++ b/src/plugman/platform.js
@@ -17,109 +17,107 @@
     under the License.
 */
 
-/* jshint quotmark:false */
-
-var Q = require('q'),
-    et = require('elementtree'),
-    fs = require('fs'),
-    shell = require('shelljs'),
-    path = require('path'),
-    stripLicense = require('./util/strip-license');
+var Q = require('q');
+var et = require('elementtree');
+var fs = require('fs');
+var shell = require('shelljs');
+var path = require('path');
+var stripLicense = require('./util/strip-license');
 
 /**
  * Used for adding templates for plugin platforms to plugin.xml
  */
 module.exports = {
-    add: function( platformName ) {
+    add: function (platformName) {
         var pluginxml,
             platform;
 
         // Check to make sure we are in the plugin first
-        if( !fs.existsSync( 'plugin.xml' ) ) {
-            return Q.reject( new Error( "can't find a plugin.xml.  Are you in the plugin?" ) );
+        if (!fs.existsSync('plugin.xml')) {
+            return Q.reject(new Error("can't find a plugin.xml.  Are you in the plugin?"));
         }
 
         // Get the current plugin.xml file
-        pluginxml = et.parse( fs.readFileSync('plugin.xml', 'utf-8') );
+        pluginxml = et.parse(fs.readFileSync('plugin.xml', 'utf-8'));
 
         // Check if this platform exists
-        if( pluginxml.find("./platform/[@name='"+ platformName +"']") ) {
-            return Q.reject( new Error( "platform: " + platformName + " already added"  ) );
+        if (pluginxml.find("./platform/[@name='" + platformName + "']")) {
+            return Q.reject(new Error('platform: ' + platformName + ' already added'));
         }
 
         // Get the platform specific elements
-        platform = doPlatform( platformName, pluginxml.find("./name").text, pluginxml.getroot().get( "id" ) );
+        platform = doPlatform(platformName, pluginxml.find('./name').text, pluginxml.getroot().get('id'));
 
         // Make sure we support it
-        if( !platform ) {
-            return Q.reject( new Error( "platform: " + platformName + " not yet supported"  ) );
+        if (!platform) {
+            return Q.reject(new Error('platform: ' + platformName + ' not yet supported'));
         }
 
-        pluginxml.getroot().append( platform.getroot() );
+        pluginxml.getroot().append(platform.getroot());
 
-        fs.writeFileSync( "plugin.xml", pluginxml.write( "plugin.xml", {indent: 4} ), 'utf-8' );
+        fs.writeFileSync('plugin.xml', pluginxml.write('plugin.xml', {indent: 4}), 'utf-8');
         return Q();
     },
-    remove: function( platformName ) {
+    remove: function (platformName) {
         // Check to make sure we are in the plugin first
-        if( !fs.existsSync( 'plugin.xml' ) ) {
-            return Q.reject( new Error( "can't find a plugin.xml.  Are you in the plugin?" ) );
+        if (!fs.existsSync('plugin.xml')) {
+            return Q.reject(new Error("can't find a plugin.xml.  Are you in the plugin?"));
         }
 
         // Get the current plugin.xml file
-        var pluginxml = et.parse( fs.readFileSync('plugin.xml', 'utf-8') );
+        var pluginxml = et.parse(fs.readFileSync('plugin.xml', 'utf-8'));
 
         // Check if this platform exists
-        if( !pluginxml.find("./platform/[@name='"+ platformName +"']") ) {
-            return Q.reject( new Error( "platform: " + platformName + " hasn't been added"  ) );
+        if (!pluginxml.find("./platform/[@name='" + platformName + "']")) {
+            return Q.reject(new Error('platform: ' + platformName + " hasn't been added"));
         }
 
         // Remove the Platform in question
-        pluginxml.getroot().remove(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' );
+        fs.writeFileSync('plugin.xml', pluginxml.write('plugin.xml', {indent: 4}), 'utf-8');
 
         // Remove the src/"platform"
-        shell.rm( '-rf', 'src/' + platformName );
+        shell.rm('-rf', 'src/' + platformName);
 
         return Q();
     }
 };
 
-function doPlatform( platformName, pluginName, pluginID, pluginVersion ) {
-    var templatesDir = path.join(__dirname, '..', '..', 'templates/platforms/' + platformName + "/"),
-        platformFile = templatesDir + platformName + ".xml",
-        platform;
+function doPlatform (platformName, pluginName, pluginID, pluginVersion) {
+    var templatesDir = path.join(__dirname, '..', '..', 'templates/platforms/' + platformName + '/');
+    var platformFile = templatesDir + platformName + '.xml';
+    var platform;
 
-    if( !fs.existsSync( platformFile ) ) {
+    if (!fs.existsSync(platformFile)) {
         return false;
     }
 
-    platform = fs.readFileSync( platformFile, 'utf-8' )
-                .replace( /%pluginName%/g, pluginName )
-                .replace( /%pluginID%/g, pluginID )
-                .replace( /%packageName%/g, pluginID.replace( /[.]/g, '/' ) );
-    platform = new et.ElementTree( et.XML( platform ) );
+    platform = fs.readFileSync(platformFile, 'utf-8')
+        .replace(/%pluginName%/g, pluginName)
+        .replace(/%pluginID%/g, pluginID)
+        .replace(/%packageName%/g, pluginID.replace(/[.]/g, '/'));
+    platform = new et.ElementTree(et.XML(platform));
 
-    doPlatformBase( templatesDir, platformName, pluginName, pluginID, pluginVersion );
+    doPlatformBase(templatesDir, platformName, pluginName, pluginID, pluginVersion);
 
     return platform;
 }
 
-function doPlatformBase( templatesDir, platformName, pluginName, pluginID, pluginVersion ) {
+function doPlatformBase (templatesDir, platformName, pluginName, pluginID, pluginVersion) {
     // Create the default plugin file
-    var baseFiles = [],
-        i = 0;
+    var baseFiles = [];
+    var i = 0;
 
-    switch( platformName ) {
+    switch (platformName) {
     case 'android':
-        baseFiles.push (
+        baseFiles.push(
             {
-                file: stripLicense.fromCode(fs.readFileSync(templatesDir + "base.java", "utf-8")
+                file: stripLicense.fromCode(fs.readFileSync(templatesDir + 'base.java', 'utf-8')
                     .replace(/%pluginName%/g, pluginName)
                     .replace(/%pluginID%/g, pluginID)),
-                extension: "java"
+                extension: 'java'
             }
         );
 
@@ -127,25 +125,25 @@ function doPlatformBase( templatesDir, platformName, pluginName, pluginID, plugi
     case 'ios':
         baseFiles.push(
             {
-                file: stripLicense.fromCode(fs.readFileSync(templatesDir + "base.m", "utf-8")
+                file: stripLicense.fromCode(fs.readFileSync(templatesDir + 'base.m', 'utf-8')
                     .replace(/%pluginName%/g, pluginName)),
-                extension: "m"
+                extension: 'm'
             }
         );
         break;
     case 'windows':
         baseFiles.push(
             {
-                file: stripLicense.fromCode(fs.readFileSync(templatesDir + "base.js", "utf-8")),
-                extension: "js"
+                file: stripLicense.fromCode(fs.readFileSync(templatesDir + 'base.js', 'utf-8')),
+                extension: 'js'
             }
         );
     }
 
-    shell.mkdir( '-p', 'src/' + platformName );
+    shell.mkdir('-p', 'src/' + platformName);
 
-    for( i; i < baseFiles.length; i++ ) {
-        fs.writeFileSync( 'src/' + platformName + '/' + pluginName + '.' + baseFiles[ i ].extension, baseFiles[ i ].file, 'utf-8' );
+    for (i; i < baseFiles.length; i++) {
+        fs.writeFileSync('src/' + platformName + '/' + pluginName + '.' + baseFiles[ i ].extension, baseFiles[ i ].file, 'utf-8');
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/platform_operation.js
----------------------------------------------------------------------
diff --git a/src/plugman/platform_operation.js b/src/plugman/platform_operation.js
index d325cd7..dff2d0c 100644
--- a/src/plugman/platform_operation.js
+++ b/src/plugman/platform_operation.js
@@ -19,6 +19,6 @@
 
 var platform = require('./platform');
 
-module.exports = function( args ) {
-    return platform[ args.operation ]( args.platform_name );
+module.exports = function (args) {
+    return platform[ args.operation ](args.platform_name);
 };


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


[02/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/util/plugins.js
----------------------------------------------------------------------
diff --git a/src/plugman/util/plugins.js b/src/plugman/util/plugins.js
index b3cef6a..72409ee 100644
--- a/src/plugman/util/plugins.js
+++ b/src/plugman/util/plugins.js
@@ -17,20 +17,20 @@
     under the License.
 */
 
-var path = require('path'),
-    shell = require('shelljs'),
-    events = require('cordova-common').events,
-    gitclone = require('../../gitclone'),
-    tmp_dir;
+var path = require('path');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var gitclone = require('../../gitclone');
+var tmp_dir;
 
 var PluginInfo = require('cordova-common').PluginInfo;
 
 module.exports = {
-    searchAndReplace:require('./search-and-replace'),
+    searchAndReplace: require('./search-and-replace'),
 
-    clonePluginGit:function(plugin_git_url, plugins_dir, options) {
+    clonePluginGit: function (plugin_git_url, plugins_dir, options) {
         return module.exports.clonePluginGitRepo(plugin_git_url, plugins_dir, options.subdir, options.git_ref, options.pluginInfoProvider).then(
-            function(dst){
+            function (dst) {
                 // Keep location where we checked out git repo
                 options.plugin_src_dir = tmp_dir;
                 return dst;
@@ -38,8 +38,8 @@ module.exports = {
         );
     },
 
-    clonePluginGitRepo:function(plugin_git_url, plugins_dir, subdir, git_ref, pluginInfoProvider) {
-	return gitclone.clone(plugin_git_url, git_ref).then(function(tmp_dir) {
+    clonePluginGitRepo: function (plugin_git_url, plugins_dir, subdir, git_ref, pluginInfoProvider) {
+        return gitclone.clone(plugin_git_url, git_ref).then(function (tmp_dir) {
             // Read the plugin.xml file and extract the plugin's ID.
             tmp_dir = path.join(tmp_dir, subdir);
             var pluginInfo = new PluginInfo(tmp_dir);
@@ -69,4 +69,3 @@ module.exports = {
         });
     }
 };
-

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/util/search-and-replace.js
----------------------------------------------------------------------
diff --git a/src/plugman/util/search-and-replace.js b/src/plugman/util/search-and-replace.js
index e84f7a0..a27dc05 100644
--- a/src/plugman/util/search-and-replace.js
+++ b/src/plugman/util/search-and-replace.js
@@ -1,5 +1,5 @@
 #!/usr/bin/env node
- /**
+/**
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
@@ -16,13 +16,13 @@
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
-*/ 
+*/
 
-var glob = require('glob'),
-    fs = require('fs');
+var glob = require('glob');
+var fs = require('fs');
 
 module.exports = searchAndReplace;
-function searchAndReplace(srcGlob, variables) {
+function searchAndReplace (srcGlob, variables) {
     var files = glob.sync(srcGlob);
     for (var i in files) {
         var file = files[i];

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/util/strip-license.js
----------------------------------------------------------------------
diff --git a/src/plugman/util/strip-license.js b/src/plugman/util/strip-license.js
index c2948d0..5df03bf 100644
--- a/src/plugman/util/strip-license.js
+++ b/src/plugman/util/strip-license.js
@@ -20,6 +20,6 @@
 module.exports = {
     fromCode: function (code) {
         // For simplicity, relies on the fact that the Apache license header doesn't contain a "*"
-        return code.replace(/^\s*\/\*\*[^\*]*\*\/\s*/, "");
+        return code.replace(/^\s*\/\*\*[^\*]*\*\/\s*/, ''); // eslint-disable-line no-useless-escape
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/util/alias.js
----------------------------------------------------------------------
diff --git a/src/util/alias.js b/src/util/alias.js
index c4a51f3..9b9a702 100644
--- a/src/util/alias.js
+++ b/src/util/alias.js
@@ -19,8 +19,8 @@
 
 var cordova_events = require('cordova-common').events;
 
-module.exports = function aliasMethodToRawWithDeprecationNotice(property, targetObj, component) {
-    targetObj.raw[property] = function() {
+module.exports = function aliasMethodToRawWithDeprecationNotice (property, targetObj, component) {
+    targetObj.raw[property] = function () {
         cordova_events.emit('warn', 'Use of ' + component + '.raw.* methods is deprecated and ' + component + '.raw will be removed in a future release. Please migrate to using the top-level ' + component + '.* methods instead.');
         return targetObj[property].apply(targetObj, arguments);
     };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/util/npm-helper.js
----------------------------------------------------------------------
diff --git a/src/util/npm-helper.js b/src/util/npm-helper.js
index e1e5322..f8003c1 100644
--- a/src/util/npm-helper.js
+++ b/src/util/npm-helper.js
@@ -19,14 +19,14 @@
 
 // Helper methods to help keep npm operations separated.
 
-var npm = require('npm'),
-    path = require('path'),
-    fs = require('fs'),
-    Q = require('q'),
-    unpack = require('./unpack'),
-    util = require('../cordova/util'),
-    cachedSettings = null,
-    cachedSettingsValues = null;
+var npm = require('npm');
+var path = require('path');
+var fs = require('fs');
+var Q = require('q');
+var unpack = require('./unpack');
+var util = require('../cordova/util');
+var cachedSettings = null;
+var cachedSettingsValues = null;
 
 /**
  * @description Calls npm.load, then initializes npm.config with the specified settings. Then executes a chain of
@@ -35,11 +35,11 @@ var npm = require('npm'),
  * @param {Object} settings
  * @param {Function} promiseChain
  */
-function loadWithSettingsThenRestore(settings, promiseChain) {
+function loadWithSettingsThenRestore (settings, promiseChain) {
     return loadWithSettings(settings).then(promiseChain).finally(restoreSettings);
 }
 
-function loadWithSettings(settings) {
+function loadWithSettings (settings) {
     if (cachedSettings) {
         throw new Error('Trying to initialize npm when settings have not been restored from a previous initialization.');
     }
@@ -62,7 +62,7 @@ function loadWithSettings(settings) {
     });
 }
 
-function restoreSettings() {
+function restoreSettings () {
     if (cachedSettings) {
         cachedSettings.forEach(function (prop) {
             if (prop in cachedSettingsValues) {
@@ -82,7 +82,7 @@ function restoreSettings() {
  * @param packageName - name of an npm package
  * @param packageVersion - requested version or version range
  */
-function fetchPackage(packageName, packageVersion) {
+function fetchPackage (packageName, packageVersion) {
     // Get the latest matching version from NPM if a version range is specified
     return util.getLatestMatchingNpmVersion(packageName, packageVersion).then(
         function (latestVersion) {
@@ -97,7 +97,7 @@ function fetchPackage(packageName, packageVersion) {
  * @param packageName - name of an npm package
  * @param packageVersion - requested version (not a version range)
  */
-function cachePackage(packageName, packageVersion) {
+function cachePackage (packageName, packageVersion) {
     return Q().then(function () {
         var cacheDir = path.join(util.libDirectory, 'npm_cache');
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/util/promise-util.js
----------------------------------------------------------------------
diff --git a/src/util/promise-util.js b/src/util/promise-util.js
index 4d21050..df1081d 100644
--- a/src/util/promise-util.js
+++ b/src/util/promise-util.js
@@ -23,10 +23,10 @@ var Q = require('q');
 // will sequentially execute func(args[i]).
 // Returns a promise.
 //
-function Q_chainmap(args, func) {
-    return Q.when().then(function(inValue) {
-        return args.reduce(function(soFar, arg) {
-            return soFar.then(function(val) {
+function Q_chainmap (args, func) {
+    return Q.when().then(function (inValue) {
+        return args.reduce(function (soFar, arg) {
+            return soFar.then(function (val) {
                 return func(arg, val);
             });
         }, Q(inValue));
@@ -35,12 +35,12 @@ function Q_chainmap(args, func) {
 
 // Behaves similar to Q_chainmap but gracefully handles failures.
 // When a promise in the chain is rejected, it will call the failureCallback and then continue the processing, instead of stopping
-function Q_chainmap_graceful(args, func, failureCallback) {
-    return Q.when().then(function(inValue) {
-        return args.reduce(function(soFar, arg) {
-            return soFar.then(function(val) {
+function Q_chainmap_graceful (args, func, failureCallback) {
+    return Q.when().then(function (inValue) {
+        return args.reduce(function (soFar, arg) {
+            return soFar.then(function (val) {
                 return func(arg, val);
-            }).fail(function(err) {
+            }).fail(function (err) {
                 if (failureCallback) {
                     failureCallback(err);
                 }
@@ -50,4 +50,4 @@ function Q_chainmap_graceful(args, func, failureCallback) {
 }
 
 exports.Q_chainmap = Q_chainmap;
-exports.Q_chainmap_graceful = Q_chainmap_graceful;
\ No newline at end of file
+exports.Q_chainmap_graceful = Q_chainmap_graceful;

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/util/unpack.js
----------------------------------------------------------------------
diff --git a/src/util/unpack.js b/src/util/unpack.js
index f0ec451..6997fef 100644
--- a/src/util/unpack.js
+++ b/src/util/unpack.js
@@ -20,37 +20,36 @@
 // commands for packing and unpacking tarballs
 // this file is used by lib/cache.js
 
-var events = require('cordova-common').events,
-    fs     = require('fs'),
-    Q      = require('q'),
-    tar    = require('tar'),
-    zlib   = require('zlib');
+var events = require('cordova-common').events;
+var fs = require('fs');
+var Q = require('q');
+var tar = require('tar');
+var zlib = require('zlib');
 
 exports.unpackTgz = unpackTgz;
 
 // Returns a promise for the path to the unpacked tarball (unzip + untar).
-function unpackTgz(package_tgz, unpackTarget) {
-    return Q.promise(function(resolve, reject) {
+function unpackTgz (package_tgz, unpackTarget) {
+    return Q.promise(function (resolve, reject) {
         var extractOpts = { type: 'Directory', path: unpackTarget, strip: 1 };
 
         fs.createReadStream(package_tgz)
-        .on('error', function (err) {
-            events.emit('warn', 'Unable to open tarball ' + package_tgz + ': ' + err);
-            reject(err);
-        })
-        .pipe(zlib.createUnzip())
-        .on('error', function (err) {
-            events.emit('warn', 'Error during unzip for ' + package_tgz + ': ' + err);
-            reject(err);
-        })
-        .pipe(tar.Extract(extractOpts))
-        .on('error', function(err) {
-            events.emit('warn', 'Error during untar for ' + package_tgz + ': ' + err);
-            reject(err);
-        })
-        .on('end', resolve);
-    })
-    .then(function() {
+            .on('error', function (err) {
+                events.emit('warn', 'Unable to open tarball ' + package_tgz + ': ' + err);
+                reject(err);
+            })
+            .pipe(zlib.createUnzip())
+            .on('error', function (err) {
+                events.emit('warn', 'Error during unzip for ' + package_tgz + ': ' + err);
+                reject(err);
+            })
+            .pipe(tar.Extract(extractOpts))
+            .on('error', function (err) {
+                events.emit('warn', 'Error during untar for ' + package_tgz + ': ' + err);
+                reject(err);
+            })
+            .on('end', resolve);
+    }).then(function () {
         return unpackTarget;
     });
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/util/windows/csproj.js
----------------------------------------------------------------------
diff --git a/src/util/windows/csproj.js b/src/util/windows/csproj.js
index 092fba9..51efb5f 100644
--- a/src/util/windows/csproj.js
+++ b/src/util/windows/csproj.js
@@ -17,25 +17,25 @@
     under the License.
 */
 
-var xml_helpers = require('cordova-common').xmlHelpers,
-    et = require('elementtree'),
-    fs = require('fs'),
-    path = require('path');
+var xml_helpers = require('cordova-common').xmlHelpers;
+var et = require('elementtree');
+var fs = require('fs');
+var path = require('path');
 
-function csproj(location) {
+function csproj (location) {
     this.location = location;
     this.xml = xml_helpers.parseElementtreeSync(location);
     return this;
 }
 
 csproj.prototype = {
-    write:function() {
-        fs.writeFileSync(this.location, this.xml.write({indent:4}), 'utf-8');
+    write: function () {
+        fs.writeFileSync(this.location, this.xml.write({indent: 4}), 'utf-8');
     },
     // add/remove the item group for SDKReference
     // example :
     // <ItemGroup><SDKReference Include="MSAdvertising, Version=6.1" /></ItemGroup>
-    addSDKRef:function(incText) {
+    addSDKRef: function (incText) {
         var item_group = new et.Element('ItemGroup');
         var elem = new et.Element('SDKReference');
         elem.attrib.Include = incText;
@@ -44,13 +44,13 @@ csproj.prototype = {
         this.xml.getroot().append(item_group);
     },
 
-    removeSDKRef:function(incText) {
+    removeSDKRef: function (incText) {
         var item_group = this.xml.find('ItemGroup/SDKReference[@Include="' + incText + '"]/..');
-        if(item_group) {
+        if (item_group) {
             this.xml.getroot().remove(item_group);
         }
     },
-    addReference:function(relPath) {
+    addReference: function (relPath) {
         var item = new et.Element('ItemGroup');
         var extName = path.extname(relPath);
 
@@ -62,7 +62,7 @@ csproj.prototype = {
         hint_path.text = relPath;
         elem.append(hint_path);
 
-        if(extName == '.winmd') {
+        if (extName === '.winmd') {
             var mdFileTag = new et.Element('IsWinMDFile');
             mdFileTag.text = 'true';
             elem.append(mdFileTag);
@@ -73,19 +73,19 @@ csproj.prototype = {
         this.xml.getroot().append(item);
     },
 
-    removeReference:function(relPath) {
+    removeReference: function (relPath) {
         var extName = path.extname(relPath);
-        var includeText = path.basename(relPath,extName);
+        var includeText = path.basename(relPath, extName);
         // <ItemGroup>
         //   <Reference Include="WindowsRuntimeComponent1">
         var item_groups = this.xml.findall('ItemGroup/Reference[@Include="' + includeText + '"]/..');
 
-        if(item_groups.length > 0 ) {
+        if (item_groups.length > 0) {
             this.xml.getroot().remove(item_groups[0]);
         }
     },
 
-    addSourceFile:function(relative_path) {
+    addSourceFile: function (relative_path) {
         // we allow multiple paths to be passed at once as array so that
         // we don't create separate ItemGroup for each source file, CB-6874
         if (!(relative_path instanceof Array)) {
@@ -95,12 +95,12 @@ csproj.prototype = {
         // make ItemGroup to hold file.
         var item = new et.Element('ItemGroup');
         var me = this;
-        relative_path.forEach(function(filePath) {
+        relative_path.forEach(function (filePath) {
 
             filePath = filePath.split('/').join('\\');
             var extName = path.extname(filePath);
             // check if it's a .xaml page
-            if(extName == '.xaml') {
+            if (extName === '.xaml') {
                 var page = new et.Element('Page');
                 var sub_type = new et.Element('SubType');
 
@@ -112,14 +112,13 @@ csproj.prototype = {
                 gen.text = 'MSBuild:Compile';
                 page.append(gen);
                 var item_groups = me.xml.findall('ItemGroup');
-                if(item_groups.length === 0) {
+                if (item_groups.length === 0) {
                     item.append(page);
                 } else {
                     item_groups[0].append(page);
                 }
 
-            }
-            else if (extName == '.cs') {
+            } else if (extName === '.cs') {
                 compile = new et.Element('Compile');
                 compile.attrib.Include = filePath;
                 // check if it's a .xaml.cs page that would depend on a .xaml of the same name
@@ -131,8 +130,7 @@ csproj.prototype = {
                     compile.append(dep);
                 }
                 item.append(compile);
-            }
-            else { // otherwise add it normally
+            } else { // otherwise add it normally
                 compile = new et.Element('Content');
                 compile.attrib.Include = filePath;
                 item.append(compile);
@@ -141,7 +139,7 @@ csproj.prototype = {
         this.xml.getroot().append(item);
     },
 
-    removeSourceFile:function(relative_path) {
+    removeSourceFile: function (relative_path) {
         var isRegexp = relative_path instanceof RegExp;
 
         if (!isRegexp) {
@@ -151,25 +149,25 @@ csproj.prototype = {
 
         var root = this.xml.getroot();
         // iterate through all ItemGroup/Content elements and remove all items matched
-        this.xml.findall('ItemGroup').forEach(function(group){
+        this.xml.findall('ItemGroup').forEach(function (group) {
             // matched files in current ItemGroup
             var filesToRemove = group.findall('Compile').concat(group.findall('Page'))
-                .concat(group.findall('Content')).filter(function(item) {
+                .concat(group.findall('Content')).filter(function (item) {
                     if (!item.attrib.Include) return false;
                     return isRegexp ? item.attrib.Include.match(relative_path) :
-                        item.attrib.Include == relative_path;
+                        item.attrib.Include === relative_path;
                 });
 
             // nothing to remove, skip..
             if (filesToRemove.length < 1) return;
 
-            filesToRemove.forEach(function(file){
+            filesToRemove.forEach(function (file) {
                 // remove file reference
                 group.remove(file);
             });
 
             // remove ItemGroup if empty
-            if(group.findall('*').length < 1) {
+            if (group.findall('*').length < 1) {
                 root.remove(group);
             }
         });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/util/windows/jsprojManager.js
----------------------------------------------------------------------
diff --git a/src/util/windows/jsprojManager.js b/src/util/windows/jsprojManager.js
index 163ac42..c0aec68 100644
--- a/src/util/windows/jsprojManager.js
+++ b/src/util/windows/jsprojManager.js
@@ -17,25 +17,24 @@
  under the License.
  */
 
-/* jshint quotmark:false, unused:false */
-
 /*
  Helper for dealing with Windows Store JS app .jsproj files
  */
 
+var util = require('util');
+var xml_helpers = require('cordova-common').xmlHelpers;
+var et = require('elementtree');
+var fs = require('fs');
+var glob = require('glob');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var path = require('path');
+var semver = require('semver');
 
-var util = require('util'),
-    xml_helpers = require('cordova-common').xmlHelpers,
-    et = require('elementtree'),
-    fs = require('fs'),
-    glob = require('glob'),
-    shell = require('shelljs'),
-    events = require('cordova-common').events,
-    path = require('path'),
-    semver = require('semver');
+var WinCSharpProjectTypeGUID = '{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}'; // .csproj
+var WinCplusplusProjectTypeGUID = '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}'; // .vcxproj
 
-var WinCSharpProjectTypeGUID = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";  // .csproj
-var WinCplusplusProjectTypeGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";  // .vcxproj
+/* eslint-disable no-useless-escape */
 
 // Match a JavaScript Project
 var JsProjectRegEx = /(Project\("\{262852C6-CD72-467D-83FE-5EEB1973A190}"\)\s*=\s*"[^"]+",\s*"[^"]+",\s*"\{[0-9a-f\-]+}"[^\r\n]*[\r\n]*)/gi;
@@ -43,17 +42,18 @@ var JsProjectRegEx = /(Project\("\{262852C6-CD72-467D-83FE-5EEB1973A190}"\)\s*=\
 // Chars in a string that need to be escaped when used in a RegExp
 var RegExpEscRegExp = /([.?*+\^$\[\]\\(){}|\-])/g;
 
-function jsprojManager(location) {
-    this.isUniversalWindowsApp = path.extname(location).toLowerCase() === ".projitems";
+function jsprojManager (location) {
+    this.isUniversalWindowsApp = path.extname(location).toLowerCase() === '.projitems';
     this.projects = [];
-    this.master = this.isUniversalWindowsApp ? new proj(location) : new jsproj(location);
+    this.master = this.isUniversalWindowsApp ? new proj(location) : new jsproj(location); // eslint-disable-line new-cap
     this.projectFolder = path.dirname(location);
 }
+/* eslint-enable no-useless-escape */
 
-function getProjectName(pluginProjectXML, relative_path) {
-    var projNameElt = pluginProjectXML.find("PropertyGroup/ProjectName");
+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));
+    return projNameElt ? projNameElt.text : path.basename(relative_path, path.extname(relative_path));
 }
 
 jsprojManager.prototype = {
@@ -123,9 +123,9 @@ jsprojManager.prototype = {
         var children = [hint_path];
 
         var extName = path.extname(relPath);
-        if (extName === ".winmd") {
-            var mdFileTag = new et.Element("IsWinMDFile");
-            mdFileTag.text = "true";
+        if (extName === '.winmd') {
+            var mdFileTag = new et.Element('IsWinMDFile');
+            mdFileTag.text = 'true';
             children.push(mdFileTag);
         }
 
@@ -168,18 +168,18 @@ jsprojManager.prototype = {
         var pluginProjectXML = xml_helpers.parseElementtreeSync(relative_path);
 
         // find the guid + name of the referenced project
-        var projectGuid = pluginProjectXML.find("PropertyGroup/ProjectGuid").text;
+        var projectGuid = pluginProjectXML.find('PropertyGroup/ProjectGuid').text;
         var projName = getProjectName(pluginProjectXML, relative_path);
 
         // get the project type
         var projectTypeGuid = getProjectTypeGuid(relative_path);
         if (!projectTypeGuid) {
-            throw new Error("unrecognized project type");
+            throw new Error('unrecognized project type');
         }
 
-        var preInsertText = "\tProjectSection(ProjectDependencies) = postProject\r\n" +
-            "\t\t" + projectGuid + "=" + projectGuid + "\r\n" +
-            "\tEndProjectSection\r\n";
+        var preInsertText = '\tProjectSection(ProjectDependencies) = postProject\r\n' +
+            '\t\t' + projectGuid + '=' + projectGuid + '\r\n' +
+            '\tEndProjectSection\r\n';
         var postInsertText = '\r\nProject("' + projectTypeGuid + '") = "' +
             projName + '", "' + inserted_path + '", ' +
             '"' + projectGuid + '"\r\nEndProject';
@@ -195,7 +195,7 @@ jsprojManager.prototype = {
 
         // There may be multiple solution files (for different VS versions) - process them all
         getSolutionPaths(this.projectFolder).forEach(function (solutionPath) {
-            var solText = fs.readFileSync(solutionPath, {encoding: "utf8"});
+            var solText = fs.readFileSync(solutionPath, {encoding: 'utf8'});
 
             if (useProjItems) {
                 // Insert a project dependency into every jsproj in the solution.
@@ -206,7 +206,7 @@ jsprojManager.prototype = {
                 });
 
                 if (!jsProjectFound) {
-                    throw new Error("no jsproj found in solution");
+                    throw new Error('no jsproj found in solution');
                 }
             } else {
                 // Insert a project dependency only for projects that match specified target and version
@@ -219,14 +219,14 @@ jsprojManager.prototype = {
 
             // Add the project after existing projects. Note that this fairly simplistic check should be fine, since the last
             // EndProject in the file should actually be an EndProject (and not an EndProjectSection, for example).
-            var pos = solText.lastIndexOf("EndProject");
+            var pos = solText.lastIndexOf('EndProject');
             if (pos === -1) {
-                throw new Error("no EndProject found in solution");
+                throw new Error('no EndProject found in solution');
             }
             pos += 10; // Move pos to the end of EndProject text
             solText = solText.slice(0, pos) + postInsertText + solText.slice(pos);
 
-            fs.writeFileSync(solutionPath, solText, {encoding: "utf8"});
+            fs.writeFileSync(solutionPath, solText, {encoding: 'utf8'});
         });
 
         // Add the ItemGroup/ProjectReference to each matching cordova project :
@@ -247,13 +247,13 @@ 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 projectGuid = pluginProjectXML.find('PropertyGroup/ProjectGuid').text;
         var projName = getProjectName(pluginProjectXML, relative_path);
 
         // get the project type
         var projectTypeGuid = getProjectTypeGuid(relative_path);
         if (!projectTypeGuid) {
-            throw new Error("unrecognized project type");
+            throw new Error('unrecognized project type');
         }
 
         var preInsertTextRegExp = getProjectReferencePreInsertRegExp(projectGuid);
@@ -261,20 +261,20 @@ jsprojManager.prototype = {
 
         // There may be multiple solutions (for different VS versions) - process them all
         getSolutionPaths(this.projectFolder).forEach(function (solutionPath) {
-            var solText = fs.readFileSync(solutionPath, {encoding: "utf8"});
+            var solText = fs.readFileSync(solutionPath, {encoding: 'utf8'});
 
             // To be safe (to handle subtle changes in formatting, for example), use a RegExp to find and remove
             // preInsertText and postInsertText
 
             solText = solText.replace(preInsertTextRegExp, function () {
-                return "";
+                return '';
             });
 
             solText = solText.replace(postInsertTextRegExp, function () {
-                return "";
+                return '';
             });
 
-            fs.writeFileSync(solutionPath, solText, {encoding: "utf8"});
+            fs.writeFileSync(solutionPath, solText, {encoding: 'utf8'});
         });
 
         this._getMatchingProjects(targetConditions).forEach(function (project) {
@@ -304,7 +304,7 @@ jsprojManager.prototype = {
         return [this.master];
     },
 
-    get projects() {
+    get projects () {
         var projects = this._projects;
         if (!projects) {
             projects = [];
@@ -314,7 +314,7 @@ jsprojManager.prototype = {
                 var projectPath = this.projectFolder;
                 var projectFiles = glob.sync('*.jsproj', {cwd: projectPath});
                 projectFiles.forEach(function (projectFile) {
-                    projects.push(new jsproj(path.join(projectPath, projectFile)));
+                    projects.push(new jsproj(path.join(projectPath, projectFile))); // eslint-disable-line new-cap
                 });
             } else {
                 this.projects.push(this.master);
@@ -325,12 +325,12 @@ jsprojManager.prototype = {
     }
 };
 
-function getProjectReferencePreInsertRegExp(projectGuid) {
+function getProjectReferencePreInsertRegExp (projectGuid) {
     projectGuid = escapeRegExpString(projectGuid);
-    return new RegExp("\\s*ProjectSection\\(ProjectDependencies\\)\\s*=\\s*postProject\\s*" + projectGuid + "\\s*=\\s*" + projectGuid + "\\s*EndProjectSection", "gi");
+    return new RegExp('\\s*ProjectSection\\(ProjectDependencies\\)\\s*=\\s*postProject\\s*' + projectGuid + '\\s*=\\s*' + projectGuid + '\\s*EndProjectSection', 'gi');
 }
 
-function getProjectReferencePostInsertRegExp(projName, projectGuid, relative_path, projectTypeGuid) {
+function getProjectReferencePostInsertRegExp (projName, projectGuid, relative_path, projectTypeGuid) {
     projName = escapeRegExpString(projName);
     projectGuid = escapeRegExpString(projectGuid);
     relative_path = escapeRegExpString(relative_path);
@@ -338,31 +338,31 @@ function getProjectReferencePostInsertRegExp(projName, projectGuid, relative_pat
     return new RegExp('\\s*Project\\("' + projectTypeGuid + '"\\)\\s*=\\s*"' + projName + '"\\s*,\\s*"' + relative_path + '"\\s*,\\s*"' + projectGuid + '"\\s*EndProject', 'gi');
 }
 
-function getSolutionPaths(projectFolder) {
-    return shell.ls(path.join(projectFolder, "*.sln")); // TODO:error handling
+function getSolutionPaths (projectFolder) {
+    return shell.ls(path.join(projectFolder, '*.sln')); // TODO:error handling
 }
 
-function escapeRegExpString(regExpString) {
-    return regExpString.replace(RegExpEscRegExp, "\\$1");
+function escapeRegExpString (regExpString) {
+    return regExpString.replace(RegExpEscRegExp, '\\$1');
 }
 
-function getJsProjRegExForProject(projectFile) {
+function getJsProjRegExForProject (projectFile) {
     projectFile = escapeRegExpString(projectFile);
     return new RegExp('(Project\\("\\{262852C6-CD72-467D-83FE-5EEB1973A190}"\\)\\s*=\\s*"[^"]+",\\s*"' + projectFile + '",\\s*"\\{[0-9a-f\\-]+}"[^\\r\\n]*[\\r\\n]*)', 'gi');
 }
 
-function getProjectTypeGuid(projectPath) {
+function getProjectTypeGuid (projectPath) {
     switch (path.extname(projectPath)) {
-        case ".vcxproj":
-            return WinCplusplusProjectTypeGUID;
+    case '.vcxproj':
+        return WinCplusplusProjectTypeGUID;
 
-        case ".csproj":
-            return WinCSharpProjectTypeGUID;
+    case '.csproj':
+        return WinCSharpProjectTypeGUID;
     }
     return null;
 }
 
-function createItemGroupElement(path, incText, targetConditions, children) {
+function createItemGroupElement (path, incText, targetConditions, children) {
     path = path.split('/');
     path.reverse();
 
@@ -391,15 +391,15 @@ function createItemGroupElement(path, incText, targetConditions, children) {
     return lastElement;
 }
 
-function getDeviceTarget(targetConditions) {
+function getDeviceTarget (targetConditions) {
     var target = targetConditions.deviceTarget;
     if (target) {
         target = target.toLowerCase().trim();
-        if (target === "all") {
+        if (target === 'all') {
             target = null;
-        } else if (target === "win") {
+        } else if (target === 'win') {
             // Allow "win" as alternative to "windows"
-            target = "windows";
+            target = 'windows';
         } else if (target !== 'phone' && target !== 'windows') {
             throw new Error('Invalid device-target attribute (must be "all", "phone", "windows" or "win"): ' + target);
         }
@@ -407,7 +407,7 @@ function getDeviceTarget(targetConditions) {
     return target;
 }
 
-function getVersions(targetConditions) {
+function getVersions (targetConditions) {
     var versions = targetConditions.versions;
     if (versions && !semver.validRange(versions, /* loose */ true)) {
         throw new Error('Invalid versions attribute (must be a valid semantic version range): ' + versions);
@@ -415,10 +415,9 @@ function getVersions(targetConditions) {
     return versions;
 }
 
-
 /* proj */
 
-function proj(location) {
+function proj (location) {
     // Class to handle simple project xml operations
     if (!location) {
         throw new Error('Project file location can\'t be null or empty');
@@ -513,24 +512,23 @@ proj.prototype = {
     }
 };
 
-
 /* jsproj */
 
-function jsproj(location) {
-    function targetPlatformIdentifierToDevice(jsprojPlatform) {
-        var index = ["Windows", "WindowsPhoneApp", "UAP"].indexOf(jsprojPlatform);
+function jsproj (location) {
+    function targetPlatformIdentifierToDevice (jsprojPlatform) {
+        var index = ['Windows', 'WindowsPhoneApp', 'UAP'].indexOf(jsprojPlatform);
         if (index < 0) {
             throw new Error("Unknown TargetPlatformIdentifier '" + jsprojPlatform + "' in project file '" + location + "'");
         }
-        return ["windows", "phone", "windows"][index];
+        return ['windows', 'phone', 'windows'][index];
     }
 
-    function validateVersion(version) {
+    function validateVersion (version) {
         version = version.split('.');
         while (version.length < 3) {
-            version.push("0");
+            version.push('0');
         }
-        return version.join(".");
+        return version.join('.');
     }
 
     // Class to handle a jsproj file
@@ -566,20 +564,20 @@ jsproj.prototype.getSemVersion = function () {
     }
 
     return semVersion;
-	// Alternative approach could be replacing last dot with plus sign to
-	// be complaint w/ semver specification, for example
-	// 10.0.10240.0 -> 10.0.10240+0
+    // Alternative approach could be replacing last dot with plus sign to
+    // be complaint w/ semver specification, for example
+    // 10.0.10240.0 -> 10.0.10240+0
 };
 
 /* Common support functions */
 
-function createConditionAttrib(targetConditions) {
+function createConditionAttrib (targetConditions) {
     var arch = targetConditions.arch;
     if (arch) {
-        if (arch === "arm") {
+        if (arch === 'arm') {
             // Specifcally allow "arm" as alternative to "ARM"
-            arch = "ARM";
-        } else if (arch !== "x86" && arch !== "x64" && arch !== "ARM") {
+            arch = 'ARM';
+        } else if (arch !== 'x86' && arch !== 'x64' && arch !== 'ARM') {
             throw new Error('Invalid arch attribute (must be "x86", "x64" or "ARM"): ' + arch);
         }
         return "'$(Platform)'=='" + arch + "'";
@@ -587,5 +585,4 @@ function createConditionAttrib(targetConditions) {
     return null;
 }
 
-
 module.exports = jsprojManager;

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/templates/base.js
----------------------------------------------------------------------
diff --git a/templates/base.js b/templates/base.js
index b517b39..c89ca45 100644
--- a/templates/base.js
+++ b/templates/base.js
@@ -19,6 +19,6 @@
 
 var exec = require('cordova/exec');
 
-exports.coolMethod = function(arg0, success, error) {
-    exec(success, error, "%pluginName%", "coolMethod", [arg0]);
+exports.coolMethod = function (arg0, success, error) {
+    exec(success, error, '%pluginName%', 'coolMethod', [arg0]);
 };


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


[18/18] cordova-lib git commit: CB-12895 : updated integration tests with eslint format and rebased

Posted by au...@apache.org.
CB-12895 : updated integration tests with eslint format and rebased


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

Branch: refs/heads/master
Commit: d19951b3e37239f699c4f304c0fee8407d89d9c2
Parents: 17438d2
Author: Audrey So <au...@apache.org>
Authored: Tue Jul 25 10:59:31 2017 -0700
Committer: Audrey So <au...@apache.org>
Committed: Fri Jul 28 11:00:50 2017 -0700

----------------------------------------------------------------------
 integration-tests/HooksRunner.spec.js           |   40 +-
 integration-tests/fetch.spec.js                 |  188 +-
 integration-tests/pkgJson-restore.spec.js       | 2228 +++++++++---------
 integration-tests/pkgJson.spec.js               |  640 ++---
 integration-tests/platform.spec.js              |  346 ++-
 integration-tests/plugin.spec.js                |  232 +-
 integration-tests/plugin_fetch.spec.js          |   46 +-
 integration-tests/plugman_fetch.spec.js         |  133 +-
 integration-tests/plugman_uninstall.spec.js     |  321 +--
 .../platform/getPlatformDetailsFromDir.spec.js  |   20 +-
 spec/cordova/platform/remove.spec.js            |  118 +-
 src/hooks/HooksRunner.js                        |   11 +-
 src/plugman/init-defaults.js                    |    6 +-
 13 files changed, 2175 insertions(+), 2154 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/integration-tests/HooksRunner.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/HooksRunner.spec.js b/integration-tests/HooksRunner.spec.js
index 3a4c69c..eebbb63 100644
--- a/integration-tests/HooksRunner.spec.js
+++ b/integration-tests/HooksRunner.spec.js
@@ -17,20 +17,18 @@
  under the License.
  **/
 
-/* jshint boss:true */
-
-var cordova = require('../src/cordova/cordova'),
-    HooksRunner = require('../src/hooks/HooksRunner'),
-    shell = require('shelljs'),
-    path = require('path'),
-    fs = require('fs'),
-    os = require('os'),
-    Q = require('q'),
-    child_process = require('child_process'),
-    helpers = require('../spec/helpers'),
-    PluginInfo = require('cordova-common').PluginInfo,
-    superspawn = require('cordova-common').superspawn,
-    config = require('../src/cordova/config');
+var cordova = require('../src/cordova/cordova');
+var HooksRunner = require('../src/hooks/HooksRunner');
+var shell = require('shelljs');
+var path = require('path');
+var fs = require('fs');
+var os = require('os');
+var Q = require('q');
+var child_process = require('child_process');
+var helpers = require('../spec/helpers');
+var PluginInfo = require('cordova-common').PluginInfo;
+var superspawn = require('cordova-common').superspawn;
+var config = require('../src/cordova/config');
 
 var platform = os.platform();
 var tmpDir = helpers.tmpDir('hooks_test');
@@ -85,18 +83,18 @@ describe('HooksRunner', function () {
     });
 
     afterEach(function () {
-        process.chdir(path.join(__dirname, '..'));  // Non e2e tests assume CWD is repo root.
+        process.chdir(path.join(__dirname, '..')); // Non e2e tests assume CWD is repo root.
     });
 
     it('Test 001 : should throw if provided directory is not a cordova project', function () {
         expect(function () {
-            new HooksRunner(tmpDir);
+            new HooksRunner(tmpDir); // eslint-disable-line no-new
         }).toThrow();
     });
 
     it('Test 002 : should not throw if provided directory is a cordova project', function () {
         expect(function () {
-            new HooksRunner(project);
+            new HooksRunner(project); // eslint-disable-line no-new
         }).not.toThrow();
     });
 
@@ -179,9 +177,11 @@ describe('HooksRunner', function () {
             var orderArrOriginal = order.split(' ').slice(0);
 
             function splitNumbers (mixedString) {
-                var re = /\w+/g, match, params = [];
+                var re = /\w+/g;
+                var match;
+                var params = [];
 
-                while (match = re.exec(mixedString)) {
+                while (match = re.exec(mixedString)) { // eslint-disable-line no-cond-assign
                     params.push(match[0]);
                 }
                 return params;
@@ -664,7 +664,7 @@ describe('HooksRunner', function () {
 
     // Cleanup. Must be the last spec. Is there a better place for final cleanup in Jasmine?
     it('Test 025 : should not fail during cleanup', function () {
-        process.chdir(path.join(__dirname, '..'));  // Non e2e tests assume CWD is repo root.
+        process.chdir(path.join(__dirname, '..')); // Non e2e tests assume CWD is repo root.
         if (ext == 'sh') {
             shell.rm('-rf', tmpDir);
         } else { // Windows:

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/integration-tests/fetch.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/fetch.spec.js b/integration-tests/fetch.spec.js
index b3fe45c..d3de921 100644
--- a/integration-tests/fetch.spec.js
+++ b/integration-tests/fetch.spec.js
@@ -17,13 +17,13 @@
     under the License.
 */
 
-var path = require('path'),
-    shell = require('shelljs'),
-    helpers = require('../spec/helpers'),
-    cordova = require('../src/cordova/cordova');
+var path = require('path');
+var shell = require('shelljs');
+var helpers = require('../spec/helpers');
+var cordova = require('../src/cordova/cordova');
 
-var TIMEOUT = 90000,
-    plugins_dir = path.join(__dirname, '..', 'spec', 'plugman', 'plugins');
+var TIMEOUT = 90000;
+var plugins_dir = path.join(__dirname, '..', 'spec', 'plugman', 'plugins');
 
 var plugins = {
     'Test1': path.join(plugins_dir, 'dependencies', 'Test1'),
@@ -43,119 +43,119 @@ describe('end-to-end plugin dependency tests', function () {
     });
 
     afterEach(function () {
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
     it('Test 029 : should fail if dependency already installed is wrong version', function (done) {
         cordova.create('hello3')
-        .then(function () {
-            process.chdir(project);
-            return cordova.platform('add', 'android', {'fetch': true});
-        }).then(function () {
-            return cordova.plugin('add', 'cordova-plugin-file', {'fetch': true});
-        }).then(function () {
-            expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
-            return cordova.plugin('add', plugins['Test1'], {'fetch': true});
-        }).fail(function (err) {
-            expect(err.message).toContain('does not satisfy dependency plugin requirement');
-        })
-        .fin(done);
+            .then(function () {
+                process.chdir(project);
+                return cordova.platform('add', 'android', {'fetch': true});
+            }).then(function () {
+                return cordova.plugin('add', 'cordova-plugin-file', {'fetch': true});
+            }).then(function () {
+                expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+                return cordova.plugin('add', plugins['Test1'], {'fetch': true});
+            }).fail(function (err) {
+                expect(err.message).toContain('does not satisfy dependency plugin requirement');
+            })
+            .fin(done);
     }, TIMEOUT);
 
     it('Test 030 : should pass if dependency already installed is wrong version with --force', function (done) {
         cordova.create('hello3')
-        .then(function () {
-            process.chdir(project);
-            return cordova.platform('add', 'android', {'fetch': true});
-        })
-        .then(function () {
-            return cordova.plugin('add', 'cordova-plugin-file', {'fetch': true});
-        })
-        .then(function () {
-            expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
-            return cordova.plugin('add', plugins['Test1'], {'fetch': true, 'force': true});
-        })
-        .then(function () {
-            expect(path.join(pluginsDir, 'Test1')).toExist();
-        })
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                process.chdir(project);
+                return cordova.platform('add', 'android', {'fetch': true});
+            })
+            .then(function () {
+                return cordova.plugin('add', 'cordova-plugin-file', {'fetch': true});
+            })
+            .then(function () {
+                expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+                return cordova.plugin('add', plugins['Test1'], {'fetch': true, 'force': true});
+            })
+            .then(function () {
+                expect(path.join(pluginsDir, 'Test1')).toExist();
+            })
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, TIMEOUT);
 
     it('Test 031 : should pass if dependency already installed is same major version (if specific version is specified)', function (done) {
         // Test1 requires cordova-plugin-file version 2.0.0 (which should automatically turn into ^2.0.0); we'll install version 2.1.0
         cordova.create('hello3')
-        .then(function () {
-            process.chdir(project);
-            return cordova.platform('add', 'android', {'fetch': true});
-        })
-        .then(function () {
-            return cordova.plugin('add', 'cordova-plugin-file@2.1.0', {'fetch': true});
-        })
-        .then(function () {
-            expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
-            return cordova.plugin('add', plugins['Test1'], {'fetch': true});
-        })
-        .then(function () {
-            expect(path.join(pluginsDir, 'Test1')).toExist();
-        })
-        .fail(function (err) {
-            // console.error(err);
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                process.chdir(project);
+                return cordova.platform('add', 'android', {'fetch': true});
+            })
+            .then(function () {
+                return cordova.plugin('add', 'cordova-plugin-file@2.1.0', {'fetch': true});
+            })
+            .then(function () {
+                expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+                return cordova.plugin('add', plugins['Test1'], {'fetch': true});
+            })
+            .then(function () {
+                expect(path.join(pluginsDir, 'Test1')).toExist();
+            })
+            .fail(function (err) {
+                // console.error(err);
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, TIMEOUT);
 
     it('Test 032 : should handle two plugins with same dependent plugin', function (done) {
         // Test1 and Test2 have compatible dependencies on cordova-plugin-file
         // Test1 and Test3 have incompatible dependencies on cordova-plugin-file
         cordova.create('hello3')
-        .then(function () {
-            process.chdir(project);
-            return cordova.platform('add', 'android', {'fetch': true});
-        })
-        .then(function () {
-            return cordova.plugin('add', plugins['Test1'], {'fetch': true});
-        })
-        .then(function () {
-            expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
-            expect(path.join(pluginsDir, 'Test1')).toExist();
-            return cordova.plugin('add', plugins['Test2'], {'fetch': true});
-        })
-        .then(function () {
-            return cordova.plugin('add', plugins['Test3'], {'fetch': true});
-        })
-        .fail(function (err) {
-            expect(path.join(pluginsDir, 'Test2')).toExist();
-            expect(path.join(pluginsDir, 'Test3')).not.toExist();
-            expect(err.message).toContain('does not satisfy dependency plugin requirement');
-        }, TIMEOUT)
-        .fin(done);
+            .then(function () {
+                process.chdir(project);
+                return cordova.platform('add', 'android', {'fetch': true});
+            })
+            .then(function () {
+                return cordova.plugin('add', plugins['Test1'], {'fetch': true});
+            })
+            .then(function () {
+                expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+                expect(path.join(pluginsDir, 'Test1')).toExist();
+                return cordova.plugin('add', plugins['Test2'], {'fetch': true});
+            })
+            .then(function () {
+                return cordova.plugin('add', plugins['Test3'], {'fetch': true});
+            })
+            .fail(function (err) {
+                expect(path.join(pluginsDir, 'Test2')).toExist();
+                expect(path.join(pluginsDir, 'Test3')).not.toExist();
+                expect(err.message).toContain('does not satisfy dependency plugin requirement');
+            }, TIMEOUT)
+            .fin(done);
     }, TIMEOUT);
 
     it('Test 033 : should use a dev version of a dependent plugin if it is already installed', function (done) {
         // Test4 has this dependency in its plugin.xml:
         // <dependency id="cordova-plugin-file" url="https://github.com/apache/cordova-plugin-file" />
         cordova.create('hello3')
-        .then(function () {
-            process.chdir(project);
-            return cordova.platform('add', 'android', {'fetch': true});
-        })
-        .then(function () {
-            return cordova.plugin('add', 'https://github.com/apache/cordova-plugin-file');
-        })
-        .then(function () {
-            return cordova.plugin('add', plugins['Test4'], {'fetch': true});
-        })
-        .then(function () {
-            expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
-            expect(path.join(pluginsDir, 'Test4')).toExist();
-        }, function (error) {
-            fail(error);
-        })
-        .fin(done);
+            .then(function () {
+                process.chdir(project);
+                return cordova.platform('add', 'android', {'fetch': true});
+            })
+            .then(function () {
+                return cordova.plugin('add', 'https://github.com/apache/cordova-plugin-file');
+            })
+            .then(function () {
+                return cordova.plugin('add', plugins['Test4'], {'fetch': true});
+            })
+            .then(function () {
+                expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+                expect(path.join(pluginsDir, 'Test4')).toExist();
+            }, function (error) {
+                fail(error);
+            })
+            .fin(done);
     }, TIMEOUT);
 });


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


[03/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/platforms/blackberry10.js
----------------------------------------------------------------------
diff --git a/src/plugman/platforms/blackberry10.js b/src/plugman/platforms/blackberry10.js
index c3d0310..55853da 100644
--- a/src/plugman/platforms/blackberry10.js
+++ b/src/plugman/platforms/blackberry10.js
@@ -17,79 +17,76 @@
     under the License.
 */
 
-/* jshint laxcomma:true, sub:true */
-
-var path = require('path')
-   , common = require('./common')
-   , events = require('cordova-common').events
-   , xml_helpers = require('cordova-common').xmlHelpers
-   ;
+var path = require('path');
+var common = require('./common');
+var events = require('cordova-common').events;
+var xml_helpers = require('cordova-common').xmlHelpers;
 
 var TARGETS = ['device', 'simulator'];
 
 module.exports = {
-    www_dir:function(project_dir) {
+    www_dir: function (project_dir) {
         return path.join(project_dir, 'www');
     },
-    package_name:function(project_dir) {
+    package_name: function (project_dir) {
         var config_path = path.join(module.exports.www_dir(project_dir), 'config.xml');
         var widget_doc = xml_helpers.parseElementtreeSync(config_path);
         return widget_doc._root.attrib['id'];
     },
-    'source-file':{
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+    'source-file': {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             var src = obj.src;
             var target = obj.targetDir || plugin_id;
-            TARGETS.forEach(function(arch) {
+            TARGETS.forEach(function (arch) {
                 var dest = path.join('native', arch, 'chrome', 'plugin', target, path.basename(src));
 
                 common.copyNewFile(plugin_dir, src, project_dir, dest);
             });
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             var src = obj.src;
             var target = obj.targetDir || plugin_id;
-            TARGETS.forEach(function(arch) {
+            TARGETS.forEach(function (arch) {
                 var dest = path.join('native', arch, 'chrome', 'plugin', target, path.basename(src));
                 common.removeFile(project_dir, dest);
             });
         }
     },
     'header-file': {
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.install is not supported for blackberry');
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.uninstall is not supported for blackberry');
         }
     },
-    'lib-file':{
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+    'lib-file': {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             var src = obj.src;
             var arch = obj.arch;
             var dest = path.join('native', arch, 'plugins', 'jnext', path.basename(src));
             common.copyFile(plugin_dir, src, project_dir, dest, false);
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             var src = obj.src;
             var arch = obj.arch;
             var dest = path.join('native', arch, 'plugins', 'jnext', path.basename(src));
             common.removeFile(project_dir, dest);
         }
     },
-    'resource-file':{
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+    'resource-file': {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'resource-file.install is not supported for blackberry');
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'resource-file.uninstall is not supported for blackberry');
         }
     },
     'framework': {
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.install is not supported for blackberry');
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.uninstall is not supported for blackberry');
         }
     }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/platforms/browser.js
----------------------------------------------------------------------
diff --git a/src/plugman/platforms/browser.js b/src/plugman/platforms/browser.js
index 3aaa961..5006127 100644
--- a/src/plugman/platforms/browser.js
+++ b/src/plugman/platforms/browser.js
@@ -17,59 +17,56 @@
     under the License.
 */
 
-/* jshint laxcomma:true, sub:true */
-
-var path = require('path')
-    , common = require('./common')
-    , events = require('cordova-common').events
-    ;
+var path = require('path');
+var common = require('./common');
+var events = require('cordova-common').events;
 
 module.exports = {
-    www_dir: function(project_dir) {
+    www_dir: function (project_dir) {
         return path.join(project_dir, 'www');
     },
-    package_name:function(project_dir) {
+    package_name: function (project_dir) {
         return common.package_name(project_dir, this.www_dir(project_dir));
     },
-    'source-file':{
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+    'source-file': {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             var dest = path.join(obj.targetDir, path.basename(obj.src));
             common.copyFile(plugin_dir, obj.src, project_dir, dest);
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             var dest = path.join(obj.targetDir, path.basename(obj.src));
             common.removeFile(project_dir, dest);
         }
     },
     'header-file': {
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-fileinstall is not supported for browser');
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'header-file.uninstall is not supported for browser');
         }
     },
-    'resource-file':{
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+    'resource-file': {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'resource-file.install is not supported for browser');
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'resource-file.uninstall is not supported for browser');
         }
     },
     'framework': {
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.install is not supported for browser');
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.uninstall is not supported for browser');
         }
     },
     'lib-file': {
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'lib-file.install is not supported for browser');
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'lib-file.uninstall is not supported for browser');
         }
     }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/platforms/common.js
----------------------------------------------------------------------
diff --git a/src/plugman/platforms/common.js b/src/plugman/platforms/common.js
index 29d5df6..4e03b6b 100644
--- a/src/plugman/platforms/common.js
+++ b/src/plugman/platforms/common.js
@@ -17,23 +17,23 @@
     under the License.
 */
 
-var shell = require('shelljs'),
-    path  = require('path'),
-    fs    = require('fs'),
-    common;
+var shell = require('shelljs');
+var path = require('path');
+var fs = require('fs');
+var common;
 
 var cordovaUtil = require('../../cordova/util');
 var CordovaError = require('cordova-common').CordovaError;
 var xmlHelpers = require('cordova-common').xmlHelpers;
 
 module.exports = common = {
-    package_name: function(project_dir, www_dir) {
+    package_name: function (project_dir, www_dir) {
 
         var configPaths = [
             // preferred location if cordova >= 3.4
             path.join(project_dir, 'config.xml'),
             // older location
-            path.join(www_dir || path.join(project_dir, 'www'), 'config.xml'),
+            path.join(www_dir || path.join(project_dir, 'www'), 'config.xml')
         ];
 
         var cordovaRoot = cordovaUtil.isCordova();
@@ -56,30 +56,28 @@ module.exports = common = {
             'the following directories:\n\t' + configPaths.join('\n\t'));
     },
     // helper for resolving source paths from plugin.xml
-    resolveSrcPath:function(plugin_dir, relative_path) {
+    resolveSrcPath: function (plugin_dir, relative_path) {
         var full_path = path.resolve(plugin_dir, relative_path);
         return full_path;
     },
     // helper for resolving target paths from plugin.xml into a cordova project
-    resolveTargetPath:function(project_dir, relative_path) {
+    resolveTargetPath: function (project_dir, relative_path) {
         var full_path = path.resolve(project_dir, relative_path);
         return full_path;
     },
-    copyFile:function(plugin_dir, src, project_dir, dest, link) {
+    copyFile: function (plugin_dir, src, project_dir, dest, link) {
         src = module.exports.resolveSrcPath(plugin_dir, src);
         if (!fs.existsSync(src)) throw new Error('"' + src + '" not found!');
 
         // check that src path is inside plugin directory
         var real_path = fs.realpathSync(src);
         var real_plugin_path = fs.realpathSync(plugin_dir);
-        if (real_path.indexOf(real_plugin_path) !== 0)
-            throw new Error('"' + src + '" not located within plugin!');
+        if (real_path.indexOf(real_plugin_path) !== 0) { throw new Error('"' + src + '" not located within plugin!'); }
 
         dest = module.exports.resolveTargetPath(project_dir, dest);
 
         // check that dest path is located in project directory
-        if (dest.indexOf(project_dir) !== 0)
-            throw new Error('"' + dest + '" not located within project!');
+        if (dest.indexOf(project_dir) !== 0) { throw new Error('"' + dest + '" not located within project!'); }
 
         shell.mkdir('-p', path.dirname(dest));
 
@@ -87,48 +85,46 @@ module.exports = common = {
             common.symlinkFileOrDirTree(src, dest);
         } else if (fs.statSync(src).isDirectory()) {
             // XXX shelljs decides to create a directory when -R|-r is used which sucks. http://goo.gl/nbsjq
-            shell.cp('-Rf', src+'/*', dest);
+            shell.cp('-Rf', src + '/*', dest);
         } else {
             shell.cp('-f', src, dest);
         }
     },
     // Same as copy file but throws error if target exists
-    copyNewFile:function(plugin_dir, src, project_dir, dest, link) {
+    copyNewFile: function (plugin_dir, src, project_dir, dest, link) {
         var target_path = common.resolveTargetPath(project_dir, dest);
-        if (fs.existsSync(target_path))
-            throw new Error('"' + target_path + '" already exists!');
+        if (fs.existsSync(target_path)) { throw new Error('"' + target_path + '" already exists!'); }
 
         common.copyFile(plugin_dir, src, project_dir, dest, !!link);
     },
-    symlinkFileOrDirTree:function symlinkFileOrDirTree(src, dest) {
-            if (fs.existsSync(dest)) {
-                shell.rm('-Rf', dest);
-            }
-            
-            if (fs.statSync(src).isDirectory()) {
-                shell.mkdir('-p', dest);
-                fs.readdirSync(src).forEach(function(entry) {
-                    symlinkFileOrDirTree(path.join(src, entry), path.join(dest, entry));
-                });
-            }
-            else {
-                fs.symlinkSync(path.relative(fs.realpathSync(path.dirname(dest)), src), dest);
-            }
+    symlinkFileOrDirTree: function symlinkFileOrDirTree (src, dest) {
+        if (fs.existsSync(dest)) {
+            shell.rm('-Rf', dest);
+        }
+
+        if (fs.statSync(src).isDirectory()) {
+            shell.mkdir('-p', dest);
+            fs.readdirSync(src).forEach(function (entry) {
+                symlinkFileOrDirTree(path.join(src, entry), path.join(dest, entry));
+            });
+        } else {
+            fs.symlinkSync(path.relative(fs.realpathSync(path.dirname(dest)), src), dest);
+        }
     },
     // checks if file exists and then deletes. Error if doesn't exist
-    removeFile:function(project_dir, src) {
+    removeFile: function (project_dir, src) {
         var file = module.exports.resolveSrcPath(project_dir, src);
         shell.rm('-Rf', file);
     },
     // deletes file/directory without checking
-    removeFileF:function(file) {
+    removeFileF: function (file) {
         shell.rm('-Rf', file);
     },
     // Sometimes we want to remove some java, and prune any unnecessary empty directories
-    deleteJava:function(project_dir, destFile) {
+    deleteJava: function (project_dir, destFile) {
         common.removeFileAndParents(project_dir, destFile, 'src');
     },
-    removeFileAndParents:function(baseDir, destFile, stopper) {
+    removeFileAndParents: function (baseDir, destFile, stopper) {
         stopper = stopper || '.';
         var file = path.resolve(baseDir, destFile);
         if (!fs.existsSync(file)) return;
@@ -138,8 +134,8 @@ module.exports = common = {
         // check if directory is empty
         var curDir = path.dirname(file);
 
-        while(curDir !== path.resolve(baseDir, stopper)) {
-            if(fs.existsSync(curDir) && fs.readdirSync(curDir).length === 0) {
+        while (curDir !== path.resolve(baseDir, stopper)) {
+            if (fs.existsSync(curDir) && fs.readdirSync(curDir).length === 0) {
                 fs.rmdirSync(curDir);
                 curDir = path.resolve(curDir, '..');
             } else {
@@ -149,8 +145,8 @@ module.exports = common = {
         }
     },
     // handle <asset> elements
-    asset:{
-        install:function(asset, plugin_dir, www_dir) {
+    asset: {
+        install: function (asset, plugin_dir, www_dir) {
             if (!asset.src) {
                 throw new Error('<asset> tag without required "src" attribute. plugin=' + plugin_dir);
             }
@@ -160,7 +156,7 @@ module.exports = common = {
 
             common.copyFile(plugin_dir, asset.src, www_dir, asset.target);
         },
-        uninstall:function(asset, www_dir, plugin_id) {
+        uninstall: function (asset, www_dir, plugin_id) {
             var target = asset.target || asset.src;
 
             if (!target) {
@@ -177,7 +173,7 @@ module.exports = common = {
             var moduleSource = path.resolve(plugin_dir, jsModule.src);
             // Get module name based on existing 'name' attribute or filename
             // Must use path.extname/path.basename instead of path.parse due to CB-9981
-            var moduleName = plugin_id + '.' + (jsModule.name || path.basename(jsModule.src, path.extname (jsModule.src)));
+            var moduleName = plugin_id + '.' + (jsModule.name || path.basename(jsModule.src, path.extname(jsModule.src)));
 
             // Read in the file, prepend the cordova.define, and write it back out.
             var scriptContent = fs.readFileSync(moduleSource, 'utf-8').replace(/^\ufeff/, ''); // Window BOM

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/platforms/tizen.js
----------------------------------------------------------------------
diff --git a/src/plugman/platforms/tizen.js b/src/plugman/platforms/tizen.js
index 7b7cc0f..42103f4 100644
--- a/src/plugman/platforms/tizen.js
+++ b/src/plugman/platforms/tizen.js
@@ -17,18 +17,16 @@
     under the License.
 */
 
-/* jshint laxcomma:true, sub:true */
-
-var path = require('path')
-    , fs = require('fs')
-    , events = require('cordova-common').events
-    , xml_helpers = require('cordova-common').xmlHelpers;
+var path = require('path');
+var fs = require('fs');
+var events = require('cordova-common').events;
+var xml_helpers = require('cordova-common').xmlHelpers;
 
 module.exports = {
-    www_dir: function(project_dir) {
+    www_dir: function (project_dir) {
         return path.join(project_dir, 'www');
     },
-    package_name:function(project_dir) {
+    package_name: function (project_dir) {
         // preferred location if cordova >= 3.4
         var preferred_path = path.join(project_dir, 'config.xml');
         var config_path;
@@ -38,7 +36,7 @@ module.exports = {
             if (!fs.existsSync(old_config_path)) {
                 // output newer location and fail reading
                 config_path = preferred_path;
-                events.emit('verbose', 'unable to find '+config_path);
+                events.emit('verbose', 'unable to find ' + config_path);
             } else {
                 config_path = old_config_path;
             }
@@ -48,24 +46,24 @@ module.exports = {
         var widget_doc = xml_helpers.parseElementtreeSync(config_path);
         return widget_doc._root.attrib['id'];
     },
-    'source-file':{
-        install: function(obj, plugin_dir, project_dir, plugin_id, options) {},
-        uninstall: function(obj, project_dir, plugin_id, options) {}
+    'source-file': {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {},
+        uninstall: function (obj, project_dir, plugin_id, options) {}
     },
     'header-file': {
-        install: function(obj, plugin_dir, project_dir, plugin_id, options) {},
-        uninstall: function(obj, project_dir, plugin_id, options) {}
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {},
+        uninstall: function (obj, project_dir, plugin_id, options) {}
     },
-    'resource-file':{
-        install: function(obj, plugin_dir, project_dir, plugin_id, options) {},
-        uninstall: function(obj, project_dir, plugin_id, options) {}
+    'resource-file': {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {},
+        uninstall: function (obj, project_dir, plugin_id, options) {}
     },
     'framework': {
-        install: function(obj, plugin_dir, project_dir, plugin_id, options) {},
-        uninstall: function(obj, project_dir, plugin_id, options) {}
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {},
+        uninstall: function (obj, project_dir, plugin_id, options) {}
     },
     'lib-file': {
-        install: function(obj, plugin_dir, project_dir, plugin_id, options) {},
-        uninstall: function(obj, project_dir, plugin_id, options) {}
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {},
+        uninstall: function (obj, project_dir, plugin_id, options) {}
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/platforms/ubuntu.js
----------------------------------------------------------------------
diff --git a/src/plugman/platforms/ubuntu.js b/src/plugman/platforms/ubuntu.js
index 6947330..6ab58a8 100644
--- a/src/plugman/platforms/ubuntu.js
+++ b/src/plugman/platforms/ubuntu.js
@@ -17,22 +17,20 @@
  *
 */
 
-/* jshint laxcomma:true, sub:true */
-
-function replaceAt(str, index, char) {
+function replaceAt (str, index, char) {
     return str.substr(0, index) + char + str.substr(index + char.length);
 }
 
-function toCamelCase(str) {
-    return str.split('-').map(function(str) {
+function toCamelCase (str) {
+    return str.split('-').map(function (str) {
         return replaceAt(str, 0, str[0].toUpperCase());
     }).join('');
 }
 
-function getPluginXml(plugin_dir) {
-    var et = require('elementtree'),
-    fs = require('fs'),
-    path = require('path');
+function getPluginXml (plugin_dir) {
+    var et = require('elementtree');
+    var fs = require('fs');
+    var path = require('path');
 
     var pluginxml;
     var config_path = path.join(plugin_dir, 'plugin.xml');
@@ -41,14 +39,13 @@ function getPluginXml(plugin_dir) {
         // Get the current plugin.xml file
         pluginxml = et.parse(fs.readFileSync(config_path, 'utf-8'));
     }
- 
+
     return pluginxml;
 }
 
-function findClassName(pluginxml, plugin_id) {
+function findClassName (pluginxml, plugin_id) {
     var class_name;
 
-    /* jshint ignore:start */
     // first check if we have a class-name parameter in the plugin config
     if (pluginxml) {
         var platform = pluginxml.find("./platform/[@name='ubuntu']/");
@@ -69,7 +66,7 @@ function findClassName(pluginxml, plugin_id) {
         class_name = plugin_id.match(/\.[^.]+$/)[0].substr(1);
     } else {
         // new-style (NPM registry)
-        var match = plugin_id.match(/cordova\-plugin\-([\w\-]+)$/);
+        var match = plugin_id.match(/cordova\-plugin\-([\w\-]+)$/); // eslint-disable-line no-useless-escape
         if (match && match.length > 0) {
             class_name = match[0].substr(15);
         } else {
@@ -84,32 +81,32 @@ function findClassName(pluginxml, plugin_id) {
     return toCamelCase(class_name);
 }
 
-var shell = require('shelljs')
-   , fs = require('fs')
-   , path = require('path')
-   , common = require('./common')
-   , events = require('cordova-common').events
-   , xml_helpers = require('cordova-common').xmlHelpers;
+var shell = require('shelljs');
+var fs = require('fs');
+var path = require('path');
+var common = require('./common');
+var events = require('cordova-common').events;
+var xml_helpers = require('cordova-common').xmlHelpers;
 
 module.exports = {
-    www_dir:function(project_dir) {
+    www_dir: function (project_dir) {
         return path.join(project_dir, 'www');
     },
 
-    package_name:function (project_dir) {
+    package_name: function (project_dir) {
         var config_path = path.join(project_dir, 'config.xml');
         var widget_doc = xml_helpers.parseElementtreeSync(config_path);
         return widget_doc._root.attrib['id'];
     },
-    'source-file':{
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+    'source-file': {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             var dest = path.join('build', 'src', 'plugins', plugin_id, path.basename(obj.src));
             common.copyFile(plugin_dir, obj.src, project_dir, dest);
 
             var cmake = path.join(project_dir, 'build', 'CMakeLists.txt');
             shell.exec('touch ' + cmake);
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
             shell.rm(path.join(dest, path.basename(obj.src)));
 
@@ -117,63 +114,61 @@ module.exports = {
             shell.exec('touch ' + cmake);
         }
     },
-    'header-file':{
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+    'header-file': {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             var dest = path.join('build', 'src', 'plugins', plugin_id, path.basename(obj.src));
             common.copyFile(plugin_dir, obj.src, project_dir, dest);
 
             var plugins = path.join(project_dir, 'build', 'src', 'coreplugins.cpp');
             var src = String(fs.readFileSync(plugins));
 
-            src = src.replace('INSERT_HEADER_HERE', '#include "plugins/' + plugin_id + '/' + path.basename(obj.src) +'"\nINSERT_HEADER_HERE');
+            src = src.replace('INSERT_HEADER_HERE', '#include "plugins/' + plugin_id + '/' + path.basename(obj.src) + '"\nINSERT_HEADER_HERE');
 
-            var pluginxml  = getPluginXml(plugin_dir);
+            var pluginxml = getPluginXml(plugin_dir);
             var class_name = findClassName(pluginxml, plugin_id);
             src = src.replace('INSERT_PLUGIN_HERE', 'INIT_PLUGIN(' + class_name + ');INSERT_PLUGIN_HERE');
 
             fs.writeFileSync(plugins, src);
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
             shell.rm(path.join(dest, path.basename(obj.src)));
 
             var plugins = path.join(project_dir, 'build', 'src', 'coreplugins.cpp');
             var src = String(fs.readFileSync(plugins));
 
-            src = src.replace('#include "plugins/' + plugin_id + '/' + path.basename(obj.src) +'"', '');
+            src = src.replace('#include "plugins/' + plugin_id + '/' + path.basename(obj.src) + '"', '');
             var class_name = findClassName(undefined, plugin_id);
             src = src.replace('INIT_PLUGIN(' + class_name + ');', '');
 
             fs.writeFileSync(plugins, src);
         }
     },
-    'resource-file':{
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+    'resource-file': {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             var dest = path.join('qml', path.basename(obj.src));
-            if (obj.targetDir)
-                dest = path.join(obj.targetDir, path.basename(obj.src));
+            if (obj.targetDir) { dest = path.join(obj.targetDir, path.basename(obj.src)); }
             common.copyFile(plugin_dir, obj.src, project_dir, dest);
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             var dest = path.join(project_dir, 'qml');
-            if (obj.targetDir)
-                dest = path.join(project_dir, obj.targetDir);
+            if (obj.targetDir) { dest = path.join(project_dir, obj.targetDir); }
             shell.rm(path.join(dest, path.basename(obj.src)));
         }
     },
     'framework': {
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.install is not supported for ubuntu');
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'framework.uninstall is not supported for ubuntu');
         }
     },
     'lib-file': {
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             events.emit('verbose', 'lib-file.install is not supported for ubuntu');
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             events.emit('verbose', 'lib-file.uninstall is not supported for ubuntu');
         }
     }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/platforms/webos.js
----------------------------------------------------------------------
diff --git a/src/plugman/platforms/webos.js b/src/plugman/platforms/webos.js
index 183ea82..1221b64 100755
--- a/src/plugman/platforms/webos.js
+++ b/src/plugman/platforms/webos.js
@@ -17,62 +17,56 @@
     under the License.
 */
 
-/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
-          indent:4, unused:vars, latedef:nofunc,
-          laxcomma:true, sub:true
-*/
-
-var path = require('path')
-    , common = require('./common')
-    , events = require('cordova-common').events
-    ;
+var path = require('path');
+var common = require('./common');
+var events = require('cordova-common').events;
 
 module.exports = {
-    www_dir: function(project_dir) {
+    www_dir: function (project_dir) {
         return path.join(project_dir, 'www');
     },
-    package_name:function(project_dir) {
+    package_name: function (project_dir) {
         return common.package_name(project_dir, this.www_dir(project_dir));
     },
-    'source-file':{
-        install:function(obj, plugin_dir, project_dir, plugin_id, options) {
+    'source-file': {
+        install: function (obj, plugin_dir, project_dir, plugin_id, options) {
             var dest = path.join(obj.targetDir, path.basename(obj.src));
             common.copyFile(plugin_dir, obj.src, project_dir, dest);
         },
-        uninstall:function(obj, project_dir, plugin_id, options) {
+        uninstall: function (obj, project_dir, plugin_id, options) {
             var dest = path.join(obj.targetDir, path.basename(obj.src));
             common.removeFile(project_dir, dest);
         }
     },
     'header-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id) {
+        install: function (source_el, plugin_dir, project_dir, plugin_id) {
             events.emit('verbose', 'header-fileinstall is not supported for webos');
         },
-        uninstall:function(source_el, project_dir, plugin_id) {
+        uninstall: function (source_el, project_dir, plugin_id) {
             events.emit('verbose', 'header-file.uninstall is not supported for webos');
         }
     },
-    'resource-file':{
-        install:function(el, plugin_dir, project_dir, plugin_id) {
+    'resource-file': {
+        install: function (el, plugin_dir, project_dir, plugin_id) {
             events.emit('verbose', 'resource-file.install is not supported for webos');
         },
-        uninstall:function(el, project_dir, plugin_id) {
+        uninstall: function (el, project_dir, plugin_id) {
             events.emit('verbose', 'resource-file.uninstall is not supported for webos');
         }
     },
     'framework': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id) {
+        install: function (source_el, plugin_dir, project_dir, plugin_id) {
             events.emit('verbose', 'framework.install is not supported for webos');
         },
-        uninstall:function(source_el, project_dir, plugin_id) {
+        uninstall: function (source_el, project_dir, plugin_id) {
             events.emit('verbose', 'framework.uninstall is not supported for webos');
         }
     },
     'lib-file': {
-        install:function(source_el, plugin_dir, project_dir, plugin_id) {
+        install: function (source_el, plugin_dir, project_dir, plugin_id) {
             events.emit('verbose', 'lib-file.install is not supported for webos');
         },
-        uninstall:function(source_el, project_dir, plugin_id) {
+        uninstall: function (source_el, project_dir, plugin_id) {
             events.emit('verbose', 'lib-file.uninstall is not supported for webos');
         }
     }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/plugman.js
----------------------------------------------------------------------
diff --git a/src/plugman/plugman.js b/src/plugman/plugman.js
index f7c6bb6..e87ce93 100644
--- a/src/plugman/plugman.js
+++ b/src/plugman/plugman.js
@@ -24,10 +24,10 @@ var aliasMethodToRawWithDeprecationNotice = require('../util/alias');
 var Q = require('q');
 
 var plugman = {
-    on:                 events.on.bind(events),
-    off:                events.removeListener.bind(events),
+    on: events.on.bind(events),
+    off: events.removeListener.bind(events),
     removeAllListeners: events.removeAllListeners.bind(events),
-    emit:               events.emit.bind(events),
+    emit: events.emit.bind(events),
     install: require('./install'),
     uninstall: require('./uninstall'),
     fetch: require('./fetch'),
@@ -50,25 +50,25 @@ var modulesToAlias = ['install', 'uninstall', 'fetch', 'browserify', 'help',
     'config', 'owner', 'search', 'info', 'create', 'platform',
     'createpackagejson'];
 
-modulesToAlias.forEach(function(mod) {
+modulesToAlias.forEach(function (mod) {
     aliasMethodToRawWithDeprecationNotice(mod, plugman, 'plugman');
 });
 
-plugman.commands =  {
-    'config'   : function(cli_opts) {
-        plugman.config(cli_opts.argv.remain, function(err) {
+plugman.commands = {
+    'config': function (cli_opts) {
+        plugman.config(cli_opts.argv.remain, function (err) {
             if (err) throw err;
             else console.log('done');
         });
     },
-    'owner'   : function(cli_opts) {
+    'owner': function (cli_opts) {
         plugman.owner(cli_opts.argv.remain);
     },
-    'install'  : function(cli_opts) {
-        if(!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
+    'install': function (cli_opts) {
+        if (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
             return console.log(plugman.help());
         }
-        if(cli_opts.browserify === true) {
+        if (cli_opts.browserify === true) {
             plugman.prepare = require('./prepare-browserify');
         }
         var cli_variables = {};
@@ -100,12 +100,12 @@ plugman.commands =  {
 
         return p;
     },
-    'uninstall': function(cli_opts) {
-        if(!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
+    'uninstall': function (cli_opts) {
+        if (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
             return console.log(plugman.help());
         }
 
-        if(cli_opts.browserify === true) {
+        if (cli_opts.browserify === true) {
             plugman.prepare = require('./prepare-browserify');
         }
 
@@ -124,43 +124,43 @@ plugman.commands =  {
 
         return p;
     },
-    'search'   : function(cli_opts) {
-        plugman.search(cli_opts.argv.remain, function(err, plugins) {
+    'search': function (cli_opts) {
+        plugman.search(cli_opts.argv.remain, function (err, plugins) {
             if (err) throw err;
             else {
-                for(var plugin in plugins) {
+                for (var plugin in plugins) {
                     console.log(plugins[plugin].name, '-', plugins[plugin].description || 'no description provided');
                 }
             }
         });
     },
-    'info'     : function(cli_opts) {
-        plugman.info(cli_opts.argv.remain, function(err, plugin_info) {
+    'info': function (cli_opts) {
+        plugman.info(cli_opts.argv.remain, function (err, plugin_info) {
             if (err) throw err;
             else {
                 console.log('name:', plugin_info.name);
                 console.log('version:', plugin_info.version);
                 if (plugin_info.engines) {
-                    for(var i = 0, j = plugin_info.engines.length ; i < j ; i++) {
+                    for (var i = 0, j = plugin_info.engines.length; i < j; i++) {
                         console.log(plugin_info.engines[i].name, 'version:', plugin_info.engines[i].version);
                     }
                 }
             }
         });
     },
-    'publish'  : function() {
+    'publish': function () {
         events.emit('error', 'The publish functionality is not supported anymore since the Cordova Plugin registry\n' +
             'is moving to read-only state. For publishing use corresponding \'npm\' commands.\n\n' +
             'If for any reason you still need for \'plugman publish\' - consider downgrade to plugman@0.23.3');
     },
-    'unpublish': function(cli_opts) {
+    'unpublish': function (cli_opts) {
         events.emit('error', 'The publish functionality is not supported anymore since the Cordova Plugin registry\n' +
             'is moving to read-only state. For publishing/unpublishing use corresponding \'npm\' commands.\n\n' +
             'If for any reason you still need for \'plugman unpublish\' - consider downgrade to plugman@0.23.3');
     },
-    'create': function(cli_opts) {
-        if( !cli_opts.name || !cli_opts.plugin_id || !cli_opts.plugin_version) {
-            return console.log( plugman.help() );
+    'create': function (cli_opts) {
+        if (!cli_opts.name || !cli_opts.plugin_id || !cli_opts.plugin_version) {
+            return console.log(plugman.help());
         }
         var cli_variables = {};
         if (cli_opts.variable) {
@@ -170,22 +170,22 @@ plugman.commands =  {
                 if (/^[\w-_]+$/.test(key)) cli_variables[key] = tokens.join('=');
             });
         }
-        plugman.create( cli_opts.name, cli_opts.plugin_id, cli_opts.plugin_version, cli_opts.path || '.', cli_variables );
+        plugman.create(cli_opts.name, cli_opts.plugin_id, cli_opts.plugin_version, cli_opts.path || '.', cli_variables);
     },
-    'platform': function(cli_opts) {
+    'platform': function (cli_opts) {
         var operation = cli_opts.argv.remain[ 0 ] || '';
-        if( ( operation !== 'add' && operation !== 'remove' ) ||  !cli_opts.platform_name ) {
-            return console.log( plugman.help() );
+        if ((operation !== 'add' && operation !== 'remove') || !cli_opts.platform_name) {
+            return console.log(plugman.help());
         }
-        plugman.platform( { operation: operation, platform_name: cli_opts.platform_name } );
+        plugman.platform({ operation: operation, platform_name: cli_opts.platform_name });
     },
-    'createpackagejson'  : function(cli_opts) {
+    'createpackagejson': function (cli_opts) {
         var plugin_path = cli_opts.argv.remain[0];
-        if(!plugin_path) {
+        if (!plugin_path) {
             return console.log(plugman.help());
         }
         plugman.createpackagejson(plugin_path);
-    },
+    }
 };
 
 module.exports = plugman;

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/registry/manifest.js
----------------------------------------------------------------------
diff --git a/src/plugman/registry/manifest.js b/src/plugman/registry/manifest.js
index 071a66a..a57e204 100644
--- a/src/plugman/registry/manifest.js
+++ b/src/plugman/registry/manifest.js
@@ -17,14 +17,14 @@
     under the License.
 */
 
-var path = require('path'),
-    Q = require('q'),
-    fs = require('fs'),
-    whitelist = require('./whitelist');
+var path = require('path');
+var Q = require('q');
+var fs = require('fs');
+var whitelist = require('./whitelist');
 
 var PluginInfo = require('cordova-common').PluginInfo;
 
-function validateName(name) {
+function validateName (name) {
     if (!name.match(/^(\S+\.){2,}.*$/)) {
         throw new Error('Invalid plugin ID. It has to follow the reverse domain `com.domain.plugin` format');
     }
@@ -37,61 +37,61 @@ function validateName(name) {
 }
 
 // Returns a promise.
-function generatePackageJsonFromPluginXml(plugin_path) {
-    return Q().then(function() {
+function generatePackageJsonFromPluginXml (plugin_path) {
+    return Q().then(function () {
         var package_json = {};
         var pluginInfo = new PluginInfo(plugin_path);
 
         // REQUIRED: name, version
         // OPTIONAL: description, license, keywords, engine
-        var name = pluginInfo.id,
-            version = pluginInfo.version,
-            cordova_name = pluginInfo.name,
-            description = pluginInfo.description,
-            license = pluginInfo.license,
-            keywords = pluginInfo.keywords,
-            repo = pluginInfo.repo,
-            issue = pluginInfo.issue,
-            engines = pluginInfo.getEngines(),
-            platforms = pluginInfo.getPlatforms(),
-            englishdoc = '';
-
-        if(!version) throw new Error('`version` required');
+        var name = pluginInfo.id;
+        var version = pluginInfo.version;
+        var cordova_name = pluginInfo.name;
+        var description = pluginInfo.description;
+        var license = pluginInfo.license;
+        var keywords = pluginInfo.keywords;
+        var repo = pluginInfo.repo;
+        var issue = pluginInfo.issue;
+        var engines = pluginInfo.getEngines();
+        var platforms = pluginInfo.getPlatforms();
+        var englishdoc = '';
+
+        if (!version) throw new Error('`version` required');
 
         package_json.version = version;
 
-        if(!name) throw new Error('`id` is required');
+        if (!name) throw new Error('`id` is required');
 
         validateName(name);
 
         package_json.name = name.toLowerCase();
 
-        if(cordova_name) package_json.cordova_name = cordova_name;
-        if(description)  package_json.description  = description;
-        if(license)      package_json.license      = license;
-        if(repo)         package_json.repo         = repo;
-        if(issue)        package_json.issue        = issue;
-        if(keywords)     package_json.keywords     = keywords;
-        if(platforms) {
-            package_json.platforms = platforms.map(function(p) {
+        if (cordova_name) package_json.cordova_name = cordova_name;
+        if (description) package_json.description = description;
+        if (license) package_json.license = license;
+        if (repo) package_json.repo = repo;
+        if (issue) package_json.issue = issue;
+        if (keywords) package_json.keywords = keywords;
+        if (platforms) {
+            package_json.platforms = platforms.map(function (p) {
                 return p.name;
             });
         }
 
         // Adding engines
-        if(engines) {
-            package_json.engines = engines.map(function(e) {
+        if (engines) {
+            package_json.engines = engines.map(function (e) {
                 return {name: e.name, version: e.version};
             });
         }
 
         // Set docs_path to doc/index.md exists
         var docs_path = path.resolve(plugin_path, 'doc/index.md');
-        if(!(fs.existsSync(docs_path))){
+        if (!(fs.existsSync(docs_path))) {
             // Set docs_path to doc/en/index.md
             docs_path = path.resolve(plugin_path, 'doc/en/index.md');
         }
-        if(fs.existsSync(docs_path)){
+        if (fs.existsSync(docs_path)) {
             englishdoc = fs.readFileSync(docs_path, 'utf-8');
             package_json.englishdoc = englishdoc;
         }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/registry/registry.js
----------------------------------------------------------------------
diff --git a/src/plugman/registry/registry.js b/src/plugman/registry/registry.js
index 5123e73..723c054 100644
--- a/src/plugman/registry/registry.js
+++ b/src/plugman/registry/registry.js
@@ -17,13 +17,11 @@
     under the License.
 */
 
-/* jshint laxcomma:true */
-
-var npm = require('npm'),
-    Q = require('q'),
-    npmhelper = require('../../util/npm-helper'),
-    events = require('cordova-common').events,
-    pluginSpec = require('../../cordova/plugin/plugin_spec_parser');
+var npm = require('npm');
+var Q = require('q');
+var npmhelper = require('../../util/npm-helper');
+var events = require('cordova-common').events;
+var pluginSpec = require('../../cordova/plugin/plugin_spec_parser');
 
 module.exports = {
     settings: null,
@@ -43,11 +41,12 @@ module.exports = {
      * @param {Array} args Command argument
      * @return {Promise.<void>} Promise for completion.
      */
-    owner: function(args) {
+    owner: function (args) {
         var command = args && args[0];
-        if (command && (command === 'add' || command === 'rm'))
+        if (command && (command === 'add' || command === 'rm')) {
             return Q.reject('Support for \'owner add/rm\' commands has been removed ' +
                 'due to transition of Cordova plugins registry to read-only state');
+        }
 
         return initThenLoadSettingsWithRestore(function () {
             return Q.ninvoke(npm.commands, 'owner', args);
@@ -59,7 +58,7 @@ module.exports = {
      * @param {Array} args Array of keywords
      * @return {Promise.<Object>} Promised search results.
      */
-    search: function(args) {
+    search: function (args) {
         return initThenLoadSettingsWithRestore(function () {
             return Q.ninvoke(npm.commands, 'search', args, true);
         });
@@ -70,13 +69,12 @@ module.exports = {
      * @param {Array} with one element - the plugin id or "id@version"
      * @return {Promise.<string>} Promised path to fetched package.
      */
-    fetch: function(plugin) {
+    fetch: function (plugin) {
         plugin = plugin.shift();
-        return Q.fcall(function() {
-            //fetch from npm
+        return Q.fcall(function () {
+            // fetch from npm
             return fetchPlugin(plugin);
-        })
-        .fail(function(error) {
+        }).fail(function (error) {
             return Q.reject(error);
         });
     },
@@ -86,20 +84,20 @@ module.exports = {
      * @param {String} name Plugin name
      * @return {Promise.<Object>} Promised package info.
      */
-    info: function(plugin) {
+    info: function (plugin) {
         plugin = plugin.shift();
         return npmhelper.loadWithSettingsThenRestore({
             'cache-min': 0,
             'cache-max': 0
-        }, function() {
-            return Q.ninvoke(npm.commands, 'view', [plugin], /* silent = */ true )
-            .then(function(info) {
-                // Plugin info should be accessed as info[version]. If a version
-                // specifier like >=x.y.z was used when calling npm view, info
-                // can contain several versions, but we take the first one here.
-                var version = Object.keys(info)[0];
-                return info[version];
-            });
+        }, function () {
+            return Q.ninvoke(npm.commands, 'view', [plugin], /* silent = */ true)
+                .then(function (info) {
+                    // Plugin info should be accessed as info[version]. If a version
+                    // specifier like >=x.y.z was used when calling npm view, info
+                    // can contain several versions, but we take the first one here.
+                    var version = Object.keys(info)[0];
+                    return info[version];
+                });
         });
     }
 };
@@ -109,7 +107,7 @@ module.exports = {
  * settings, executes the promises, then restores npm.config. Use this rather than passing settings to npm.load, since
  * that only works the first time you try to load npm.
  */
-function initThenLoadSettingsWithRestore(promises) {
+function initThenLoadSettingsWithRestore (promises) {
     return npmhelper.loadWithSettingsThenRestore({}, promises);
 }
 
@@ -117,7 +115,7 @@ function initThenLoadSettingsWithRestore(promises) {
 * @param {string} plugin - the plugin id or "id@version"
 * @return {Promise.<string>} Promised path to fetched package.
 */
-function fetchPlugin(plugin) {
+function fetchPlugin (plugin) {
     events.emit('log', 'Fetching plugin "' + plugin + '" via npm');
     var parsedSpec = pluginSpec.parse(plugin);
     var scope = parsedSpec.scope || '';

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/search.js
----------------------------------------------------------------------
diff --git a/src/plugman/search.js b/src/plugman/search.js
index 6ca6034..474edc9 100644
--- a/src/plugman/search.js
+++ b/src/plugman/search.js
@@ -19,6 +19,6 @@
 
 var registry = require('./registry/registry');
 
-module.exports = function(search_opts) {
+module.exports = function (search_opts) {
     return registry.search(search_opts);
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/src/plugman/uninstall.js b/src/plugman/uninstall.js
index 02a615d..7e6874b 100644
--- a/src/plugman/uninstall.js
+++ b/src/plugman/uninstall.js
@@ -1,5 +1,4 @@
-
-    /**
+/**
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
@@ -18,23 +17,21 @@
     under the License.
 */
 
-/* jshint laxcomma:true, sub:true, expr:true */
-
-var path = require('path'),
-    fs   = require('fs'),
-    semver = require('semver'),
-    shell= require('shelljs'),
-    action_stack = require('cordova-common').ActionStack,
-    dependencies = require('./util/dependencies'),
-    CordovaError = require('cordova-common').CordovaError,
-    underscore = require('underscore'),
-    Q = require('q'),
-    events = require('cordova-common').events,
-    platform_modules = require('../platforms/platforms'),
-    promiseutil = require('../util/promise-util'),
-    HooksRunner = require('../hooks/HooksRunner'),
-    cordovaUtil = require('../cordova/util'),
-    npmUninstall = require('cordova-fetch').uninstall;
+var path = require('path');
+var fs = require('fs');
+var semver = require('semver');
+var shell = require('shelljs');
+var action_stack = require('cordova-common').ActionStack;
+var dependencies = require('./util/dependencies');
+var CordovaError = require('cordova-common').CordovaError;
+var underscore = require('underscore');
+var Q = require('q');
+var events = require('cordova-common').events;
+var platform_modules = require('../platforms/platforms');
+var promiseutil = require('../util/promise-util');
+var HooksRunner = require('../hooks/HooksRunner');
+var cordovaUtil = require('../cordova/util');
+var npmUninstall = require('cordova-fetch').uninstall;
 
 var superspawn = require('cordova-common').superspawn;
 var PlatformJson = require('cordova-common').PlatformJson;
@@ -43,7 +40,7 @@ var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
 // possible options: cli_variables, www_dir
 // Returns a promise.
 module.exports = uninstall;
-function uninstall(platform, project_dir, id, plugins_dir, options) {
+function uninstall (platform, project_dir, id, plugins_dir, options) {
     project_dir = cordovaUtil.convertToRealPathSafe(project_dir);
     plugins_dir = cordovaUtil.convertToRealPathSafe(plugins_dir);
 
@@ -54,18 +51,18 @@ function uninstall(platform, project_dir, id, plugins_dir, options) {
 
     // Allow `id` to be a path to a file.
     var xml_path = path.join(id, 'plugin.xml');
-    if ( fs.existsSync(xml_path) ) {
+    if (fs.existsSync(xml_path)) {
         id = options.pluginInfoProvider.get(id).id;
     }
 
     return module.exports.uninstallPlatform(platform, project_dir, id, plugins_dir, options)
-    .then(function() {
-        return module.exports.uninstallPlugin(id, plugins_dir, options);
-    });
+        .then(function () {
+            return module.exports.uninstallPlugin(id, plugins_dir, options);
+        });
 }
 
 // Returns a promise.
-module.exports.uninstallPlatform = function(platform, project_dir, id, plugins_dir, options) {
+module.exports.uninstallPlatform = function (platform, project_dir, id, plugins_dir, options) {
     project_dir = cordovaUtil.convertToRealPathSafe(project_dir);
     plugins_dir = cordovaUtil.convertToRealPathSafe(plugins_dir);
 
@@ -83,21 +80,21 @@ module.exports.uninstallPlatform = function(platform, project_dir, id, plugins_d
         return Q.reject(new CordovaError('Plugin "' + id + '" not found. Already uninstalled?'));
     }
 
-    var current_stack = new action_stack();
+    var current_stack = new action_stack(); // eslint-disable-line new-cap
 
-    return Q().then(function() {
+    return Q().then(function () {
         if (options.platformVersion) {
             return Q(options.platformVersion);
         }
         return Q(superspawn.maybeSpawn(path.join(project_dir, 'cordova', 'version'), [], { chmod: true }));
-    }).then(function(platformVersion) {
+    }).then(function (platformVersion) {
         options.platformVersion = platformVersion;
         return runUninstallPlatform(current_stack, platform, project_dir, plugin_dir, plugins_dir, options);
     });
 };
 
 // Returns a promise.
-module.exports.uninstallPlugin = function(id, plugins_dir, options) {
+module.exports.uninstallPlugin = function (id, plugins_dir, options) {
     plugins_dir = cordovaUtil.convertToRealPathSafe(plugins_dir);
 
     options = options || {};
@@ -107,37 +104,37 @@ module.exports.uninstallPlugin = function(id, plugins_dir, options) {
     var plugin_dir = path.join(plugins_dir, id);
 
     // @tests - important this event is checked spec/uninstall.spec.js
-    events.emit('log', 'Removing "'+ id +'"');
+    events.emit('log', 'Removing "' + id + '"');
 
     // If already removed, skip.
-    if ( !fs.existsSync(plugin_dir) ) {
-        events.emit('verbose', 'Plugin "'+ id +'" already removed ('+ plugin_dir +')');
+    if (!fs.existsSync(plugin_dir)) {
+        events.emit('verbose', 'Plugin "' + id + '" already removed (' + plugin_dir + ')');
         return Q();
     }
 
     /*
-     * Deletes plugin from plugins directory and 
+     * Deletes plugin from plugins directory and
      * node_modules directory if --fetch was supplied.
      *
      * @param {String} id   the id of the plugin being removed
      *
      * @return {Promise||Error} Returns a empty promise or a promise of doing the npm uninstall
      */
-    var doDelete = function(id) {
+    var doDelete = function (id) {
         var plugin_dir = path.join(plugins_dir, id);
-        if ( !fs.existsSync(plugin_dir) ) {
-            events.emit('verbose', 'Plugin "'+ id +'" already removed ('+ plugin_dir +')');
+        if (!fs.existsSync(plugin_dir)) {
+            events.emit('verbose', 'Plugin "' + id + '" already removed (' + plugin_dir + ')');
             return Q();
         }
-        
+
         shell.rm('-rf', plugin_dir);
-        events.emit('verbose', 'Deleted "'+ id +'"');
-        
-        if(options.fetch) {
-            //remove plugin from node_modules directory
-            return npmUninstall(id, options.projectRoot, options); 
+        events.emit('verbose', 'Deleted "' + id + '"');
+
+        if (options.fetch) {
+            // remove plugin from node_modules directory
+            return npmUninstall(id, options.projectRoot, options);
         }
-        
+
         return Q();
 
     };
@@ -150,11 +147,11 @@ module.exports.uninstallPlugin = function(id, plugins_dir, options) {
 
     // Recursively remove plugins which were installed as dependents (that are not top-level)
     var toDelete = [];
-    function findDependencies(pluginId) {
+    function findDependencies (pluginId) {
         var depPluginDir = path.join(plugin_dir, '..', pluginId);
         // Skip plugin check for dependencies if it does not exist (CB-7846).
-        if (!fs.existsSync(depPluginDir) ) {
-            events.emit('verbose', 'Plugin "'+ pluginId +'" does not exist ('+ depPluginDir +')');
+        if (!fs.existsSync(depPluginDir)) {
+            events.emit('verbose', 'Plugin "' + pluginId + '" does not exist (' + depPluginDir + ')');
             return;
         }
         var pluginInfo = pluginInfoProvider.get(depPluginDir);
@@ -172,71 +169,71 @@ module.exports.uninstallPlugin = function(id, plugins_dir, options) {
 
     // Okay, now we check if any of these are depended on, or top-level.
     // Find the installed platforms by whether they have a metadata file.
-    var platforms = Object.keys(platform_modules).filter(function(platform) {
+    var platforms = Object.keys(platform_modules).filter(function (platform) {
         return fs.existsSync(path.join(plugins_dir, platform + '.json'));
     });
 
     // Can have missing plugins on some platforms when not supported..
     var dependList = {};
-    platforms.forEach(function(platform) {
+    platforms.forEach(function (platform) {
         var platformJson = PlatformJson.load(plugins_dir, platform);
         var depsInfo = dependencies.generateDependencyInfo(platformJson, plugins_dir, pluginInfoProvider);
         var tlps = depsInfo.top_level_plugins;
         var deps;
 
         // Top-level deps must always be explicitely asked to remove by user
-        tlps.forEach(function(plugin_id){
-            if(top_plugin_id == plugin_id)
-                return;
+        tlps.forEach(function (plugin_id) {
+            if (top_plugin_id === plugin_id) { return; }
 
             var i = toDelete.indexOf(plugin_id);
-            if(i >= 0)
-                toDelete.splice(i, 1);
+            if (i >= 0) { toDelete.splice(i, 1); }
         });
 
-        toDelete.forEach(function(plugin) {
+        toDelete.forEach(function (plugin) {
             deps = dependencies.dependents(plugin, depsInfo, platformJson, pluginInfoProvider);
 
             var i = deps.indexOf(top_plugin_id);
-            if(i >= 0)
-                deps.splice(i, 1); // remove current/top-level plugin as blocking uninstall
+            if (i >= 0) { deps.splice(i, 1); } // remove current/top-level plugin as blocking uninstall
 
-            if(deps.length) {
+            if (deps.length) {
                 dependList[plugin] = deps.join(', ');
             }
         });
     });
 
-    var i, plugin_id, msg, delArray = [];
-    for(i in toDelete) {
+    var i;
+    var plugin_id;
+    var msg;
+    var delArray = [];
+    for (i in toDelete) {
         plugin_id = toDelete[i];
 
-        if( dependList[plugin_id] ) {
-            msg = '"' + plugin_id + '" is required by ('+ dependList[plugin_id] + ')';
-            if(options.force) {
-                events.emit('log', msg +' but forcing removal.');
+        if (dependList[plugin_id]) {
+            msg = '"' + plugin_id + '" is required by (' + dependList[plugin_id] + ')';
+            if (options.force) {
+                events.emit('log', msg + ' but forcing removal.');
             } else {
                 // @tests - error and event message is checked spec/uninstall.spec.js
                 msg += ' and cannot be removed (hint: use -f or --force)';
 
-                if(plugin_id == top_plugin_id) {
-                    return Q.reject( new CordovaError(msg) );
+                if (plugin_id === top_plugin_id) {
+                    return Q.reject(new CordovaError(msg));
                 } else {
                     events.emit('warn', msg);
                     continue;
                 }
             }
         }
-        //create an array of promises
+        // create an array of promises
         delArray.push(doDelete(plugin_id));
     }
-    //return promise.all
+    // return promise.all
     return Q.all(delArray);
 };
 
 // possible options: cli_variables, www_dir, is_top_level
 // Returns a promise
-function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugins_dir, options) {
+function runUninstallPlatform (actions, platform, project_dir, plugin_dir, plugins_dir, options) {
     var pluginInfoProvider = options.pluginInfoProvider;
     // If this plugin is not really installed, return (CB-7004).
     if (!fs.existsSync(plugin_dir)) {
@@ -253,12 +250,12 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugin
     // Check that this plugin has no dependents.
     var dependents = dependencies.dependents(plugin_id, depsInfo, platformJson, pluginInfoProvider);
 
-    if(options.is_top_level && dependents && dependents.length > 0) {
+    if (options.is_top_level && dependents && dependents.length > 0) {
         var msg = 'The plugin \'' + plugin_id + '\' is required by (' + dependents.join(', ') + ')';
-        if(options.force) {
+        if (options.force) {
             events.emit('warn', msg + ' but forcing removal');
         } else {
-            return Q.reject( new CordovaError(msg + ', skipping uninstallation. (try --force if trying to update)') );
+            return Q.reject(new CordovaError(msg + ', skipping uninstallation. (try --force if trying to update)'));
         }
     }
 
@@ -271,7 +268,7 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugin
 
         // @tests - important this event is checked spec/uninstall.spec.js
         events.emit('log', 'Uninstalling ' + danglers.length + ' dependent plugins.');
-        promise = promiseutil.Q_chainmap(danglers, function(dangler) {
+        promise = promiseutil.Q_chainmap(danglers, function (dangler) {
             var dependent_path = path.join(plugins_dir, dangler);
             var opts = underscore.extend({}, options, {
                 is_top_level: depsInfo.top_level_plugins.indexOf(dangler) > -1,
@@ -286,7 +283,7 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugin
 
     var projectRoot = cordovaUtil.isCordova();
 
-    if(projectRoot) {
+    if (projectRoot) {
 
         // using unified hooksRunner
         var hooksRunnerOptions = {
@@ -306,9 +303,9 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugin
 
         var hooksRunner = new HooksRunner(projectRoot);
 
-        return promise.then(function() {
+        return promise.then(function () {
             return hooksRunner.fire('before_plugin_uninstall', hooksRunnerOptions);
-        }).then(function() {
+        }).then(function () {
             return handleUninstall(actions, platform, pluginInfo, project_dir, options.www_dir, plugins_dir, options.is_top_level, options);
         });
     } else {
@@ -319,43 +316,43 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugin
 }
 
 // Returns a promise.
-function handleUninstall(actions, platform, pluginInfo, project_dir, www_dir, plugins_dir, is_top_level, options) {
+function handleUninstall (actions, platform, pluginInfo, project_dir, www_dir, plugins_dir, is_top_level, options) {
     events.emit('log', 'Uninstalling ' + pluginInfo.id + ' from ' + platform);
 
     // Set up platform to uninstall asset files/js modules
     // from <platform>/platform_www dir instead of <platform>/www.
     options.usePlatformWww = true;
     return platform_modules.getPlatformApi(platform, project_dir)
-    .removePlugin(pluginInfo, options)
-    .then(function(result) {
-        // Remove plugin from installed list. This already done in platform,
-        // but need to be duplicated here to remove plugin entry from project's
-        // plugin list to manage dependencies properly.
-        PlatformJson.load(plugins_dir, platform)
-            .removePlugin(pluginInfo.id, is_top_level)
-            .save();
-
-        if (platform == 'android' &&
-                semver.gte(options.platformVersion, '4.0.0-dev') &&
-                // CB-10533 since 5.2.0-dev prepBuildFiles is now called internally by android platform and
-                // no more exported from build module
-                // TODO: This might be removed once we deprecate non-PlatformApi compatible platforms support
-                semver.lte(options.platformVersion, '5.2.0-dev') &&
-                pluginInfo.getFrameworks(platform).length > 0) {
-
-            events.emit('verbose', 'Updating build files since android plugin contained <framework>');
-            var buildModule;
-            try {
-                buildModule = require(path.join(project_dir, 'cordova', 'lib', 'build'));
-            } catch (e) {
-                // Should occur only in unit tests.
-            }
-            if (buildModule && buildModule.prepBuildFiles) {
-                buildModule.prepBuildFiles();
+        .removePlugin(pluginInfo, options)
+        .then(function (result) {
+            // Remove plugin from installed list. This already done in platform,
+            // but need to be duplicated here to remove plugin entry from project's
+            // plugin list to manage dependencies properly.
+            PlatformJson.load(plugins_dir, platform)
+                .removePlugin(pluginInfo.id, is_top_level)
+                .save();
+
+            if (platform === 'android' &&
+                    semver.gte(options.platformVersion, '4.0.0-dev') &&
+                    // CB-10533 since 5.2.0-dev prepBuildFiles is now called internally by android platform and
+                    // no more exported from build module
+                    // TODO: This might be removed once we deprecate non-PlatformApi compatible platforms support
+                    semver.lte(options.platformVersion, '5.2.0-dev') &&
+                    pluginInfo.getFrameworks(platform).length > 0) {
+
+                events.emit('verbose', 'Updating build files since android plugin contained <framework>');
+                var buildModule;
+                try {
+                    buildModule = require(path.join(project_dir, 'cordova', 'lib', 'build'));
+                } catch (e) {
+                    // Should occur only in unit tests.
+                }
+                if (buildModule && buildModule.prepBuildFiles) {
+                    buildModule.prepBuildFiles();
+                }
             }
-        }
 
-        // CB-11022 propagate `removePlugin` result to the caller
-        return Q(result);
-    });
+            // CB-11022 propagate `removePlugin` result to the caller
+            return Q(result);
+        });
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/util/android-project.js
----------------------------------------------------------------------
diff --git a/src/plugman/util/android-project.js b/src/plugman/util/android-project.js
index fd62c79..cdf820d 100644
--- a/src/plugman/util/android-project.js
+++ b/src/plugman/util/android-project.js
@@ -1,4 +1,4 @@
-/**
+/**
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
@@ -20,24 +20,21 @@
     Helper for Android projects configuration
 */
 
-/* jshint boss:true */
+var fs = require('fs');
+var path = require('path');
+var properties_parser = require('properties-parser');
+var shell = require('shelljs');
 
-var fs = require('fs'),
-    path = require('path'),
-    properties_parser = require('properties-parser'),
-    shell = require('shelljs');
-
-
-function addToPropertyList(projectProperties, key, value) {
+function addToPropertyList (projectProperties, key, value) {
     var i = 1;
-    while (projectProperties.get(key + '.' + i))
-        i++;
+    while (projectProperties.get(key + '.' + i)) { i++; }
 
     projectProperties.set(key + '.' + i, value);
     projectProperties.dirty = true;
 }
 
-function removeFromPropertyList(projectProperties, key, value) {
+/* eslint-disable no-cond-assign */
+function removeFromPropertyList (projectProperties, key, value) {
     var i = 1;
     var currentValue;
     while (currentValue = projectProperties.get(key + '.' + i)) {
@@ -53,8 +50,9 @@ function removeFromPropertyList(projectProperties, key, value) {
     }
     projectProperties.dirty = true;
 }
+/* eslint-enable no-cond-assign */
 
-function AndroidProject(projectDir) {
+function AndroidProject (projectDir) {
     this._propertiesEditors = {};
     this._subProjectDirs = {};
     this._dirty = false;
@@ -63,7 +61,7 @@ function AndroidProject(projectDir) {
 }
 
 AndroidProject.prototype = {
-    addSubProject: function(parentDir, subDir) {
+    addSubProject: function (parentDir, subDir) {
         var parentProjectFile = path.resolve(parentDir, 'project.properties');
         var subProjectFile = path.resolve(subDir, 'project.properties');
         var parentProperties = this._getPropertiesFile(parentProjectFile);
@@ -78,38 +76,38 @@ AndroidProject.prototype = {
 
         this._dirty = true;
     },
-    removeSubProject: function(parentDir, subDir) {
+    removeSubProject: function (parentDir, subDir) {
         var parentProjectFile = path.resolve(parentDir, 'project.properties');
         var parentProperties = this._getPropertiesFile(parentProjectFile);
         removeFromPropertyList(parentProperties, 'android.library.reference', module.exports.getRelativeLibraryPath(parentDir, subDir));
         delete this._subProjectDirs[subDir];
         this._dirty = true;
     },
-    addGradleReference: function(parentDir, subDir) {
+    addGradleReference: function (parentDir, subDir) {
         var parentProjectFile = path.resolve(parentDir, 'project.properties');
         var parentProperties = this._getPropertiesFile(parentProjectFile);
         addToPropertyList(parentProperties, 'cordova.gradle.include', module.exports.getRelativeLibraryPath(parentDir, subDir));
         this._dirty = true;
     },
-    removeGradleReference: function(parentDir, subDir) {
+    removeGradleReference: function (parentDir, subDir) {
         var parentProjectFile = path.resolve(parentDir, 'project.properties');
         var parentProperties = this._getPropertiesFile(parentProjectFile);
         removeFromPropertyList(parentProperties, 'cordova.gradle.include', module.exports.getRelativeLibraryPath(parentDir, subDir));
         this._dirty = true;
     },
-    addSystemLibrary: function(parentDir, value) {
+    addSystemLibrary: function (parentDir, value) {
         var parentProjectFile = path.resolve(parentDir, 'project.properties');
         var parentProperties = this._getPropertiesFile(parentProjectFile);
         addToPropertyList(parentProperties, 'cordova.system.library', value);
         this._dirty = true;
     },
-    removeSystemLibrary: function(parentDir, value) {
+    removeSystemLibrary: function (parentDir, value) {
         var parentProjectFile = path.resolve(parentDir, 'project.properties');
         var parentProperties = this._getPropertiesFile(parentProjectFile);
         removeFromPropertyList(parentProperties, 'cordova.system.library', value);
         this._dirty = true;
     },
-    write: function() {
+    write: function () {
         if (!this._dirty) {
             return;
         }
@@ -118,7 +116,7 @@ AndroidProject.prototype = {
         for (var filename in this._propertiesEditors) {
             var editor = this._propertiesEditors[filename];
             if (editor.dirty) {
-                // Check for parent directory existence before attempting write 
+                // Check for parent directory existence before attempting write
                 // (when uninstalling a plugin its subprojects' directories are deleted)
                 if (fs.existsSync(path.dirname(filename))) {
                     fs.writeFileSync(filename, editor.toString());
@@ -131,8 +129,7 @@ AndroidProject.prototype = {
         // no reason to keep run this command. Plus - we really want to avoid
         // relying on the presense of native SDKs within plugman.
         if (this.needsSubLibraryUpdate) {
-            for (var sub_dir in this._subProjectDirs)
-            {
+            for (var sub_dir in this._subProjectDirs) {
                 shell.exec('android update lib-project --path "' + sub_dir + '"');
             }
         }
@@ -151,11 +148,10 @@ AndroidProject.prototype = {
     }
 };
 
-
 module.exports = {
     AndroidProject: AndroidProject,
     getRelativeLibraryPath: function (parentDir, subDir) {
         var libraryPath = path.relative(parentDir, subDir);
-        return (path.sep == '\\') ? libraryPath.replace(/\\/g, '/') : libraryPath;
+        return (path.sep === '\\') ? libraryPath.replace(/\\/g, '/') : libraryPath;
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/util/default-engines.js
----------------------------------------------------------------------
diff --git a/src/plugman/util/default-engines.js b/src/plugman/util/default-engines.js
index 510ed97..b9225d8 100644
--- a/src/plugman/util/default-engines.js
+++ b/src/plugman/util/default-engines.js
@@ -19,37 +19,37 @@
 
 var path = require('path');
 
-module.exports = function(project_dir){
+module.exports = function (project_dir) {
     return {
         'cordova':
-            { 'platform':'*', 'currentVersion': require('../../../package.json').version },
+            { 'platform': '*', 'currentVersion': require('../../../package.json').version },
         'cordova-plugman':
-            { 'platform':'*', 'currentVersion': require('../../../package.json').version },
+            { 'platform': '*', 'currentVersion': require('../../../package.json').version },
         'cordova-android':
-            { 'platform':'android', 'scriptSrc': path.join(project_dir,'cordova','version') },
+            { 'platform': 'android', 'scriptSrc': path.join(project_dir, 'cordova', 'version') },
         'cordova-ios':
-            { 'platform':'ios', 'scriptSrc': path.join(project_dir,'cordova','version') },
+            { 'platform': 'ios', 'scriptSrc': path.join(project_dir, 'cordova', 'version') },
         'cordova-osx':
-            { 'platform':'osx', 'scriptSrc': path.join(project_dir,'cordova','version') },
+            { 'platform': 'osx', 'scriptSrc': path.join(project_dir, 'cordova', 'version') },
         'cordova-blackberry10':
-            { 'platform':'blackberry10', 'scriptSrc': path.join(project_dir,'cordova','version') },
+            { 'platform': 'blackberry10', 'scriptSrc': path.join(project_dir, 'cordova', 'version') },
         'cordova-wp8':
-            { 'platform':'wp8', 'scriptSrc': path.join(project_dir,'cordova','version') },
+            { 'platform': 'wp8', 'scriptSrc': path.join(project_dir, 'cordova', 'version') },
         'cordova-windows':
-            { 'platform':'windows', 'scriptSrc': path.join(project_dir,'cordova','version') },
-        'apple-xcode' :
-            { 'platform':'ios', 'scriptSrc':  path.join(project_dir,'cordova','apple_xcode_version') },
-        'apple-ios' :
-            { 'platform':'ios', 'scriptSrc': path.join(project_dir,'cordova','apple_ios_version') },
-        'apple-osx' :
-            { 'platform':'ios', 'scriptSrc': path.join(project_dir,'cordova','apple_osx_version') },
-        'blackberry-ndk' :
-            { 'platform':'blackberry10', 'scriptSrc': path.join(project_dir,'cordova','bb10-ndk-version') },
-        'android-sdk' :
-            { 'platform':'android', 'scriptSrc': path.join(project_dir,'cordova','android_sdk_version') },
-        'windows-os' :
-            { 'platform':'wp8|windows8', 'scriptSrc': path.join(project_dir,'cordova','win_os_version') },
-        'windows-sdk' :
-            { 'platform':'wp8|windows8', 'scriptSrc': path.join(project_dir,'cordova','win_sdk_version') }
+            { 'platform': 'windows', 'scriptSrc': path.join(project_dir, 'cordova', 'version') },
+        'apple-xcode':
+            { 'platform': 'ios', 'scriptSrc': path.join(project_dir, 'cordova', 'apple_xcode_version') },
+        'apple-ios':
+            { 'platform': 'ios', 'scriptSrc': path.join(project_dir, 'cordova', 'apple_ios_version') },
+        'apple-osx':
+            { 'platform': 'ios', 'scriptSrc': path.join(project_dir, 'cordova', 'apple_osx_version') },
+        'blackberry-ndk':
+            { 'platform': 'blackberry10', 'scriptSrc': path.join(project_dir, 'cordova', 'bb10-ndk-version') },
+        'android-sdk':
+            { 'platform': 'android', 'scriptSrc': path.join(project_dir, 'cordova', 'android_sdk_version') },
+        'windows-os':
+            { 'platform': 'wp8|windows8', 'scriptSrc': path.join(project_dir, 'cordova', 'win_os_version') },
+        'windows-sdk':
+            { 'platform': 'wp8|windows8', 'scriptSrc': path.join(project_dir, 'cordova', 'win_sdk_version') }
     };
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/util/dependencies.js
----------------------------------------------------------------------
diff --git a/src/plugman/util/dependencies.js b/src/plugman/util/dependencies.js
index 8c5d9fe..fa3e4c1 100644
--- a/src/plugman/util/dependencies.js
+++ b/src/plugman/util/dependencies.js
@@ -17,67 +17,62 @@
     under the License.
 */
 
-/* jshint expr:true */
+var dep_graph = require('dep-graph');
+var path = require('path');
+var fs = require('fs');
+var underscore = require('underscore');
+var events = require('cordova-common').events;
+var pkg;
 
-var dep_graph = require('dep-graph'),
-    path = require('path'),
-    fs = require('fs'),
-    underscore = require('underscore'),
-    events = require('cordova-common').events,
-    package;
+module.exports = pkg = {
 
-module.exports = package = {
-
-    generateDependencyInfo:function(platformJson, plugins_dir, pluginInfoProvider) {
+    generateDependencyInfo: function (platformJson, plugins_dir, pluginInfoProvider) {
         var json = platformJson.root;
 
         // TODO: store whole dependency tree in plugins/[platform].json
         // in case plugins are forcefully removed...
         var tlps = [];
-        var graph = new dep_graph();
-        Object.keys(json.installed_plugins).forEach(function(plugin_id) {
+        var graph = new dep_graph(); // eslint-disable-line new-cap
+        Object.keys(json.installed_plugins).forEach(function (plugin_id) {
             tlps.push(plugin_id);
 
             var plugin_dir = path.join(plugins_dir, plugin_id);
             var pluginInfo = pluginInfoProvider.get(plugin_dir);
             var deps = pluginInfo.getDependencies(platformJson.platform);
-            deps.forEach(function(dep) {
+            deps.forEach(function (dep) {
                 graph.add(plugin_id, dep.id);
             });
         });
-        Object.keys(json.dependent_plugins).forEach(function(plugin_id) {
+        Object.keys(json.dependent_plugins).forEach(function (plugin_id) {
             var plugin_dir = path.join(plugins_dir, plugin_id);
             // dependency plugin does not exist (CB-7846)
             if (!fs.existsSync(plugin_dir)) {
-                events.emit('verbose', 'Plugin "'+ plugin_id +'" does not exist ('+ plugin_dir+')');
+                events.emit('verbose', 'Plugin "' + plugin_id + '" does not exist (' + plugin_dir + ')');
                 return;
             }
 
             var pluginInfo = pluginInfoProvider.get(plugin_dir);
             var deps = pluginInfo.getDependencies(platformJson.platform);
-            deps.forEach(function(dep) {
+            deps.forEach(function (dep) {
                 graph.add(plugin_id, dep.id);
             });
         });
 
         return {
-            graph:graph,
-            top_level_plugins:tlps
+            graph: graph,
+            top_level_plugins: tlps
         };
     },
 
     // Returns a list of top-level plugins which are (transitively) dependent on the given plugin.
-    dependents: function(plugin_id, plugins_dir, platformJson, pluginInfoProvider) {
+    dependents: function (plugin_id, plugins_dir, platformJson, pluginInfoProvider) {
         var depsInfo;
-        if(typeof plugins_dir == 'object')
-            depsInfo = plugins_dir;
-        else
-            depsInfo = package.generateDependencyInfo(platformJson, plugins_dir, pluginInfoProvider);
+        if (typeof plugins_dir === 'object') { depsInfo = plugins_dir; } else { depsInfo = pkg.generateDependencyInfo(platformJson, plugins_dir, pluginInfoProvider); }
 
         var graph = depsInfo.graph;
         var tlps = depsInfo.top_level_plugins;
-        var dependents = tlps.filter(function(tlp) {
-            return tlp != plugin_id && graph.getChain(tlp).indexOf(plugin_id) >= 0;
+        var dependents = tlps.filter(function (tlp) {
+            return tlp !== plugin_id && graph.getChain(tlp).indexOf(plugin_id) >= 0;
         });
 
         return dependents;
@@ -85,20 +80,17 @@ module.exports = package = {
 
     // Returns a list of plugins which the given plugin depends on, for which it is the only dependent.
     // In other words, if the given plugin were deleted, these dangling dependencies should be deleted too.
-    danglers: function(plugin_id, plugins_dir, platformJson, pluginInfoProvider) {
+    danglers: function (plugin_id, plugins_dir, platformJson, pluginInfoProvider) {
         var depsInfo;
-        if(typeof plugins_dir == 'object')
-            depsInfo = plugins_dir;
-        else
-            depsInfo = package.generateDependencyInfo(platformJson, plugins_dir, pluginInfoProvider);
+        if (typeof plugins_dir === 'object') { depsInfo = plugins_dir; } else { depsInfo = pkg.generateDependencyInfo(platformJson, plugins_dir, pluginInfoProvider); }
 
         var graph = depsInfo.graph;
         var dependencies = graph.getChain(plugin_id);
 
         var tlps = depsInfo.top_level_plugins;
         var diff_arr = [];
-        tlps.forEach(function(tlp) {
-            if (tlp != plugin_id) {
+        tlps.forEach(function (tlp) {
+            if (tlp !== plugin_id) {
                 diff_arr.push(graph.getChain(tlp));
             }
         });
@@ -108,7 +100,7 @@ module.exports = package = {
         var danglers = underscore.difference.apply(null, diff_arr);
 
         // Ensure no top-level plugins are tagged as danglers.
-        danglers = danglers && danglers.filter(function(x) { return tlps.indexOf(x) < 0; });
+        danglers = danglers && danglers.filter(function (x) { return tlps.indexOf(x) < 0; });
         return danglers;
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/util/metadata.js
----------------------------------------------------------------------
diff --git a/src/plugman/util/metadata.js b/src/plugman/util/metadata.js
index 435cab0..e306bfb 100644
--- a/src/plugman/util/metadata.js
+++ b/src/plugman/util/metadata.js
@@ -22,7 +22,7 @@ var path = require('path');
 
 var cachedJson = null;
 
-function getJson(pluginsDir) {
+function getJson (pluginsDir) {
     if (!cachedJson) {
         var fetchJsonPath = path.join(pluginsDir, 'fetch.json');
         if (fs.existsSync(fetchJsonPath)) {
@@ -34,7 +34,7 @@ function getJson(pluginsDir) {
     return cachedJson;
 }
 
-exports.get_fetch_metadata = function(plugin_dir) {
+exports.get_fetch_metadata = function (plugin_dir) {
     var pluginsDir = path.dirname(plugin_dir);
     var pluginId = path.basename(plugin_dir);
 
@@ -52,17 +52,16 @@ exports.get_fetch_metadata = function(plugin_dir) {
     return {};
 };
 
-exports.save_fetch_metadata = function(pluginsDir, pluginId, data) {
+exports.save_fetch_metadata = function (pluginsDir, pluginId, data) {
     var metadataJson = getJson(pluginsDir);
     metadataJson[pluginId] = data;
     var fetchJsonPath = path.join(pluginsDir, 'fetch.json');
     fs.writeFileSync(fetchJsonPath, JSON.stringify(metadataJson, null, 2), 'utf-8');
 };
 
-exports.remove_fetch_metadata = function(pluginsDir, pluginId){
+exports.remove_fetch_metadata = function (pluginsDir, pluginId) {
     var metadataJson = getJson(pluginsDir);
     delete metadataJson[pluginId];
     var fetchJsonPath = path.join(pluginsDir, 'fetch.json');
     fs.writeFileSync(fetchJsonPath, JSON.stringify(metadataJson, null, 2), 'utf-8');
 };
-

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/plugman/util/plist-helpers.js
----------------------------------------------------------------------
diff --git a/src/plugman/util/plist-helpers.js b/src/plugman/util/plist-helpers.js
index 8d5384f..230af90 100644
--- a/src/plugman/util/plist-helpers.js
+++ b/src/plugman/util/plist-helpers.js
@@ -1,4 +1,4 @@
- /**
+/**
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
@@ -15,32 +15,31 @@
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
-*/ 
+*/
 
 // contains PLIST utility functions
-var __     = require('underscore');
+var __ = require('underscore');
 var plist = require('plist');
 
 // adds node to doc at selector
 module.exports.graftPLIST = graftPLIST;
-function graftPLIST(doc, xml, selector) {
-    var obj = plist.parse('<plist>'+xml+'</plist>');
+function graftPLIST (doc, xml, selector) {
+    var obj = plist.parse('<plist>' + xml + '</plist>');
 
     var node = doc[selector];
-    if (node && Array.isArray(node) && Array.isArray(obj)){
+    if (node && Array.isArray(node) && Array.isArray(obj)) {
         node = node.concat(obj);
-        for (var i =0;i<node.length; i++){
-            for (var j=i+1; j<node.length; ++j) {
-              if (nodeEqual(node[i], node[j]))
-                    node.splice(j--,1);
+        for (var i = 0; i < node.length; i++) {
+            for (var j = i + 1; j < node.length; ++j) {
+                if (nodeEqual(node[i], node[j])) { node.splice(j--, 1); }
             }
         }
         doc[selector] = node;
     } else {
-        //plist uses objects for <dict>. If we have two dicts we merge them instead of
+        // plist uses objects for <dict>. If we have two dicts we merge them instead of
         // overriding the old one. See CB-6472
-        if (node && __.isObject(node) && __.isObject(obj) && !__.isDate(node) && !__.isDate(obj)){//arrays checked above
-            __.extend(obj,node);
+        if (node && __.isObject(node) && __.isObject(obj) && !__.isDate(node) && !__.isDate(obj)) { // arrays checked above
+            __.extend(obj, node);
         }
         doc[selector] = obj;
     }
@@ -50,15 +49,15 @@ function graftPLIST(doc, xml, selector) {
 
 // removes node from doc at selector
 module.exports.prunePLIST = prunePLIST;
-function prunePLIST(doc, xml, selector) {
-    var obj = plist.parse('<plist>'+xml+'</plist>');
+function prunePLIST (doc, xml, selector) {
+    var obj = plist.parse('<plist>' + xml + '</plist>');
 
     pruneOBJECT(doc, selector, obj);
 
     return true;
 }
 
-function pruneOBJECT(doc, selector, fragment) {
+function pruneOBJECT (doc, selector, fragment) {
     if (Array.isArray(fragment) && Array.isArray(doc[selector])) {
         var empty = true;
         for (var i in fragment) {
@@ -66,13 +65,11 @@ function pruneOBJECT(doc, selector, fragment) {
                 empty = pruneOBJECT(doc[selector], j, fragment[i]) && empty;
             }
         }
-        if (empty)
-        {
+        if (empty) {
             delete doc[selector];
             return true;
         }
-    }
-    else if (nodeEqual(doc[selector], fragment)) {
+    } else if (nodeEqual(doc[selector], fragment)) {
         delete doc[selector];
         return true;
     }
@@ -80,14 +77,11 @@ function pruneOBJECT(doc, selector, fragment) {
     return false;
 }
 
-function nodeEqual(node1, node2) {
-    if (typeof node1 != typeof node2)
-        return false;
-    else if (typeof node1 == 'string') {
-        node2 = escapeRE(node2).replace(/\\\$\S+/gm,'(.*?)');
+function nodeEqual (node1, node2) {
+    if (typeof node1 !== typeof node2) { return false; } else if (typeof node1 === 'string') {
+        node2 = escapeRE(node2).replace(/\\\$\S+/gm, '(.*?)');
         return new RegExp('^' + node2 + '$').test(node1);
-    }
-    else {
+    } else {
         for (var key in node2) {
             if (!nodeEqual(node1[key], node2[key])) return false;
         }
@@ -96,6 +90,6 @@ function nodeEqual(node1, node2) {
 }
 
 // escape string for use in regex
-function escapeRE(str) {
-    return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
+function escapeRE (str) {
+    return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); // eslint-disable-line no-useless-escape
 }


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


[05/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/restore-util.js
----------------------------------------------------------------------
diff --git a/src/cordova/restore-util.js b/src/cordova/restore-util.js
index d6ee17b..db32678 100644
--- a/src/cordova/restore-util.js
+++ b/src/cordova/restore-util.js
@@ -17,28 +17,28 @@
     under the License.
 */
 
-var cordova_util    = require('./util'),
-    ConfigParser    = require('cordova-common').ConfigParser,
-    path            = require('path'),
-    Q               = require('q'),
-    fs              = require('fs'),
-    events          = require('cordova-common').events,
-    cordovaPlatform = require('./platform'),
-    semver          = require('semver'),
-    platformsList   = require('../platforms/platforms.js'),
-    promiseutil     = require('../util/promise-util');
+var cordova_util = require('./util');
+var ConfigParser = require('cordova-common').ConfigParser;
+var path = require('path');
+var Q = require('q');
+var fs = require('fs');
+var events = require('cordova-common').events;
+var cordovaPlatform = require('./platform');
+var semver = require('semver');
+var platformsList = require('../platforms/platforms.js');
+var promiseutil = require('../util/promise-util');
 
 exports.installPluginsFromConfigXML = installPluginsFromConfigXML;
 exports.installPlatformsFromConfigXML = installPlatformsFromConfigXML;
 // Install platforms looking at config.xml and package.json (if there is one).
-function installPlatformsFromConfigXML(platforms, opts) {
+function installPlatformsFromConfigXML (platforms, opts) {
     events.emit('verbose', 'Checking config.xml and package.json for saved platforms that haven\'t been added to the project');
 
     var projectHome = cordova_util.cdProjectRoot();
     var configPath = cordova_util.projectConfig(projectHome);
     var cfg = new ConfigParser(configPath);
     var engines = cfg.getEngines();
-    var pkgJsonPath = path.join(projectHome,'package.json');
+    var pkgJsonPath = path.join(projectHome, 'package.json');
     var pkgJson;
     var pkgJsonPlatforms;
     var comboArray = [];
@@ -50,15 +50,15 @@ function installPlatformsFromConfigXML(platforms, opts) {
     var installAllPlatforms = !platforms || platforms.length === 0;
 
     // Check if path exists and require pkgJsonPath.
-    if(fs.existsSync(pkgJsonPath)) {
+    if (fs.existsSync(pkgJsonPath)) {
         pkgJson = require(pkgJsonPath);
     }
 
-    if(pkgJson !== undefined && pkgJson.cordova !== undefined && pkgJson.cordova.platforms !== undefined) {
+    if (pkgJson !== undefined && pkgJson.cordova !== undefined && pkgJson.cordova.platforms !== undefined) {
         pkgJsonPlatforms = pkgJson.cordova.platforms;
     }
 
-    if(cfg !== undefined) {
+    if (cfg !== undefined) {
 
         if (pkgJsonPlatforms !== undefined) {
             // Combining arrays and checking duplicates.
@@ -71,37 +71,37 @@ function installPlatformsFromConfigXML(platforms, opts) {
         // If package.json doesn't exist, auto-create one.
         if (engines.length > 0 && pkgJson === undefined) {
             pkgJson = {};
-            if(cfg.packageName()){
+            if (cfg.packageName()) {
                 pkgJson.name = cfg.packageName().toLowerCase();
             }
-            if(cfg.version()) {
+            if (cfg.version()) {
                 pkgJson.version = cfg.version();
             }
-            if(cfg.name()) {
+            if (cfg.name()) {
                 pkgJson.displayName = cfg.name();
             }
             fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2), 'utf8');
         }
 
-        configPlatforms = engines.map(function(Engine) {
+        configPlatforms = engines.map(function (Engine) {
             var configPlatName = Engine.name;
             // Add specs from config into mergedPlatformSpecs.
-            if(mergedPlatformSpecs[configPlatName] === undefined && Engine.spec) {
+            if (mergedPlatformSpecs[configPlatName] === undefined && Engine.spec) {
                 mergedPlatformSpecs[configPlatName] = Engine.spec;
             }
             return configPlatName;
         });
-        configPlatforms.forEach(function(item) {
-            if(comboArray.indexOf(item) < 0 ) {
+        configPlatforms.forEach(function (item) {
+            if (comboArray.indexOf(item) < 0) {
                 comboArray.push(item);
             }
         });
         // ComboArray should have all platforms from config.xml & package.json.
         // Remove duplicates in comboArray & sort.
-        var uniq = comboArray.reduce(function(a,b) {
-            if (a.indexOf(b) < 0 ) a.push(b);
-                return a;
-        },[]);
+        var uniq = comboArray.reduce(function (a, b) {
+            if (a.indexOf(b) < 0) a.push(b);
+            return a;
+        }, []);
         comboArray = uniq;
         comboArray = comboArray.sort();
 
@@ -131,11 +131,11 @@ function installPlatformsFromConfigXML(platforms, opts) {
             }
 
             events.emit('verbose', 'Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.');
-            comboArray.forEach(function(item) {
-                var prefixItem = ('cordova-'+item);
+            comboArray.forEach(function (item) {
+                var prefixItem = ('cordova-' + item);
 
                 // Modify package.json if any of these cases are true:
-                if((pkgJson.dependencies === undefined && Object.keys(mergedPlatformSpecs).length) ||
+                if ((pkgJson.dependencies === undefined && Object.keys(mergedPlatformSpecs).length) ||
                 (pkgJson.dependencies && mergedPlatformSpecs && pkgJson.dependencies[item] === undefined && mergedPlatformSpecs[item]) ||
                 (pkgJson.dependencies && mergedPlatformSpecs && pkgJson.dependencies[prefixItem] === undefined && mergedPlatformSpecs[prefixItem])) {
                     modifiedPkgJson = true;
@@ -143,7 +143,7 @@ function installPlatformsFromConfigXML(platforms, opts) {
 
                 // Get the cordova- prefixed spec from package.json and add it to mergedPluginSpecs.
                 if (pkgJson.dependencies && pkgJson.dependencies[prefixItem]) {
-                    if(mergedPlatformSpecs[prefixItem] != pkgJson.dependencies[prefixItem]) {
+                    if (mergedPlatformSpecs[prefixItem] !== pkgJson.dependencies[prefixItem]) {
                         modifiedPkgJson = true;
                     }
                     mergedPlatformSpecs[item] = pkgJson.dependencies[prefixItem];
@@ -151,14 +151,14 @@ function installPlatformsFromConfigXML(platforms, opts) {
 
                 // Get the spec from package.json and add it to mergedPluginSpecs.
                 if (pkgJson.dependencies && pkgJson.dependencies[item] && pkgJson.dependencies[prefixItem] === undefined) {
-                    if(mergedPlatformSpecs[item] != pkgJson.dependencies[item]) {
+                    if (mergedPlatformSpecs[item] !== pkgJson.dependencies[item]) {
                         modifiedPkgJson = true;
                     }
                     mergedPlatformSpecs[item] = pkgJson.dependencies[item];
                 }
                 // First remove the engine and then add missing engine and elements to config.xml.
                 // Remove to avoid duplicate engines.
-                if(mergedPlatformSpecs[item]) {
+                if (mergedPlatformSpecs[item]) {
                     cfg.removeEngine(item);
                     cfg.addEngine(item, mergedPlatformSpecs[item]);
                     modifiedConfigXML = true;
@@ -174,7 +174,7 @@ function installPlatformsFromConfigXML(platforms, opts) {
         // Write and update pkg.json if it has been modified.
         if (modifiedPkgJson === true) {
             pkgJson.cordova.platforms = comboArray;
-            if(pkgJson.dependencies === undefined) {
+            if (pkgJson.dependencies === undefined) {
                 pkgJson.dependencies = {};
             }
             // Check if key is part of cordova alias list.
@@ -202,37 +202,37 @@ function installPlatformsFromConfigXML(platforms, opts) {
     // Otherwise, we get a bug where the following line: https://github.com/apache/cordova-lib/blob/0b0dee5e403c2c6d4e7262b963babb9f532e7d27/cordova-lib/src/util/npm-helper.js#L39
     // gets executed simultaneously by each platform and leads to an exception being thrown
 
-    return promiseutil.Q_chainmap_graceful(comboArray, function(target) {
+    return promiseutil.Q_chainmap_graceful(comboArray, function (target) {
         var cwd = process.cwd();
-        var platformsFolderPath = path.join(cwd,'platforms');
+        var platformsFolderPath = path.join(cwd, 'platforms');
         var platformsInstalled = path.join(platformsFolderPath, target);
         if (target) {
             var platformName = target;
             // Add the spec to the target
-            if(mergedPlatformSpecs[target]) {
+            if (mergedPlatformSpecs[target]) {
                 target = target + '@' + mergedPlatformSpecs[target];
             }
             // If the platform is already installed, no need to re-install it.
             if (!fs.existsSync(platformsInstalled) && (installAllPlatforms || platforms.indexOf(platformName) > -1)) {
-                events.emit('log', 'Discovered platform \"' + target + '\" in config.xml or package.json. Adding it to the project');
+                events.emit('log', 'Discovered platform \"' + target + '\" in config.xml or package.json. Adding it to the project'); // eslint-disable-line no-useless-escape
                 return cordovaPlatform('add', target, opts);
             }
         }
         return Q();
-    }, function(err) {
+    }, function (err) {
         events.emit('warn', err);
     });
 }
 
 // Returns a promise.
-function installPluginsFromConfigXML(args) {
+function installPluginsFromConfigXML (args) {
     events.emit('verbose', 'Checking config.xml for saved plugins that haven\'t been added to the project');
-    //Install plugins that are listed in config.xml.
+    // Install plugins that are listed in config.xml.
     var projectRoot = cordova_util.cdProjectRoot();
     var configPath = cordova_util.projectConfig(projectRoot);
     var cfg = new ConfigParser(configPath);
     var plugins_dir = path.join(projectRoot, 'plugins');
-    var pkgJsonPath = path.join(projectRoot,'package.json');
+    var pkgJsonPath = path.join(projectRoot, 'package.json');
     var pkgJson;
     var modifiedPkgJson = false;
     var modifiedConfigXML = false;
@@ -245,11 +245,11 @@ function installPluginsFromConfigXML(args) {
     var key;
 
     // Check if path exists and require pkgJsonPath.
-    if(fs.existsSync(pkgJsonPath)) {
+    if (fs.existsSync(pkgJsonPath)) {
         pkgJson = require(pkgJsonPath);
     }
 
-    if(pkgJson !== undefined && pkgJson.cordova !== undefined && pkgJson.cordova.plugins !== undefined) {
+    if (pkgJson !== undefined && pkgJson.cordova !== undefined && pkgJson.cordova.plugins !== undefined) {
         comboPluginIdArray = Object.keys(pkgJson.cordova.plugins);
         // Create a merged plugin data array (comboObject)
         // and add all of the package.json plugins to comboObject.
@@ -261,11 +261,11 @@ function installPluginsFromConfigXML(args) {
 
     // Get all config.xml plugin ids (names).
     var pluginIdConfig = cfg.getPluginIdList();
-    if(pluginIdConfig === undefined) {
+    if (pluginIdConfig === undefined) {
         pluginIdConfig = [];
     }
 
-    if(pkgJson !== undefined) {
+    if (pkgJson !== undefined) {
         if (pkgJson.cordova === undefined) {
             pkgJson.cordova = {};
         }
@@ -275,9 +275,9 @@ function installPluginsFromConfigXML(args) {
 
         // Check to see which plugins are initially the same in pkg.json and config.xml.
         // Add missing plugin variables in package.json from config.xml.
-        comboPluginIdArray.forEach(function(item) {
+        comboPluginIdArray.forEach(function (item) {
 
-            function includeFunc(container, value) {
+            function includeFunc (container, value) {
                 var returnValue = false;
                 var pos = container.indexOf(value);
                 if (pos >= 0) {
@@ -291,10 +291,10 @@ function installPluginsFromConfigXML(args) {
                 configPlugin = cfg.getPlugin(item);
                 configPluginVariables = configPlugin.variables;
                 pkgJsonPluginVariables = comboObject[item];
-                for(var key in configPluginVariables) {
+                for (var key in configPluginVariables) {
                     // Handle conflicts, package.json wins.
                     // Only add the variable to package.json if it doesn't already exist.
-                    if(pkgJsonPluginVariables[key] === undefined) {
+                    if (pkgJsonPluginVariables[key] === undefined) {
                         pkgJsonPluginVariables[key] = configPluginVariables[key];
                         comboObject[item][key] = configPluginVariables[key];
                         modifiedPkgJson = true;
@@ -308,11 +308,11 @@ function installPluginsFromConfigXML(args) {
         });
 
         // Check to see if pkg.json plugin(id) and config plugin(id) match.
-        if(comboPluginIdArray.sort().toString() !== pluginIdConfig.sort().toString()) {
+        if (comboPluginIdArray.sort().toString() !== pluginIdConfig.sort().toString()) {
             // If there is a config plugin that does NOT already exist in
             // mergedPluginDataArray, add it and its variables.
-            pluginIdConfig.forEach(function(item) {
-                if(comboPluginIdArray.indexOf(item) < 0) {
+            pluginIdConfig.forEach(function (item) {
+                if (comboPluginIdArray.indexOf(item) < 0) {
                     comboPluginIdArray.push(item);
                     var configXMLPlugin = cfg.getPlugin(item);
                     comboObject[item] = configXMLPlugin.variables;
@@ -322,9 +322,9 @@ function installPluginsFromConfigXML(args) {
         }
 
         // Add specs from config.xml to mergedPluginSpecs.
-        pluginIdConfig.forEach(function(item) {
+        pluginIdConfig.forEach(function (item) {
             var configXMLPlugin = cfg.getPlugin(item);
-            if(mergedPluginSpecs[item] === undefined && configXMLPlugin.spec) {
+            if (mergedPluginSpecs[item] === undefined && configXMLPlugin.spec) {
                 mergedPluginSpecs[item] = configXMLPlugin.spec;
                 modifiedPkgJson = true;
             }
@@ -332,27 +332,27 @@ function installPluginsFromConfigXML(args) {
         // If pkg.json plugins have been modified, write to it.
         if (modifiedPkgJson === true) {
             pkgJson.cordova.plugins = comboObject;
-            if(pkgJson.dependencies === undefined) {
+            if (pkgJson.dependencies === undefined) {
                 pkgJson.dependencies = {};
             }
-            for(key in mergedPluginSpecs) {
+            for (key in mergedPluginSpecs) {
                 pkgJson.dependencies[key] = mergedPluginSpecs[key];
             }
             fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2), 'utf8');
         }
     }
     // Write config.xml (only if plugins exist in package.json).
-    comboPluginIdArray.forEach(function(plugID) {
-        if(pluginIdConfig.indexOf(plugID) < 0) {
+    comboPluginIdArray.forEach(function (plugID) {
+        if (pluginIdConfig.indexOf(plugID) < 0) {
             pluginIdConfig.push(plugID);
         }
         cfg.removePlugin(plugID);
         if (mergedPluginSpecs[plugID]) {
-            cfg.addPlugin({name:plugID, spec: mergedPluginSpecs[plugID]}, comboObject[plugID]);
+            cfg.addPlugin({name: plugID, spec: mergedPluginSpecs[plugID]}, comboObject[plugID]);
             modifiedConfigXML = true;
         // If no spec, just add the plugin.
         } else {
-            cfg.addPlugin({name:plugID}, comboObject[plugID]);
+            cfg.addPlugin({name: plugID}, comboObject[plugID]);
             modifiedConfigXML = true;
         }
     });
@@ -368,7 +368,7 @@ function installPluginsFromConfigXML(args) {
     // We need to wait for the plugin and its dependencies to be installed
     // before installing the next root plugin otherwise we can have common
     // plugin dependencies installed twice which throws a nasty error.
-    return promiseutil.Q_chainmap_graceful(pluginIdConfig, function(featureId) {
+    return promiseutil.Q_chainmap_graceful(pluginIdConfig, function (featureId) {
         var pluginPath = path.join(plugins_dir, featureId);
         if (fs.existsSync(pluginPath)) {
             // Plugin already exists
@@ -386,7 +386,7 @@ function installPluginsFromConfigXML(args) {
         var installFrom = pluginSpec || pluginName;
         if (pluginSpec && semver.validRange(pluginSpec, true)) {
             installFrom = pluginName + '@' + pluginSpec;
-        } else if(args.fetch && pluginSpec) {
+        } else if (args.fetch && pluginSpec) {
             installFrom = pluginName + '@' + pluginSpec;
         }
 
@@ -401,7 +401,7 @@ function installPluginsFromConfigXML(args) {
         return plugin('add', installFrom, options);
     }, function (error) {
         // CB-10921 emit a warning in case of error
-        var msg = 'Failed to restore plugin \"' + pluginName + '\" from config.xml. ' +
+        var msg = 'Failed to restore plugin \"' + pluginName + '\" from config.xml. ' + // eslint-disable-line no-useless-escape
             'You might need to try adding it again. Error: ' + error;
         process.exitCode = 1;
         events.emit('warn', msg);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/run.js
----------------------------------------------------------------------
diff --git a/src/cordova/run.js b/src/cordova/run.js
index 3d9979d..5547204 100644
--- a/src/cordova/run.js
+++ b/src/cordova/run.js
@@ -17,16 +17,15 @@
     under the License.
 */
 
-var cordova_util = require('./util'),
-    HooksRunner  = require('../hooks/HooksRunner'),
-    Q            = require('q'),
-    platform_lib = require('../platforms/platforms'),
-    _ = require('underscore');
-
+var cordova_util = require('./util');
+var HooksRunner = require('../hooks/HooksRunner');
+var Q = require('q');
+var platform_lib = require('../platforms/platforms');
+var _ = require('underscore');
 
 // Returns a promise.
-module.exports = function run(options) {
-    return Q().then(function() {
+module.exports = function run (options) {
+    return Q().then(function () {
         var projectRoot = cordova_util.cdProjectRoot();
         options = cordova_util.preProcessOptions(options);
 
@@ -36,28 +35,28 @@ module.exports = function run(options) {
 
         var hooksRunner = new HooksRunner(projectRoot);
         return hooksRunner.fire('before_run', options)
-        .then(function() {
-            if (!options.options.noprepare) {
-                // Run a prepare first, then shell out to run
-                return require('./cordova').prepare(options);
-            }
-        }).then(function() {
-            // Deploy in parallel (output gets intermixed though...)
-            return Q.all(options.platforms.map(function(platform) {
-
-                var buildPromise = options.options.nobuild ? Q() :
-                    platform_lib.getPlatformApi(platform).build(options.options);
-
-                return buildPromise
-                .then(function() {
-                    return hooksRunner.fire('before_deploy', options);
-                })
-                .then(function() {
-                    return platform_lib.getPlatformApi(platform).run(optsClone);
-                });
-            }));
-        }).then(function() {
-            return hooksRunner.fire('after_run', options);
-        });
+            .then(function () {
+                if (!options.options.noprepare) {
+                    // Run a prepare first, then shell out to run
+                    return require('./cordova').prepare(options);
+                }
+            }).then(function () {
+                // Deploy in parallel (output gets intermixed though...)
+                return Q.all(options.platforms.map(function (platform) {
+
+                    var buildPromise = options.options.nobuild ? Q() :
+                        platform_lib.getPlatformApi(platform).build(options.options);
+
+                    return buildPromise
+                        .then(function () {
+                            return hooksRunner.fire('before_deploy', options);
+                        })
+                        .then(function () {
+                            return platform_lib.getPlatformApi(platform).run(optsClone);
+                        });
+                }));
+            }).then(function () {
+                return hooksRunner.fire('after_run', options);
+            });
     });
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/serve.js
----------------------------------------------------------------------
diff --git a/src/cordova/serve.js b/src/cordova/serve.js
index 2e1c04f..e25beab 100644
--- a/src/cordova/serve.js
+++ b/src/cordova/serve.js
@@ -17,23 +17,23 @@
     under the License.
 */
 
-var cordova_util = require('./util'),
-    crypto       = require('crypto'),
-    path         = require('path'),
-    shell        = require('shelljs'),
-    url          = require('url'),
-    platforms    = require('../platforms/platforms'),
-    ConfigParser = require('cordova-common').ConfigParser,
-    HooksRunner  = require('../hooks/HooksRunner'),
-    Q            = require('q'),
-    fs           = require('fs'),
-    events       = require('cordova-common').events,
-    serve        = require('cordova-serve');
+var cordova_util = require('./util');
+var crypto = require('crypto');
+var path = require('path');
+var shell = require('shelljs');
+var url = require('url');
+var platforms = require('../platforms/platforms');
+var ConfigParser = require('cordova-common').ConfigParser;
+var HooksRunner = require('../hooks/HooksRunner');
+var Q = require('q');
+var fs = require('fs');
+var events = require('cordova-common').events;
+var serve = require('cordova-serve');
 
 var projectRoot;
 var installedPlatforms;
 
-function handleRoot(request, response, next) {
+function handleRoot (request, response, next) {
     if (url.parse(request.url).pathname !== '/') {
         response.sendStatus(404);
         return;
@@ -42,7 +42,7 @@ function handleRoot(request, response, next) {
     response.writeHead(200, {'Content-Type': 'text/html'});
     var config = new ConfigParser(cordova_util.projectConfig(projectRoot));
     var contentNode = config.doc.find('content');
-    var contentSrc = contentNode && contentNode.attrib.src || 'index.html';
+    var contentSrc = (contentNode && contentNode.attrib.src) || ('index.html');
 
     response.write('<html><head><title>' + config.name() + '</title></head><body>');
     response.write('<table border cellspacing=0><thead><caption><h3>Package Metadata</h3></caption></thead><tbody>');
@@ -70,25 +70,25 @@ function handleRoot(request, response, next) {
     response.end();
 }
 
-function getPlatformHandler(platform, wwwDir, configXml) {
+function getPlatformHandler (platform, wwwDir, configXml) {
     return function (request, response, next) {
         switch (url.parse(request.url).pathname) {
-            case '/' + platform + '/config.xml':
-                response.sendFile(configXml);
-                break;
-
-            case '/' + platform + '/project.json':
-                response.send({
-                    'configPath': '/' + platform + '/config.xml',
-                    'wwwPath': '/' + platform + '/www',
-                    'wwwFileList': shell.find(wwwDir)
-                        .filter(function (a) { return !fs.statSync(a).isDirectory() && !/(^\.)|(\/\.)/.test(a); })
-                        .map(function (a) { return {'path': a.slice(wwwDir.length), 'etag': '' + calculateMd5(a)}; })
-                });
-                break;
-
-            default:
-                next();
+        case '/' + platform + '/config.xml':
+            response.sendFile(configXml);
+            break;
+
+        case '/' + platform + '/project.json':
+            response.send({
+                'configPath': '/' + platform + '/config.xml',
+                'wwwPath': '/' + platform + '/www',
+                'wwwFileList': shell.find(wwwDir)
+                    .filter(function (a) { return !fs.statSync(a).isDirectory() && !/(^\.)|(\/\.)/.test(a); })
+                    .map(function (a) { return {'path': a.slice(wwwDir.length), 'etag': '' + calculateMd5(a)}; })
+            });
+            break;
+
+        default:
+            next();
         }
     };
 }
@@ -96,7 +96,7 @@ function getPlatformHandler(platform, wwwDir, configXml) {
 // https://issues.apache.org/jira/browse/CB-11274
 // Use referer url to redirect absolute urls to the requested platform resources
 // so that an URL is resolved against that platform www directory.
-function getAbsolutePathHandler() {
+function getAbsolutePathHandler () {
     return function (request, response, next) {
         if (!request.headers.referer) {
             next();
@@ -115,13 +115,13 @@ function getAbsolutePathHandler() {
     };
 }
 
-function calculateMd5(fileName) {
-    var md5sum,
-        BUF_LENGTH = 64*1024,
-        buf = new Buffer(BUF_LENGTH),
-        bytesRead = BUF_LENGTH,
-        pos = 0,
-        fdr = fs.openSync(fileName, 'r');
+function calculateMd5 (fileName) {
+    var md5sum;
+    var BUF_LENGTH = 64 * 1024;
+    var buf = Buffer.from(BUF_LENGTH);
+    var bytesRead = BUF_LENGTH;
+    var pos = 0;
+    var fdr = fs.openSync(fileName, 'r');
 
     try {
         md5sum = crypto.createHash('md5');
@@ -136,10 +136,10 @@ function calculateMd5(fileName) {
     return md5sum.digest('hex');
 }
 
-module.exports = function server(port, opts) {
+module.exports = function server (port, opts) {
     port = +port || 8000;
 
-    return Q.promise(function(resolve) {
+    return Q.promise(function (resolve) {
         projectRoot = cordova_util.cdProjectRoot();
 
         var hooksRunner = new HooksRunner(projectRoot);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/targets.js
----------------------------------------------------------------------
diff --git a/src/cordova/targets.js b/src/cordova/targets.js
index 0ba8d58..47086d6 100644
--- a/src/cordova/targets.js
+++ b/src/cordova/targets.js
@@ -17,13 +17,13 @@
     under the License.
 */
 
-var cordova_util = require('./util'),
-    Q = require('q'),
-    superspawn = require('cordova-common').superspawn,
-    path = require('path'),
-    events = require('cordova-common').events;
+var cordova_util = require('./util');
+var Q = require('q');
+var superspawn = require('cordova-common').superspawn;
+var path = require('path');
+var events = require('cordova-common').events;
 
-function handleError(error) {
+function handleError (error) {
     if (error.code === 'ENOENT') {
         events.emit('warn', 'Platform does not support ' + this.script);
     } else {
@@ -32,33 +32,33 @@ function handleError(error) {
     }
 }
 
-function displayDevices(projectRoot, platform, options) {
+function displayDevices (projectRoot, platform, options) {
     var caller = { 'script': 'list-devices' };
     events.emit('log', 'Available ' + platform + ' devices:');
     var cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'lib', 'list-devices');
     return superspawn.spawn(cmd, options.argv, { stdio: 'inherit', chmod: true }).catch(handleError.bind(caller));
 }
 
-function displayVirtualDevices(projectRoot, platform, options) {
+function displayVirtualDevices (projectRoot, platform, options) {
     var caller = { 'script': 'list-emulator-images' };
     events.emit('log', 'Available ' + platform + ' virtual devices:');
     var cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'lib', 'list-emulator-images');
     return superspawn.spawn(cmd, options.argv, { stdio: 'inherit', chmod: true }).catch(handleError.bind(caller));
 }
 
-module.exports = function targets(options) {
+module.exports = function targets (options) {
     var projectRoot = cordova_util.cdProjectRoot();
     options = cordova_util.preProcessOptions(options);
 
     var result = Q();
-    options.platforms.forEach(function(platform) {
+    options.platforms.forEach(function (platform) {
         if (options.options.device) {
             result = result.then(displayDevices.bind(null, projectRoot, platform, options.options));
-        } else if(options.options.emulator) {
+        } else if (options.options.emulator) {
             result = result.then(displayVirtualDevices.bind(null, projectRoot, platform, options.options));
         } else {
             result = result.then(displayDevices.bind(null, projectRoot, platform, options.options))
-            .then(displayVirtualDevices.bind(null, projectRoot, platform, options.options));
+                .then(displayVirtualDevices.bind(null, projectRoot, platform, options.options));
         }
     });
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/util.js
----------------------------------------------------------------------
diff --git a/src/cordova/util.js b/src/cordova/util.js
index c9407dc..e08fbd5 100644
--- a/src/cordova/util.js
+++ b/src/cordova/util.js
@@ -17,23 +17,22 @@
     under the License.
 */
 
-/* jshint sub:true */
-var fs            = require('fs'),
-    path          = require('path'),
-    events        = require('cordova-common').events,
-    CordovaError  = require('cordova-common').CordovaError,
-    shell         = require('shelljs'),
-    url           = require('url'),
-    nopt          = require('nopt'),
-    Q             = require('q'),
-    semver        = require('semver'),
-    aliasMethod   = require('../util/alias'),
-    platforms     = require('../platforms/platforms');
+var fs = require('fs');
+var path = require('path');
+var events = require('cordova-common').events;
+var CordovaError = require('cordova-common').CordovaError;
+var shell = require('shelljs');
+var url = require('url');
+var nopt = require('nopt');
+var Q = require('q');
+var semver = require('semver');
+var aliasMethod = require('../util/alias');
+var platforms = require('../platforms/platforms');
 
 // Global configuration paths
 var global_config_path = process.env['CORDOVA_HOME'];
 if (!global_config_path) {
-    var HOME = process.env[(process.platform.slice(0, 3) == 'win') ? 'USERPROFILE' : 'HOME'];
+    var HOME = process.env[(process.platform.slice(0, 3) === 'win') ? 'USERPROFILE' : 'HOME'];
     global_config_path = path.join(HOME, '.cordova');
 }
 
@@ -41,17 +40,16 @@ var origCwd = null;
 
 var lib_path = path.join(global_config_path, 'lib');
 
-
 exports.binname = 'cordova';
 exports.globalConfig = global_config_path;
 
 // defer defining libDirectory on exports so we don't create it if
 // someone simply requires this module
-Object.defineProperty(exports,'libDirectory', {
-        configurable: true,
-        get: function () {
-            shell.mkdir('-p', lib_path);
-            exports.libDirectory = lib_path;
+Object.defineProperty(exports, 'libDirectory', {
+    configurable: true,
+    get: function () {
+        shell.mkdir('-p', lib_path);
+        exports.libDirectory = lib_path;
         return lib_path;
     }
 });
@@ -86,38 +84,35 @@ exports.hostSupports = hostSupports;
 exports.removePlatformPluginsJson = removePlatformPluginsJson;
 
 // Remove <platform>.json file from plugins directory.
-function removePlatformPluginsJson(projectRoot, target) {
+function removePlatformPluginsJson (projectRoot, target) {
     var plugins_json = path.join(projectRoot, 'plugins', target + '.json');
     shell.rm('-f', plugins_json);
 }
 
 // Used to prevent attempts of installing platforms that are not supported on
 // the host OS. E.g. ios on linux.
-function hostSupports(platform) {
-    var p = platforms[platform] || {},
-        hostos = p.hostos || null;
-    if (!hostos)
-        return true;
-    if (hostos.indexOf('*') >= 0)
-        return true;
-    if (hostos.indexOf(process.platform) >= 0)
-        return true;
+function hostSupports (platform) {
+    var p = platforms[platform] || {};
+    var hostos = p.hostos || null;
+    if (!hostos) { return true; }
+    if (hostos.indexOf('*') >= 0) { return true; }
+    if (hostos.indexOf(process.platform) >= 0) { return true; }
     return false;
 }
 
-function requireNoCache(pkgJsonPath) {
+function requireNoCache (pkgJsonPath) {
     delete require.cache[require.resolve(pkgJsonPath)];
     var returnVal = require(pkgJsonPath);
     delete require.cache[require.resolve(pkgJsonPath)];
     return returnVal;
 }
 
-function isUrl(value) {
+function isUrl (value) {
     var u = value && url.parse(value);
     return !!(u && u.protocol && u.protocol.length > 2); // Account for windows c:/ paths
 }
 
-function isRootDir(dir) {
+function isRootDir (dir) {
     if (fs.existsSync(path.join(dir, 'www'))) {
         if (fs.existsSync(path.join(dir, 'config.xml'))) {
             // For sure is.
@@ -138,12 +133,12 @@ function isRootDir(dir) {
 // Runs up the directory chain looking for a .cordova directory.
 // IF it is found we are in a Cordova project.
 // Omit argument to use CWD.
-function isCordova(dir) {
+function isCordova (dir) {
     if (!dir) {
         // Prefer PWD over cwd so that symlinked dirs within your PWD work correctly (CB-5687).
         var pwd = process.env.PWD;
         var cwd = process.cwd();
-        if (pwd && pwd != cwd && pwd != 'undefined') {
+        if (pwd && pwd !== cwd && pwd !== 'undefined') {
             return this.isCordova(pwd) || this.isCordova(cwd);
         }
         return this.isCordova(cwd);
@@ -159,7 +154,7 @@ function isCordova(dir) {
         }
         var parentDir = path.normalize(path.join(dir, '..'));
         // Detect fs root.
-        if (parentDir == dir) {
+        if (parentDir === dir) {
             return bestReturnValueSoFar;
         }
         dir = parentDir;
@@ -169,7 +164,7 @@ function isCordova(dir) {
 }
 
 // Cd to project root dir and return its path. Throw CordovaError if not in a Corodva project.
-function cdProjectRoot() {
+function cdProjectRoot () {
     var projectRoot = convertToRealPathSafe(this.isCordova());
     if (!projectRoot) {
         throw new CordovaError('Current working directory is not a Cordova-based project.');
@@ -182,18 +177,18 @@ function cdProjectRoot() {
     return projectRoot;
 }
 
-function getOrigWorkingDirectory() {
+function getOrigWorkingDirectory () {
     return origCwd || process.env.PWD || process.cwd();
 }
 
-function _resetOrigCwd() {
+function _resetOrigCwd () {
     origCwd = null;
 }
 
 // Fixes up relative paths that are no longer valid due to chdir() within cdProjectRoot().
-function fixRelativePath(value, /* optional */ cwd) {
+function fixRelativePath (value, /* optional */ cwd) {
     // Don't touch absolute paths.
-    if (value[1] == ':' || value[0] == path.sep) {
+    if (value[1] === ':' || value[0] === path.sep) {
         return value;
     }
     var newDir = cwd || process.env.PWD || process.cwd();
@@ -204,7 +199,7 @@ function fixRelativePath(value, /* optional */ cwd) {
 }
 
 // Resolve any symlinks in order to avoid relative path issues. See https://issues.apache.org/jira/browse/CB-8757
-function convertToRealPathSafe(path) {
+function convertToRealPathSafe (path) {
     if (path && fs.existsSync(path)) {
         return fs.realpathSync(path);
     }
@@ -213,72 +208,72 @@ function convertToRealPathSafe(path) {
 }
 
 // Recursively deletes .svn folders from a target path
-function deleteSvnFolders(dir) {
+function deleteSvnFolders (dir) {
     var contents = fs.readdirSync(dir);
-    contents.forEach(function(entry) {
+    contents.forEach(function (entry) {
         var fullpath = path.join(dir, entry);
         if (isDirectory(fullpath)) {
-            if (entry == '.svn') {
+            if (entry === '.svn') {
                 shell.rm('-rf', fullpath);
             } else module.exports.deleteSvnFolders(fullpath);
         }
     });
 }
 
-function listPlatforms(project_dir) {
+function listPlatforms (project_dir) {
     var platforms_dir = path.join(project_dir, 'platforms');
-    if ( !fs.existsSync(platforms_dir)) {
+    if (!fs.existsSync(platforms_dir)) {
         return [];
     }
     // get subdirs (that are actually dirs, and not files)
     var subdirs = fs.readdirSync(platforms_dir)
-    .filter(function(file) {
-        return isDirectory(path.join(platforms_dir, file));
-    });
+        .filter(function (file) {
+            return isDirectory(path.join(platforms_dir, file));
+        });
     return subdirs;
 }
 
-function getInstalledPlatformsWithVersions(project_dir) {
+function getInstalledPlatformsWithVersions (project_dir) {
     var result = {};
     var platforms_on_fs = listPlatforms(project_dir);
 
-    return Q.all(platforms_on_fs.map(function(p) {
-        var superspawn    = require('cordova-common').superspawn;
+    return Q.all(platforms_on_fs.map(function (p) {
+        var superspawn = require('cordova-common').superspawn;
         return superspawn.maybeSpawn(path.join(project_dir, 'platforms', p, 'cordova', 'version'), [], { chmod: true })
-        .then(function(v) {
-            result[p] = v || null;
-        }, function(v) {
-            result[p] = 'broken';
-        });
-    })).then(function() {
+            .then(function (v) {
+                result[p] = v || null;
+            }, function (v) {
+                result[p] = 'broken';
+            });
+    })).then(function () {
         return result;
     });
 }
 
 // list the directories in the path, ignoring any files
-function findPlugins(pluginDir) {
+function findPlugins (pluginDir) {
     var plugins = [];
 
     if (fs.existsSync(pluginDir)) {
         plugins = fs.readdirSync(pluginDir).filter(function (fileName) {
             var pluginPath = path.join(pluginDir, fileName);
             var isPlugin = isDirectory(pluginPath) || isSymbolicLink(pluginPath);
-            return fileName != '.svn' && fileName != 'CVS' && isPlugin;
+            return fileName !== '.svn' && fileName !== 'CVS' && isPlugin;
         });
     }
 
     return plugins;
 }
 
-function appDir(projectDir) {
+function appDir (projectDir) {
     return projectDir;
 }
 
-function projectWww(projectDir) {
+function projectWww (projectDir) {
     return path.join(projectDir, 'www');
 }
 
-function projectConfig(projectDir) {
+function projectConfig (projectDir) {
     var rootPath = path.join(projectDir, 'config.xml');
     var wwwPath = path.join(projectDir, 'www', 'config.xml');
     if (fs.existsSync(rootPath)) {
@@ -314,7 +309,7 @@ function preProcessOptions (inputOptions) {
     }
     var projectPlatforms = this.listPlatforms(projectRoot);
     if (projectPlatforms.length === 0) {
-        throw new CordovaError('No platforms added to this project. Please use `'+exports.binname+' platform add <platform>`.');
+        throw new CordovaError('No platforms added to this project. Please use `' + exports.binname + ' platform add <platform>`.');
     }
     if (result.platforms.length === 0) {
         result.platforms = projectPlatforms;
@@ -341,8 +336,7 @@ function preProcessOptions (inputOptions) {
 function ensurePlatformOptionsCompatible (platformOptions) {
     var opts = platformOptions || {};
 
-    if (!Array.isArray(opts))
-        return opts;
+    if (!Array.isArray(opts)) { return opts; }
 
     events.emit('warn', 'The format of cordova.* methods "options" argument was changed in 5.4.0. ' +
         '"options.options" property now should be an object instead of an array of plain strings. Though the old format ' +
@@ -362,24 +356,24 @@ function ensurePlatformOptionsCompatible (platformOptions) {
 
     opts = nopt({}, {}, opts, 0);
     opts.argv = Object.keys(opts)
-    .filter(function (arg) {
-        return arg !== 'argv' && knownArgs.indexOf(arg) === -1;
-    }).map(function (arg) {
-        return opts[arg] === true ?
-            '--' + arg :
-            '--' + arg + '=' + opts[arg].toString();
-    });
+        .filter(function (arg) {
+            return arg !== 'argv' && knownArgs.indexOf(arg) === -1;
+        }).map(function (arg) {
+            return opts[arg] === true ?
+                '--' + arg :
+                '--' + arg + '=' + opts[arg].toString();
+        });
 
     return opts;
 }
 
 /**
  * Checks to see if the argument is a directory
- * 
+ *
  * @param {string} dir - string representing path of directory
  * @return {boolean}
  */
-function isDirectory(dir) {
+function isDirectory (dir) {
     try {
         return fs.lstatSync(dir).isDirectory();
     } catch (e) {
@@ -389,11 +383,11 @@ function isDirectory(dir) {
 
 /**
  * Checks to see if the argument is a symbolic link
- * 
+ *
  * @param {string} dir - string representing path of directory
  * @return {boolean}
  */
-function isSymbolicLink(dir) {
+function isSymbolicLink (dir) {
     try {
         return fs.lstatSync(dir).isSymbolicLink();
     } catch (e) {
@@ -407,7 +401,7 @@ function isSymbolicLink(dir) {
  * @param {string} version - semver version or range (loose allowed).
  * @returns {Promise} Promise for version (a valid semver version if one is found, otherwise whatever was provided).
  */
-function getLatestMatchingNpmVersion(module_name, version) {
+function getLatestMatchingNpmVersion (module_name, version) {
     if (!version) {
         // If no version specified, get the latest
         return getLatestNpmVersion(module_name);
@@ -436,7 +430,7 @@ function getLatestMatchingNpmVersion(module_name, version) {
  * @param {string} module_name - npm module name.
  * @returns {Promise} Promise for an array of versions.
  */
-function getAvailableNpmVersions(module_name) {
+function getAvailableNpmVersions (module_name) {
     var npm = require('npm');
     return Q.nfcall(npm.load).then(function () {
         return Q.ninvoke(npm.commands, 'view', [module_name, 'versions'], /* silent = */ true).then(function (result) {
@@ -453,7 +447,7 @@ function getAvailableNpmVersions(module_name) {
  * @param {string} module_name - npm module name.
  * @returns {Promise} Promise for an array of versions.
  */
-function getLatestNpmVersion(module_name) {
+function getLatestNpmVersion (module_name) {
     var npm = require('npm');
     return Q.nfcall(npm.load).then(function () {
         return Q.ninvoke(npm.commands, 'view', [module_name, 'version'], /* silent = */ true).then(function (result) {
@@ -466,7 +460,7 @@ function getLatestNpmVersion(module_name) {
 }
 
 // Display deprecation message if platform is api compatible
-function checkPlatformApiCompatible(platform) {
+function checkPlatformApiCompatible (platform) {
     if (platforms[platform] && platforms[platform].apiCompatibleSince) {
         events.emit('warn', ' Using this version of Cordova with older version of cordova-' + platform +
             ' is deprecated. Upgrade to cordova-' + platform + '@' +
@@ -474,7 +468,7 @@ function checkPlatformApiCompatible(platform) {
     }
 }
 
-//libdir should be path to API.js
+// libdir should be path to API.js
 function getPlatformApiFunction (libDir, platform) {
     var PlatformApi;
     try {
@@ -507,9 +501,8 @@ function getPlatformApiFunction (libDir, platform) {
                 '". Using polyfill instead.');
             PlatformApi = require('../platforms/PlatformApiPoly.js');
         } else if (!PlatformApi) {
-            throw new Error('Your ' + platform + ' platform does not have Api.js');
+            throw new Error('Your ' + platform + ' platform does not have Api.js'); // eslint-disable-line no-unsafe-finally
         }
     }
     return PlatformApi;
 }
-

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/gitclone.js
----------------------------------------------------------------------
diff --git a/src/gitclone.js b/src/gitclone.js
index e398675..9aa2fc4 100644
--- a/src/gitclone.js
+++ b/src/gitclone.js
@@ -17,20 +17,19 @@
     under the License.
 */
 
-var  Q             = require('q'),
-     shell         = require('shelljs'),
-     events        = require('cordova-common').events,
-     path          = require('path'),
-     superspawn    = require('cordova-common').superspawn,
-     os            = require('os');
-
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var path = require('path');
+var superspawn = require('cordova-common').superspawn;
+var os = require('os');
 
 exports.clone = clone;
 
 //  clone_dir, if provided is the directory that git will clone into.
 //  if no clone_dir is supplied, a temp directory will be created and used by git.
-function clone(git_url, git_ref, clone_dir){
-    
+function clone (git_url, git_ref, clone_dir) {
+
     var needsGitCheckout = !!git_ref;
     if (!shell.which('git')) {
         return Q.reject(new Error('"git" command line tool is not installed: make sure it is accessible on your PATH.'));
@@ -38,32 +37,32 @@ function clone(git_url, git_ref, clone_dir){
 
     // If no clone_dir is specified, create a tmp dir which git will clone into.
     var tmp_dir = clone_dir;
-    if(!tmp_dir){
+    if (!tmp_dir) {
         tmp_dir = path.join(os.tmpdir(), 'git', String((new Date()).valueOf()));
     }
     shell.rm('-rf', tmp_dir);
     shell.mkdir('-p', tmp_dir);
-    
+
     var cloneArgs = ['clone'];
-    if(!needsGitCheckout) {
+    if (!needsGitCheckout) {
         // only get depth of 1 if there is no branch/commit specified
         cloneArgs.push('--depth=1');
     }
     cloneArgs.push(git_url, tmp_dir);
     return superspawn.spawn('git', cloneArgs)
-    .then(function() {
-        if (needsGitCheckout){
-            return superspawn.spawn('git', ['checkout', git_ref], {
-                cwd: tmp_dir
-            });
-        }
-    })
-    .then(function(){
-        events.emit('log', 'Repository "' + git_url + '" checked out to git ref "' + (git_ref || 'master') + '".');
-        return tmp_dir;
-    })
-    .fail(function (err) {
-        shell.rm('-rf', tmp_dir);
-        return Q.reject(err);
-    });
+        .then(function () {
+            if (needsGitCheckout) {
+                return superspawn.spawn('git', ['checkout', git_ref], {
+                    cwd: tmp_dir
+                });
+            }
+        })
+        .then(function () {
+            events.emit('log', 'Repository "' + git_url + '" checked out to git ref "' + (git_ref || 'master') + '".');
+            return tmp_dir;
+        })
+        .fail(function (err) {
+            shell.rm('-rf', tmp_dir);
+            return Q.reject(err);
+        });
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/hooks/Context.js
----------------------------------------------------------------------
diff --git a/src/hooks/Context.js b/src/hooks/Context.js
index ed7f8a7..eadd3cd 100644
--- a/src/hooks/Context.js
+++ b/src/hooks/Context.js
@@ -26,19 +26,19 @@ var events = require('cordova-common').events;
  * @param {String} hook The hook type
  * @param {Object} opts Hook options
  * @returns {Object} */
-function Context(hook, opts) {
+function Context (hook, opts) {
     var prop;
     this.hook = hook;
 
-    //create new object, to avoid affecting input opts in other places
-    //For example context.opts.plugin = Object is done, then it affects by reference
+    // create new object, to avoid affecting input opts in other places
+    // For example context.opts.plugin = Object is done, then it affects by reference
     this.opts = {};
     for (prop in opts) {
-    if (opts.hasOwnProperty(prop)) {
-        this.opts[prop] = opts[prop];
-      }
+        if (opts.hasOwnProperty(prop)) {
+            this.opts[prop] = opts[prop];
+        }
     }
-    this.cmdLine =  process.argv.join(' ');
+    this.cmdLine = process.argv.join(' ');
     this.cordova = require('../cordova/cordova');
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/hooks/HooksRunner.js
----------------------------------------------------------------------
diff --git a/src/hooks/HooksRunner.js b/src/hooks/HooksRunner.js
index 7206ffd..6e4e879 100644
--- a/src/hooks/HooksRunner.js
+++ b/src/hooks/HooksRunner.js
@@ -16,16 +16,16 @@
  specific language governing permissions and limitations
  under the License.
  */
-var cordovaUtil  = require('../cordova/util'),
-    events = require('cordova-common').events,
-    Q = require('q'),
-    scriptsFinder = require('./scriptsFinder'),
-    Context = require('./Context'),
-    CordovaError = require('cordova-common').CordovaError,
-    path = require('path'),
-    fs = require('fs'),
-    os = require('os'),
-    superspawn = require('cordova-common').superspawn;
+var cordovaUtil = require('../cordova/util');
+var events = require('cordova-common').events;
+var Q = require('q');
+var scriptsFinder = require('./scriptsFinder');
+var Context = require('./Context');
+var CordovaError = require('cordova-common').CordovaError;
+var path = require('path');
+var fs = require('fs');
+var os = require('os');
+var superspawn = require('cordova-common').superspawn;
 
 var isWindows = os.platform().slice(0, 3) === 'win';
 
@@ -33,7 +33,7 @@ var isWindows = os.platform().slice(0, 3) === 'win';
  * Tries to create a HooksRunner for passed project root.
  * @constructor
  */
-function HooksRunner(projectRoot) {
+function HooksRunner (projectRoot) {
     var root = cordovaUtil.isCordova(projectRoot);
     if (!root) throw new CordovaError('Not a Cordova project ("' + projectRoot + '"), can\'t use hooks.');
     else this.projectRoot = root;
@@ -43,9 +43,9 @@ function HooksRunner(projectRoot) {
  * Fires all event handlers and scripts for a passed hook type.
  * Returns a promise.
  */
-HooksRunner.prototype.fire = function fire(hook, opts) {
+HooksRunner.prototype.fire = function fire (hook, opts) {
     if (isHookDisabled(opts, hook)) {
-        return Q('hook '+hook+' is disabled.');
+        return Q('hook ' + hook + ' is disabled.');
     }
 
     // args check
@@ -64,7 +64,7 @@ HooksRunner.prototype.fire = function fire(hook, opts) {
     }
 
     // execute hook event listeners first
-    return executeEventHandlersSerially(hook, opts).then(function() {
+    return executeEventHandlersSerially(hook, opts).then(function () {
         // then execute hook script files
         var context = new Context(hook, opts);
         return runScriptsSerially(scripts, context);
@@ -74,17 +74,17 @@ HooksRunner.prototype.fire = function fire(hook, opts) {
 /**
  * Refines passed options so that all required parameters are set.
  */
-HooksRunner.prototype.prepareOptions = function(opts) {
+HooksRunner.prototype.prepareOptions = function (opts) {
     opts = opts || {};
     opts.projectRoot = this.projectRoot;
     opts.cordova = opts.cordova || {};
     opts.cordova.platforms = opts.cordova.platforms || opts.platforms || cordovaUtil.listPlatforms(opts.projectRoot);
-    opts.cordova.platforms = opts.cordova.platforms.map(function(platform) { return platform.split('@')[0]; } );
+    opts.cordova.platforms = opts.cordova.platforms.map(function (platform) { return platform.split('@')[0]; });
     opts.cordova.plugins = opts.cordova.plugins || opts.plugins || cordovaUtil.findPlugins(path.join(opts.projectRoot, 'plugins'));
 
     try {
         opts.cordova.version = opts.cordova.version || require('../../package').version;
-    } catch(ex) {
+    } catch (ex) {
         events.emit('warn', 'HooksRunner could not load package.json: ' + ex.message);
     }
 
@@ -98,9 +98,9 @@ module.exports = HooksRunner;
  * Returns a promise.
  */
 module.exports.fire = globalFire;
-function globalFire(hook, opts) {
+function globalFire (hook, opts) {
     if (isHookDisabled(opts, hook)) {
-        return Q('hook '+hook+' is disabled.');
+        return Q('hook ' + hook + ' is disabled.');
     }
 
     opts = opts || {};
@@ -108,12 +108,12 @@ function globalFire(hook, opts) {
 }
 
 // Returns a promise.
-function executeEventHandlersSerially(hook, opts) {
+function executeEventHandlersSerially (hook, opts) {
     var handlers = events.listeners(hook);
     if (handlers.length) {
         // Chain the handlers in series.
-        return handlers.reduce(function(soFar, f) {
-            return soFar.then(function() { return f(opts); });
+        return handlers.reduce(function (soFar, f) {
+            return soFar.then(function () { return f(opts); });
         }, Q());
     } else {
         return Q(); // Nothing to do.
@@ -128,8 +128,8 @@ function runScriptsSerially (scripts, context) {
     if (scripts.length === 0) {
         events.emit('verbose', 'No scripts found for hook "' + context.hook + '".');
     }
-    return scripts.reduce(function(prevScriptPromise, nextScript) {
-        return prevScriptPromise.then(function() {
+    return scripts.reduce(function (prevScriptPromise, nextScript) {
+        return prevScriptPromise.then(function () {
             return runScript(nextScript, context);
         });
     }, Q());
@@ -138,11 +138,11 @@ function runScriptsSerially (scripts, context) {
 /**
  * Async runs single script file.
  */
-function runScript(script, context) {
-    if (typeof script.useModuleLoader == 'undefined') {
+function runScript (script, context) {
+    if (typeof script.useModuleLoader === 'undefined') {
         // if it is not explicitly defined whether we should use modeule loader or not
         // we assume we should use module loader for .js files
-        script.useModuleLoader = path.extname(script.path).toLowerCase() == '.js';
+        script.useModuleLoader = path.extname(script.path).toLowerCase() === '.js';
     }
 
     var source;
@@ -161,7 +161,7 @@ function runScript(script, context) {
 
     events.emit('verbose', 'Executing script found in ' + source + ' for hook "' + context.hook + '": ' + relativePath);
 
-    if(script.useModuleLoader) {
+    if (script.useModuleLoader) {
         return runScriptViaModuleLoader(script, context);
     } else {
         return runScriptViaChildProcessSpawn(script, context);
@@ -171,14 +171,14 @@ function runScript(script, context) {
 /**
  * Runs script using require.
  * Returns a promise. */
-function runScriptViaModuleLoader(script, context) {
-    if(!fs.existsSync(script.fullPath)) {
+function runScriptViaModuleLoader (script, context) {
+    if (!fs.existsSync(script.fullPath)) {
         events.emit('warn', 'Script file does\'t exist and will be skipped: ' + script.fullPath);
         return Q();
     }
     var scriptFn = require(script.fullPath);
     context.scriptLocation = script.fullPath;
-    if(script.plugin) {
+    if (script.plugin) {
         context.opts.plugin = script.plugin;
     }
 
@@ -195,7 +195,7 @@ function runScriptViaModuleLoader(script, context) {
 /**
  * Runs script using child_process spawn method.
  * Returns a promise. */
-function runScriptViaChildProcessSpawn(script, context) {
+function runScriptViaChildProcessSpawn (script, context) {
     var opts = context.opts;
     var command = script.fullPath;
     var args = [opts.projectRoot];
@@ -224,9 +224,9 @@ function runScriptViaChildProcessSpawn(script, context) {
     execOpts.env.CORDOVA_CMDLINE = process.argv.join(' ');
 
     return superspawn.spawn(command, args, execOpts)
-        .catch(function(err) {
+        .catch(function (err) {
             // Don't treat non-executable files as errors. They could be READMEs, or Windows-only scripts.
-            if (!isWindows && err.code == 'EACCES') {
+            if (!isWindows && err.code === 'EACCES') {
                 events.emit('verbose', 'Skipped non-executable file: ' + script.fullPath);
             } else {
                 throw new Error('Hook failed with error code ' + err.code + ': ' + script.fullPath);
@@ -236,14 +236,14 @@ function runScriptViaChildProcessSpawn(script, context) {
 
 /**
  * Extracts shebang interpreter from script' source. */
-function extractSheBangInterpreter(fullpath) {
+function extractSheBangInterpreter (fullpath) {
     var fileChunk;
     var octetsRead;
     var fileData;
     var hookFd = fs.openSync(fullpath, 'r');
     try {
         // this is a modern cluster size. no need to read less
-        fileData = new Buffer(4096);
+        fileData = Buffer.from(4096);
         octetsRead = fs.readSync(hookFd, fileData, 0, 4096, 0);
         fileChunk = fileData.toString();
     } finally {
@@ -253,36 +253,30 @@ function extractSheBangInterpreter(fullpath) {
     var hookCmd, shMatch;
     // Filter out /usr/bin/env so that "/usr/bin/env node" works like "node".
     var shebangMatch = fileChunk.match(/^#!(?:\/usr\/bin\/env )?([^\r\n]+)/m);
-    if (octetsRead == 4096 && !fileChunk.match(/[\r\n]/))
-        events.emit('warn', 'shebang is too long for "' + fullpath + '"');
-    if (shebangMatch)
-        hookCmd = shebangMatch[1];
+    if (octetsRead === 4096 && !fileChunk.match(/[\r\n]/)) { events.emit('warn', 'shebang is too long for "' + fullpath + '"'); }
+    if (shebangMatch) { hookCmd = shebangMatch[1]; }
     // Likewise, make /usr/bin/bash work like "bash".
-    if (hookCmd)
-        shMatch = hookCmd.match(/bin\/((?:ba)?sh)$/);
-    if (shMatch)
-        hookCmd = shMatch[1];
+    if (hookCmd) { shMatch = hookCmd.match(/bin\/((?:ba)?sh)$/); }
+    if (shMatch) { hookCmd = shMatch[1]; }
     return hookCmd;
 }
 
-
 /**
  * Checks if the given hook type is disabled at the command line option.
  * @param {Object} opts - the option object that contains command line options
  * @param {String} hook - the hook type
  * @returns {Boolean} return true if the passed hook is disabled.
  */
-function isHookDisabled(opts, hook) {
+function isHookDisabled (opts, hook) {
     if (opts === undefined || opts.nohooks === undefined) {
         return false;
     }
     var disabledHooks = opts.nohooks;
     var length = disabledHooks.length;
-    for (var i=0; i<length; i++) {
+    for (var i = 0; i < length; i++) {
         if (hook.match(disabledHooks[i]) !== null) {
             return true;
         }
     }
     return false;
 }
-

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/hooks/scriptsFinder.js
----------------------------------------------------------------------
diff --git a/src/hooks/scriptsFinder.js b/src/hooks/scriptsFinder.js
index 4f4ba16..9481b20 100644
--- a/src/hooks/scriptsFinder.js
+++ b/src/hooks/scriptsFinder.js
@@ -17,22 +17,22 @@
  under the License.
  */
 
-var path = require('path'),
-    fs = require('fs'),
-    cordovaUtil = require('../cordova/util'),
-    events = require('cordova-common').events,
-    PluginInfoProvider = require('cordova-common').PluginInfoProvider,
-    ConfigParser = require('cordova-common').ConfigParser;
+var path = require('path');
+var fs = require('fs');
+var cordovaUtil = require('../cordova/util');
+var events = require('cordova-common').events;
+var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
+var ConfigParser = require('cordova-common').ConfigParser;
 
 /**
  * Implements logic to retrieve hook script files defined in special folders and configuration
  * files: config.xml, hooks/hook_type, plugins/../plugin.xml, etc
  */
-module.exports  = {
+module.exports = {
     /**
      * Returns all script files for the hook type specified.
      */
-    getHookScripts: function(hook, opts) {
+    getHookScripts: function (hook, opts) {
         // args check
         if (!hook) {
             throw new Error('hook type is not specified');
@@ -46,7 +46,7 @@ module.exports  = {
  * Returns script files defined on application level.
  * They are stored in .cordova/hooks folders and in config.xml.
  */
-function getApplicationHookScripts(hook, opts) {
+function getApplicationHookScripts (hook, opts) {
     // args check
     if (!hook) {
         throw new Error('hook type is not specified');
@@ -59,7 +59,7 @@ function getApplicationHookScripts(hook, opts) {
 /**
  * Returns script files defined by plugin developers as part of plugin.xml.
  */
-function getPluginsHookScripts(hook, opts) {
+function getPluginsHookScripts (hook, opts) {
     // args check
     if (!hook) {
         throw new Error('hook type is not specified');
@@ -67,10 +67,10 @@ function getPluginsHookScripts(hook, opts) {
 
     // In case before_plugin_install, after_plugin_install, before_plugin_uninstall hooks we receive opts.plugin and
     // retrieve scripts exclusive for this plugin.
-    if(opts.plugin) {
+    if (opts.plugin) {
         events.emit('verbose', 'Finding scripts for "' + hook + '" hook from plugin ' + opts.plugin.id + ' on ' + opts.plugin.platform + ' platform only.');
         // if plugin hook is not run for specific platform then use all available platforms
-        return getPluginScriptFiles(opts.plugin, hook, opts.plugin.platform  ? [opts.plugin.platform] : opts.cordova.platforms);
+        return getPluginScriptFiles(opts.plugin, hook, opts.plugin.platform ? [opts.plugin.platform] : opts.cordova.platforms);
     }
 
     return getAllPluginsHookScriptFiles(hook, opts);
@@ -79,19 +79,19 @@ function getPluginsHookScripts(hook, opts) {
 /**
  * Gets application level hooks from the directrory specified.
  */
-function getApplicationHookScriptsFromDir(dir) {
+function getApplicationHookScriptsFromDir (dir) {
     if (!(fs.existsSync(dir))) {
         return [];
     }
 
-    var compareNumbers = function(a, b) {
+    var compareNumbers = function (a, b) {
         // TODO SG looks very complex, do we really need this?
-        return isNaN (parseInt(a, 10)) ? a.toLowerCase().localeCompare(b.toLowerCase ? b.toLowerCase(): b)
+        return isNaN(parseInt(a, 10)) ? a.toLowerCase().localeCompare(b.toLowerCase ? b.toLowerCase() : b)
             : parseInt(a, 10) > parseInt(b, 10) ? 1 : parseInt(a, 10) < parseInt(b, 10) ? -1 : 0;
     };
 
-    var scripts = fs.readdirSync(dir).sort(compareNumbers).filter(function(s) {
-        return s[0] != '.';
+    var scripts = fs.readdirSync(dir).sort(compareNumbers).filter(function (s) {
+        return s[0] !== '.';
     });
     return scripts.map(function (scriptPath) {
         // for old style hook files we don't use module loader for backward compatibility
@@ -102,11 +102,11 @@ function getApplicationHookScriptsFromDir(dir) {
 /**
  * Gets all scripts defined in config.xml with the specified type and platforms.
  */
-function getScriptsFromConfigXml(hook, opts) {
+function getScriptsFromConfigXml (hook, opts) {
     var configPath = cordovaUtil.projectConfig(opts.projectRoot);
     var configXml = new ConfigParser(configPath);
 
-    return configXml.getHookScripts(hook, opts.cordova.platforms).map(function(scriptElement) {
+    return configXml.getHookScripts(hook, opts.cordova.platforms).map(function (scriptElement) {
         return {
             path: scriptElement.attrib.src,
             fullPath: path.join(opts.projectRoot, scriptElement.attrib.src)
@@ -117,10 +117,10 @@ function getScriptsFromConfigXml(hook, opts) {
 /**
  * Gets hook scripts defined by the plugin.
  */
-function getPluginScriptFiles(plugin, hook, platforms) {
+function getPluginScriptFiles (plugin, hook, platforms) {
     var scriptElements = plugin.pluginInfo.getHookScripts(hook, platforms);
 
-    return scriptElements.map(function(scriptElement) {
+    return scriptElements.map(function (scriptElement) {
         return {
             path: scriptElement.attrib.src,
             fullPath: path.join(plugin.dir, scriptElement.attrib.src),
@@ -132,13 +132,13 @@ function getPluginScriptFiles(plugin, hook, platforms) {
 /**
  * Gets hook scripts defined by all plugins.
  */
-function getAllPluginsHookScriptFiles(hook, opts) {
+function getAllPluginsHookScriptFiles (hook, opts) {
     var scripts = [];
     var currentPluginOptions;
 
     var plugins = (new PluginInfoProvider()).getAllWithinSearchPath(path.join(opts.projectRoot, 'plugins'));
 
-    plugins.forEach(function(pluginInfo) {
+    plugins.forEach(function (pluginInfo) {
         currentPluginOptions = {
             id: pluginInfo.id,
             pluginInfo: pluginInfo,

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/platforms/PlatformApiPoly.js
----------------------------------------------------------------------
diff --git a/src/platforms/PlatformApiPoly.js b/src/platforms/PlatformApiPoly.js
index dc78113..9a9c0d7 100644
--- a/src/platforms/PlatformApiPoly.js
+++ b/src/platforms/PlatformApiPoly.js
@@ -47,7 +47,7 @@ var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
  *
  * * platform: String that defines a platform name.
  */
-function PlatformApiPoly(platform, platformRootDir, events) {
+function PlatformApiPoly (platform, platformRootDir, events) {
     if (!platform) throw new CordovaError('\'platform\' argument is missing');
     if (!platformRootDir) throw new CordovaError('platformRootDir argument is missing');
 
@@ -55,8 +55,7 @@ function PlatformApiPoly(platform, platformRootDir, events) {
     this.platform = platform;
     this.events = events || require('cordova-common').events;
 
-    if (!(platform in knownPlatforms))
-        throw new CordovaError('Unknown platform ' + platform);
+    if (!(platform in knownPlatforms)) { throw new CordovaError('Unknown platform ' + platform); }
 
     var ParserConstructor = require(knownPlatforms[platform].parser_file);
     this._parser = new ParserConstructor(this.root);
@@ -87,21 +86,22 @@ function PlatformApiPoly(platform, platformRootDir, events) {
  *   instance or rejected with CordovaError.
  */
 PlatformApiPoly.createPlatform = function (destinationDir, projectConfig, options) {
-    if (!options || !options.platformDetails)
+    if (!options || !options.platformDetails) {
         return Q.reject(new CordovaError('Failed to find platform\'s \'create\' script. ' +
             'Either \'options\' parameter or \'platformDetails\' option is missing'));
+    }
 
     var command = path.join(options.platformDetails.libDir, 'bin', 'create');
     var commandArguments = getCreateArgs(destinationDir, projectConfig, options);
 
     return superspawn.spawn(command, commandArguments,
         { printCommand: true, stdio: 'inherit', chmod: true })
-    .then(function () {
-        var platformApi = knownPlatforms
-            .getPlatformApi(options.platformDetails.platform, destinationDir);
-        copyCordovaSrc(options.platformDetails.libDir, platformApi.getPlatformInfo());
-        return platformApi;
-    });
+        .then(function () {
+            var platformApi = knownPlatforms
+                .getPlatformApi(options.platformDetails.platform, destinationDir);
+            copyCordovaSrc(options.platformDetails.libDir, platformApi.getPlatformInfo());
+            return platformApi;
+        });
 };
 
 /**
@@ -119,19 +119,20 @@ PlatformApiPoly.createPlatform = function (destinationDir, projectConfig, option
  *   instance or rejected with CordovaError.
  */
 PlatformApiPoly.updatePlatform = function (destinationDir, options) {
-    if (!options || !options.platformDetails)
+    if (!options || !options.platformDetails) {
         return Q.reject(new CordovaError('Failed to find platform\'s \'create\' script. ' +
             'Either \'options\' parameter or \'platformDetails\' option is missing'));
+    }
 
     var command = path.join(options.platformDetails.libDir, 'bin', 'update');
     return superspawn.spawn(command, [destinationDir],
         { printCommand: true, stdio: 'inherit', chmod: true })
-    .then(function () {
-        var platformApi = knownPlatforms
-            .getPlatformApi(options.platformDetails.platform, destinationDir);
-        copyCordovaSrc(options.platformDetails.libDir, platformApi.getPlatformInfo());
-        return platformApi;
-    });
+        .then(function () {
+            var platformApi = knownPlatforms
+                .getPlatformApi(options.platformDetails.platform, destinationDir);
+            copyCordovaSrc(options.platformDetails.libDir, platformApi.getPlatformInfo());
+            return platformApi;
+        });
 };
 
 /**
@@ -227,9 +228,10 @@ PlatformApiPoly.prototype.prepare = function (cordovaProject, options) {
  */
 PlatformApiPoly.prototype.addPlugin = function (plugin, installOptions) {
 
-    if (!plugin || !(plugin instanceof PluginInfo))
+    if (!plugin || !(plugin instanceof PluginInfo)) {
         return Q.reject('The parameter is incorrect. The first parameter ' +
             'should be valid PluginInfo instance');
+    }
 
     installOptions = installOptions || {};
     installOptions.variables = installOptions.variables || {};
@@ -245,36 +247,36 @@ PlatformApiPoly.prototype.addPlugin = function (plugin, installOptions) {
     plugin.getFilesAndFrameworks(this.platform)
         .concat(plugin.getAssets(this.platform))
         .concat(plugin.getJsModules(this.platform))
-    .forEach(function(item) {
-        actions.push(actions.createAction(
-            self._getInstaller(item.itemType), [item, plugin.dir, plugin.id, installOptions, projectFile],
-            self._getUninstaller(item.itemType), [item, plugin.dir, plugin.id, installOptions, projectFile]));
-    });
+        .forEach(function (item) {
+            actions.push(actions.createAction(
+                self._getInstaller(item.itemType), [item, plugin.dir, plugin.id, installOptions, projectFile],
+                self._getUninstaller(item.itemType), [item, plugin.dir, plugin.id, installOptions, projectFile]));
+        });
 
     // run through the action stack
     return actions.process(this.platform, this.root)
-    .then(function () {
-        if (projectFile) {
-            projectFile.write();
-        }
-
-        // Add PACKAGE_NAME variable into vars
-        if (!installOptions.variables.PACKAGE_NAME) {
-            installOptions.variables.PACKAGE_NAME = self._handler.package_name(self.root);
-        }
-
-        self._munger
-            // Ignore passed `is_top_level` option since platform itself doesn't know
-            // anything about managing dependencies - it's responsibility of caller.
-            .add_plugin_changes(plugin, installOptions.variables, /*is_top_level=*/true, /*should_increment=*/true)
-            .save_all();
-
-        var targetDir = installOptions.usePlatformWww ?
-            self.getPlatformInfo().locations.platformWww :
-            self.getPlatformInfo().locations.www;
-
-        self._addModulesInfo(plugin, targetDir);
-    });
+        .then(function () {
+            if (projectFile) {
+                projectFile.write();
+            }
+
+            // Add PACKAGE_NAME variable into vars
+            if (!installOptions.variables.PACKAGE_NAME) {
+                installOptions.variables.PACKAGE_NAME = self._handler.package_name(self.root);
+            }
+
+            self._munger
+                // Ignore passed `is_top_level` option since platform itself doesn't know
+                // anything about managing dependencies - it's responsibility of caller.
+                .add_plugin_changes(plugin, installOptions.variables, /* is_top_level= */true, /* should_increment= */true)
+                .save_all();
+
+            var targetDir = installOptions.usePlatformWww ?
+                self.getPlatformInfo().locations.platformWww :
+                self.getPlatformInfo().locations.www;
+
+            self._addModulesInfo(plugin, targetDir);
+        });
 };
 
 /**
@@ -305,34 +307,34 @@ PlatformApiPoly.prototype.removePlugin = function (plugin, uninstallOptions) {
     plugin.getFilesAndFrameworks(this.platform)
         .concat(plugin.getAssets(this.platform))
         .concat(plugin.getJsModules(this.platform))
-    .forEach(function(item) {
-        actions.push(actions.createAction(
-            self._getUninstaller(item.itemType), [item, plugin.dir, plugin.id, uninstallOptions, projectFile],
-            self._getInstaller(item.itemType), [item, plugin.dir, plugin.id, uninstallOptions, projectFile]));
-    });
+        .forEach(function (item) {
+            actions.push(actions.createAction(
+                self._getUninstaller(item.itemType), [item, plugin.dir, plugin.id, uninstallOptions, projectFile],
+                self._getInstaller(item.itemType), [item, plugin.dir, plugin.id, uninstallOptions, projectFile]));
+        });
 
     // run through the action stack
     return actions.process(this.platform, this.root)
-    .then(function() {
-        if (projectFile) {
-            projectFile.write();
-        }
-
-        self._munger
-            // Ignore passed `is_top_level` option since platform itself doesn't know
-            // anything about managing dependencies - it's responsibility of caller.
-            .remove_plugin_changes(plugin, /*is_top_level=*/true)
-            .save_all();
-
-        var targetDir = uninstallOptions.usePlatformWww ?
-            self.getPlatformInfo().locations.platformWww :
-            self.getPlatformInfo().locations.www;
-
-        self._removeModulesInfo(plugin, targetDir);
-        // Remove stale plugin directory
-        // TODO: this should be done by plugin files uninstaller
-        shell.rm('-rf', path.resolve(self.root, 'Plugins', plugin.id));
-    });
+        .then(function () {
+            if (projectFile) {
+                projectFile.write();
+            }
+
+            self._munger
+                // Ignore passed `is_top_level` option since platform itself doesn't know
+                // anything about managing dependencies - it's responsibility of caller.
+                .remove_plugin_changes(plugin, /* is_top_level= */true)
+                .save_all();
+
+            var targetDir = uninstallOptions.usePlatformWww ?
+                self.getPlatformInfo().locations.platformWww :
+                self.getPlatformInfo().locations.www;
+
+            self._removeModulesInfo(plugin, targetDir);
+            // Remove stale plugin directory
+            // TODO: this should be done by plugin files uninstaller
+            shell.rm('-rf', path.resolve(self.root, 'Plugins', plugin.id));
+        });
 };
 
 PlatformApiPoly.prototype.updatePlugin = function (plugin, updateOptions) {
@@ -343,9 +345,9 @@ PlatformApiPoly.prototype.updatePlugin = function (plugin, updateOptions) {
     updateOptions.usePlatformWww = true;
 
     return this.removePlugin(plugin, updateOptions)
-    .then(function () {
-        return  self.addPlugin(plugin, updateOptions);
-    });
+        .then(function () {
+            return self.addPlugin(plugin, updateOptions);
+        });
 };
 
 /**
@@ -393,7 +395,7 @@ PlatformApiPoly.prototype.updatePlugin = function (plugin, updateOptions) {
  *   there could be multiple items in output array, e.g. when multiple
  *   arhcitectures is specified.
  */
-PlatformApiPoly.prototype.build = function(buildOptions) {
+PlatformApiPoly.prototype.build = function (buildOptions) {
     var command = path.join(this.root, 'cordova', 'build');
     var commandArguments = getBuildArgs(buildOptions);
     return superspawn.spawn(command, commandArguments, {
@@ -412,7 +414,7 @@ PlatformApiPoly.prototype.build = function(buildOptions) {
  * @return {Promise} A promise either fulfilled if package was built and ran
  *   successfully, or rejected with CordovaError.
  */
-PlatformApiPoly.prototype.run = function(runOptions) {
+PlatformApiPoly.prototype.run = function (runOptions) {
     var command = path.join(this.root, 'cordova', 'run');
     var commandArguments = getBuildArgs(runOptions);
     return superspawn.spawn(command, commandArguments, {
@@ -425,7 +427,7 @@ PlatformApiPoly.prototype.run = function(runOptions) {
  * @return  {Promise}  Return a promise either fulfilled, or rejected with
  *   CordovaError.
  */
-PlatformApiPoly.prototype.clean = function() {
+PlatformApiPoly.prototype.clean = function () {
     var cmd = path.join(this.root, 'cordova', 'clean');
     return superspawn.spawn(cmd, [], { printCommand: true, stdio: 'inherit', chmod: true });
 };
@@ -438,7 +440,7 @@ PlatformApiPoly.prototype.clean = function() {
  * @return  {Promise<Requirement[]>}  Promise, resolved with set of Requirement
  *   objects for current platform.
  */
-PlatformApiPoly.prototype.requirements = function() {
+PlatformApiPoly.prototype.requirements = function () {
     var modulePath = path.join(this.root, 'cordova', 'lib', 'check_reqs');
     try {
         return require(modulePath).check_all();
@@ -463,18 +465,18 @@ module.exports = PlatformApiPoly;
  * @return  {String[]}     An array or arguments which can be passed to
  *   'bin/create'.
  */
-function getCreateArgs(destinationDir, projectConfig, options) {
+function getCreateArgs (destinationDir, projectConfig, options) {
     var platformName = options.platformDetails.platform;
     var platformVersion = options.platformDetails.version;
 
     var args = [];
     args.push(destinationDir); // output
-    args.push(projectConfig.packageName().replace(/[^\w.]/g,'_'));
+    args.push(projectConfig.packageName().replace(/[^\w.]/g, '_'));
     // CB-6992 it is necessary to normalize characters
     // because node and shell scripts handles unicode symbols differently
     // We need to normalize the name to NFD form since iOS uses NFD unicode form
     var name = projectConfig.name();
-    if (platformName == 'ios') {
+    if (platformName === 'ios') {
         var unorm = require('unorm');
         name = unorm.nfd(name);
     }
@@ -509,12 +511,12 @@ function getCreateArgs(destinationDir, projectConfig, options) {
  * @return  {String[]}         An array or arguments which can be passed to
  *   `create` build script.
  */
-function getBuildArgs(options) {
+function getBuildArgs (options) {
     // if no options passed, empty object will be returned
     if (!options) return [];
 
     var downstreamArgs = [];
-    var argNames =[
+    var argNames = [
         'debug',
         'release',
         'device',
@@ -523,7 +525,7 @@ function getBuildArgs(options) {
         'list'
     ];
 
-    argNames.forEach(function(flag) {
+    argNames.forEach(function (flag) {
         if (options[flag]) {
             downstreamArgs.push('--' + flag);
         }
@@ -552,7 +554,7 @@ function getBuildArgs(options) {
  * @param   {String}  targetDir  The directory, where updated cordova_plugins.js
  *   should be written to.
  */
-PlatformApiPoly.prototype._addModulesInfo = function(plugin, targetDir) {
+PlatformApiPoly.prototype._addModulesInfo = function (plugin, targetDir) {
     var installedModules = this._platformJson.root.modules || [];
 
     var installedPaths = installedModules.map(function (installedModule) {
@@ -560,27 +562,27 @@ PlatformApiPoly.prototype._addModulesInfo = function(plugin, targetDir) {
     });
 
     var modulesToInstall = plugin.getJsModules(this.platform)
-    .filter(function (moduleToInstall) {
-        return installedPaths.indexOf(moduleToInstall.file) === -1;
-    }).map(function (moduleToInstall) {
-        var moduleName = plugin.id + '.' + ( moduleToInstall.name || moduleToInstall.src.match(/([^\/]+)\.js/)[1] );
-        var obj = {
-            file: ['plugins', plugin.id, moduleToInstall.src].join('/'),
-            id: moduleName,
-            pluginId: plugin.id
-        };
-        if (moduleToInstall.clobbers.length > 0) {
-            obj.clobbers = moduleToInstall.clobbers.map(function(o) { return o.target; });
-        }
-        if (moduleToInstall.merges.length > 0) {
-            obj.merges = moduleToInstall.merges.map(function(o) { return o.target; });
-        }
-        if (moduleToInstall.runs) {
-            obj.runs = true;
-        }
-
-        return obj;
-    });
+        .filter(function (moduleToInstall) {
+            return installedPaths.indexOf(moduleToInstall.file) === -1;
+        }).map(function (moduleToInstall) {
+            var moduleName = plugin.id + '.' + (moduleToInstall.name || moduleToInstall.src.match(/([^\/]+)\.js/)[1]); // eslint-disable-line no-useless-escape
+            var obj = {
+                file: ['plugins', plugin.id, moduleToInstall.src].join('/'),
+                id: moduleName,
+                pluginId: plugin.id
+            };
+            if (moduleToInstall.clobbers.length > 0) {
+                obj.clobbers = moduleToInstall.clobbers.map(function (o) { return o.target; });
+            }
+            if (moduleToInstall.merges.length > 0) {
+                obj.merges = moduleToInstall.merges.map(function (o) { return o.target; });
+            }
+            if (moduleToInstall.runs) {
+                obj.runs = true;
+            }
+
+            return obj;
+        });
 
     this._platformJson.root.modules = installedModules.concat(modulesToInstall);
     if (!this._platformJson.root.plugin_metadata) {
@@ -601,17 +603,17 @@ PlatformApiPoly.prototype._addModulesInfo = function(plugin, targetDir) {
  * @param   {String}  targetDir  The directory, where updated cordova_plugins.js
  *   should be written to.
  */
-PlatformApiPoly.prototype._removeModulesInfo = function(plugin, targetDir) {
+PlatformApiPoly.prototype._removeModulesInfo = function (plugin, targetDir) {
     var installedModules = this._platformJson.root.modules || [];
     var modulesToRemove = plugin.getJsModules(this.platform)
-    .map(function (jsModule) {
-        return  ['plugins', plugin.id, jsModule.src].join('/');
-    });
+        .map(function (jsModule) {
+            return ['plugins', plugin.id, jsModule.src].join('/');
+        });
 
     var updatedModules = installedModules
-    .filter(function (installedModule) {
-        return (modulesToRemove.indexOf(installedModule.file) === -1);
-    });
+        .filter(function (installedModule) {
+            return (modulesToRemove.indexOf(installedModule.file) === -1);
+        });
 
     this._platformJson.root.modules = updatedModules;
     if (this._platformJson.root.plugin_metadata) {
@@ -644,7 +646,7 @@ PlatformApiPoly.prototype._writePluginModules = function (targetDir) {
     fs.writeFileSync(path.join(targetDir, 'cordova_plugins.js'), final_contents, 'utf-8');
 };
 
-PlatformApiPoly.prototype._getInstaller = function(type) {
+PlatformApiPoly.prototype._getInstaller = function (type) {
     var self = this;
     return function (item, plugin_dir, plugin_id, options, project) {
         var installer = self._handler[type] || common[type];
@@ -654,14 +656,14 @@ PlatformApiPoly.prototype._getInstaller = function(type) {
             self._handler.www_dir(self.root);
 
         var installerArgs = type === 'asset' ? [wwwDest] :
-            type === 'js-module' ? [plugin_id, wwwDest]:
-            [self.root, plugin_id, options, project];
+            type === 'js-module' ? [plugin_id, wwwDest] :
+                [self.root, plugin_id, options, project];
 
         installer.install.apply(null, [item, plugin_dir].concat(installerArgs));
     };
 };
 
-PlatformApiPoly.prototype._getUninstaller = function(type) {
+PlatformApiPoly.prototype._getUninstaller = function (type) {
     var self = this;
     return function (item, plugin_dir, plugin_id, options, project) {
         var uninstaller = self._handler[type] || common[type];
@@ -686,7 +688,7 @@ PlatformApiPoly.prototype._getUninstaller = function(type) {
  * @param   {PlatformInfo}  platformInfo  PlatformInfo structure, required for
  *   detecting copied files destination.
  */
-function copyCordovaSrc(sourceLib, platformInfo) {
+function copyCordovaSrc (sourceLib, platformInfo) {
     // Copy the cordova.js file to platforms/<platform>/platform_www/
     // The www dir is nuked on each prepare so we keep cordova.js in platform_www
     shell.mkdir('-p', platformInfo.locations.platformWww);
@@ -697,8 +699,8 @@ function copyCordovaSrc(sourceLib, platformInfo) {
     // We need these files to build cordova.js if using browserify method.
     var cordovaJsSrcPath = path.resolve(sourceLib, platformInfo.locations.cordovaJsSrc);
 
-    //only exists for platforms that have shipped cordova-js-src directory
-    if(fs.existsSync(cordovaJsSrcPath)) {
+    // only exists for platforms that have shipped cordova-js-src directory
+    if (fs.existsSync(cordovaJsSrcPath)) {
         shell.cp('-rf', cordovaJsSrcPath, platformInfo.locations.platformWww);
     }
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/platforms/platforms.js
----------------------------------------------------------------------
diff --git a/src/platforms/platforms.js b/src/platforms/platforms.js
index 4515c0b..bd50e95 100644
--- a/src/platforms/platforms.js
+++ b/src/platforms/platforms.js
@@ -28,7 +28,7 @@ var cachedApis = {};
 
 // getPlatformApi() should be the only method of instantiating the
 // PlatformProject classes for now.
-function getPlatformApi(platform, platformRootDir) {
+function getPlatformApi (platform, platformRootDir) {
     // if platformRootDir is not specified, try to detect it first
     if (!platformRootDir) {
         var projectRootDir = util.isCordova();
@@ -42,19 +42,18 @@ function getPlatformApi(platform, platformRootDir) {
     platformRootDir = util.convertToRealPathSafe(platformRootDir);
 
     // Make sure the platforms/platform folder exists
-    if(!fs.existsSync(platformRootDir)) {
+    if (!fs.existsSync(platformRootDir)) {
         throw new Error('The platform "' + platform + '" does not appear to have been added to this project.');
     }
 
-
     var platformApi;
     var cached = cachedApis[platformRootDir];
     var libDir = path.join(platformRootDir, 'cordova', 'Api.js');
-    if (cached && cached.platform == platform) {
+    if (cached && cached.platform === platform) {
         platformApi = cached;
     } else {
         var pApi = util.getPlatformApiFunction(libDir, platform);
-        platformApi = new pApi(platform, platformRootDir, events);
+        platformApi = new pApi(platform, platformRootDir, events); // eslint-disable-line new-cap
         cachedApis[platformRootDir] = platformApi;
     }
     return platformApi;
@@ -67,4 +66,3 @@ module.exports = platforms;
 Object.defineProperties(module.exports, {
     'getPlatformApi': {value: getPlatformApi, configurable: true, writable: true}
 });
-


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


[12/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/integration-tests/pkgJson.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/pkgJson.spec.js b/integration-tests/pkgJson.spec.js
index 7609a09..0781091 100644
--- a/integration-tests/pkgJson.spec.js
+++ b/integration-tests/pkgJson.spec.js
@@ -24,27 +24,27 @@ var helpers = require('../spec/helpers'),
     cordova = require('../src/cordova/cordova'),
     TIMEOUT = 30 * 1000,
     cordova_util = require('../src/cordova/util'),
-    semver  = require('semver');
-
-function includeFunc(container, value) {
-   var returnValue = false;
-   var pos = container.indexOf(value);
-   if (pos >= 0) {
-       returnValue = true;
-   }
-   return returnValue;
+    semver = require('semver');
+
+function includeFunc (container, value) {
+    var returnValue = false;
+    var pos = container.indexOf(value);
+    if (pos >= 0) {
+        returnValue = true;
+    }
+    return returnValue;
 }
 // This group of tests checks if plugins are added and removed as expected from package.json.
-describe('plugin end-to-end', function() {
+describe('plugin end-to-end', function () {
     var pluginId = 'cordova-plugin-device';
     var tmpDir = helpers.tmpDir('plugin_test_pkgjson');
     var project = path.join(tmpDir, 'project');
     var results;
     var testRunRoot = process.cwd();
 
-    events.on('results', function(res) { results = res; });
+    events.on('results', function (res) { results = res; });
 
-    beforeEach(function() {
+    beforeEach(function () {
         shell.rm('-rf', project);
 
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
@@ -57,13 +57,13 @@ describe('plugin end-to-end', function() {
         delete process.env.PWD;
     });
 
-    afterEach(function() {
+    afterEach(function () {
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', project);
     });
 
-    it('Test#001 : should successfully add and remove a plugin with save and correct spec', function(done) {
-        var pkgJsonPath = path.join(process.cwd(),'package.json');
+    it('Test#001 : should successfully add and remove a plugin with save and correct spec', function (done) {
+        var pkgJsonPath = path.join(process.cwd(), 'package.json');
         var pkgJson = require(pkgJsonPath);
         var cwd = process.cwd();
         var configXmlPath = path.join(cwd, 'config.xml');
@@ -77,8 +77,8 @@ describe('plugin end-to-end', function() {
         expect(pkgJsonPath).toExist();
 
         // Add the plugin with --save.
-        return cordova.plugin('add', pluginId+'@1.1.2', {'save':true, 'fetch':true})
-        .then(function() {
+        return cordova.plugin('add', pluginId + '@1.1.2', {'save': true, 'fetch': true})
+        .then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Check that the plugin and spec add was successful to pkg.json.
@@ -92,32 +92,32 @@ describe('plugin end-to-end', function() {
             configPlugin = cfg2.getPlugin(configPlugins);
             expect(configPlugins.length).toEqual(1);
             expect(configPlugin).toEqual({ name: 'cordova-plugin-device', spec: '^1.1.2', variables: {} });
-        }).then(function() {
+        }).then(function () {
             // And now remove it with --save.
-            return cordova.plugin('rm', pluginId, {'save':true, 'fetch':true});
-        }).then(function() {
+            return cordova.plugin('rm', pluginId, {'save': true, 'fetch': true});
+        }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Checking that the plugin removed is in not in the pkg.json.
             expect(pkgJson.cordova.plugins[pluginId]).toBeUndefined();
             // Spec should be removed from dependencies.
             expect(pkgJson.dependencies['cordova-plugin-device']).toBeUndefined();
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     }, TIMEOUT);
 
-    it('Test#002 : should NOT add a plugin to package.json if --save is not used', function(done) {
-        var pkgJsonPath = path.join(process.cwd(),'package.json');
+    it('Test#002 : should NOT add a plugin to package.json if --save is not used', function (done) {
+        var pkgJsonPath = path.join(process.cwd(), 'package.json');
         var pkgJson;
         expect(pkgJsonPath).toExist();
 
         // Add the geolocation plugin with --save.
-        return cordova.plugin('add', 'cordova-plugin-geolocation', {'save':true, 'fetch':true})
-        .then(function() {
+        return cordova.plugin('add', 'cordova-plugin-geolocation', {'save': true, 'fetch': true})
+        .then(function () {
             // Add a second plugin without save.
             return cordova.plugin('add', pluginId);
-        }).then(function() {
+        }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Check the plugin add was successful for the first plugin that had --save.
@@ -125,49 +125,49 @@ describe('plugin end-to-end', function() {
             expect(pkgJson.cordova.plugins['cordova-plugin-geolocation']).toBeDefined();
             // Expect that the second plugin is not added.
             expect(pkgJson.cordova.plugins[pluginId]).toBeUndefined();
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     }, TIMEOUT);
 
-    it('Test#003 : should NOT remove plugin from package.json if there is no --save', function(done) {
-        var pkgJsonPath = path.join(process.cwd(),'package.json');
+    it('Test#003 : should NOT remove plugin from package.json if there is no --save', function (done) {
+        var pkgJsonPath = path.join(process.cwd(), 'package.json');
         var pkgJson;
-        
+
         expect(pkgJsonPath).toExist();
 
         // Add the plugin with --save.
-        return cordova.plugin('add', pluginId, {'save':true})
-        .then(function() {
+        return cordova.plugin('add', pluginId, {'save': true})
+        .then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Check the platform add was successful.
             expect(pkgJson).not.toBeUndefined();
             expect(pkgJson.cordova.plugins).toBeDefined();
             expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
-        }).then(function() {
+        }).then(function () {
             // And now remove it, but without --save.
             return cordova.plugin('rm', 'cordova-plugin-device');
-        }).then(function() {
+        }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // The plugin should still be in package.json.
             expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     }, TIMEOUT);
 
-    it('Test#004 : should successfully add and remove a plugin with variables and save to package.json', function(done) {
-        var pkgJsonPath = path.join(process.cwd(),'package.json');
+    it('Test#004 : should successfully add and remove a plugin with variables and save to package.json', function (done) {
+        var pkgJsonPath = path.join(process.cwd(), 'package.json');
         var pkgJson;
         var someKey = 'someKey';
 
         expect(pkgJsonPath).toExist();
 
         // Add the plugin with --save.
-        return cordova.plugin('add', pluginId, {'save':true, 'cli_variables': {'someKey':'someValue'}})
-        .then(function() {
+        return cordova.plugin('add', pluginId, {'save': true, 'cli_variables': {'someKey': 'someValue'}})
+        .then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Check the plugin add was successful and that variables have been added too.
@@ -175,30 +175,30 @@ describe('plugin end-to-end', function() {
             expect(pkgJson.cordova.plugins).toBeDefined();
             expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
             expect(pkgJson.cordova.plugins[pluginId][someKey]).toEqual('someValue');
-        }).then(function() {
+        }).then(function () {
             // And now remove it with --save.
-            return cordova.plugin('rm', pluginId, {'save':true});
-        }).then(function() {
+            return cordova.plugin('rm', pluginId, {'save': true});
+        }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Checking that the plugin and variables were removed successfully.
             expect(pkgJson.cordova.plugins[pluginId]).toBeUndefined();
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     }, TIMEOUT);
 
     // CB-12170 : Test is commented out because not promisified correctly in cordova-create script
-    xit('Test#005 : should successfully add and remove multiple plugins with save & fetch', function(done) {
-        var pkgJsonPath = path.join(process.cwd(),'package.json');
+    xit('Test#005 : should successfully add and remove multiple plugins with save & fetch', function (done) {
+        var pkgJsonPath = path.join(process.cwd(), 'package.json');
         // Delete any previous caches of require(package.json).
         var pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-    
+
         expect(pkgJsonPath).toExist();
 
         // Add the plugin with --save.
-        return cordova.plugin('add', [pluginId,'cordova-plugin-device-motion'], {'save':true, 'fetch':true})
-        .then(function() {
+        return cordova.plugin('add', [pluginId, 'cordova-plugin-device-motion'], {'save': true, 'fetch': true})
+        .then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Check that the plugin add was successful.
@@ -208,10 +208,10 @@ describe('plugin end-to-end', function() {
             expect(pkgJson.cordova.plugins['cordova-plugin-device-motion']).toBeDefined();
             expect(pkgJson.dependencies[pluginId]).toBeDefined();
             expect(pkgJson.dependencies['cordova-plugin-device-motion']).toBeDefined();
-        }).then(function() {
+        }).then(function () {
             // And now remove it with --save.
-            return cordova.plugin('rm', [pluginId,'cordova-plugin-device-motion'], {'save':true, 'fetch':true});
-        }).then(function() {
+            return cordova.plugin('rm', [pluginId, 'cordova-plugin-device-motion'], {'save': true, 'fetch': true});
+        }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Checking that the plugin removed is in not in the platforms.
@@ -219,20 +219,20 @@ describe('plugin end-to-end', function() {
             expect(pkgJson.cordova.plugins['cordova-plugin-device-motion']).toBeUndefined();
             expect(pkgJson.dependencies[pluginId]).toBeUndefined();
             expect(pkgJson.dependencies['cordova-plugin-device-motion']).toBeUndefined();
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     }, TIMEOUT);
     // Test #023 : if pkg.json and config.xml have no platforms/plugins/spec.
     // and --save --fetch is called, use the pinned version or plugin pkg.json version.
-    it('Test#023 : use pinned/lastest version if there is no platform/plugin version passed in and no platform/plugin versions in pkg.json or config.xml', function(done) {
+    it('Test#023 : use pinned/lastest version if there is no platform/plugin version passed in and no platform/plugin versions in pkg.json or config.xml', function (done) {
         var iosPlatform = 'ios';
         var iosVersion;
         var cwd = process.cwd();
         var iosDirectory = path.join(cwd, 'platforms/ios/cordova/version');
         var iosJsonPath = path.join(cwd, 'platforms/ios/ios.json');
         var configXmlPath = path.join(cwd, 'config.xml');
-        var pkgJsonPath = path.join(cwd,'package.json');
+        var pkgJsonPath = path.join(cwd, 'package.json');
         var pkgJson = cordova_util.requireNoCache(pkgJsonPath);
         var cfg = new ConfigParser(configXmlPath);
         var engines = cfg.getEngines();
@@ -249,8 +249,8 @@ describe('plugin end-to-end', function() {
         // Config.xml has no platform or plugin or specs.
         expect(engines.length).toEqual(0);
         // Add ios without version.
-        return cordova.platform('add', ['ios'], {'save':true, 'fetch':true})
-        .then(function() {
+        return cordova.platform('add', ['ios'], {'save': true, 'fetch': true})
+        .then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Pkg.json has ios.
@@ -261,20 +261,20 @@ describe('plugin end-to-end', function() {
             // ios platform has been added to config.xml.
             expect(engines.length).toEqual(1);
             // Config.xml has ios platform.
-            engNames = engines.map(function(elem) {
+            engNames = engines.map(function (elem) {
                 return elem.name;
             });
             expect(engNames).toEqual([ 'ios' ]);
             // delete previous caches of iosVersion;
             iosVersion = cordova_util.requireNoCache(iosDirectory);
-            engSpec = engines.map(function(elem) {
+            engSpec = engines.map(function (elem) {
                 // Check that config and ios/cordova/version versions "satify" each other.
                 expect(semver.satisfies(iosVersion.version, elem.spec)).toEqual(true);
             });
-        }).then(function() {
+        }).then(function () {
             // Add geolocation plugin with --save --fetch.
-            return cordova.plugin('add', 'cordova-plugin-geolocation', {'save':true, 'fetch':true});
-        }).then(function() {
+            return cordova.plugin('add', 'cordova-plugin-geolocation', {'save': true, 'fetch': true});
+        }).then(function () {
             var iosJson = cordova_util.requireNoCache(iosJsonPath);
             expect(iosJson.installed_plugins['cordova-plugin-geolocation']).toBeDefined();
             var cfg3 = new ConfigParser(configXmlPath);
@@ -289,19 +289,19 @@ describe('plugin end-to-end', function() {
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Check that pkg.json and plugin pkg.json versions "satisfy".
             expect(semver.satisfies(pluginPkgJsonVersion.version, pkgJson.dependencies['cordova-ios']));
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },60000);
-    
+    }, 60000);
+
     // Test#025: has a pkg.json. Checks if local path is added to pkg.json for platform and plugin add.
     it('Test#025 : if you add a platform/plugin with local path, pkg.json gets updated', function (done) {
 
         var cwd = process.cwd();
-        var platformPath = path.join(testRunRoot,'spec', 'cordova/fixtures/platforms/cordova-browser');
-        var pluginPath = path.join(testRunRoot,'spec', 'cordova/fixtures/plugins/cordova-lib-test-plugin');
-        var pkgJsonPath = path.join(cwd,'package.json');
+        var platformPath = path.join(testRunRoot, 'spec', 'cordova/fixtures/platforms/cordova-browser');
+        var pluginPath = path.join(testRunRoot, 'spec', 'cordova/fixtures/plugins/cordova-lib-test-plugin');
+        var pkgJsonPath = path.join(cwd, 'package.json');
         var pkgJson;
         var configXmlPath = path.join(cwd, 'config.xml');
         var cfg = new ConfigParser(configXmlPath);
@@ -311,8 +311,8 @@ describe('plugin end-to-end', function() {
 
         cordova_util.requireNoCache(pkgJsonPath);
         // Run cordova platform add local path --save --fetch.
-        return cordova.platform('add', platformPath, {'save':true, 'fetch':true})
-        .then(function() {
+        return cordova.platform('add', platformPath, {'save': true, 'fetch': true})
+        .then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Pkg.json has browser.
@@ -324,19 +324,19 @@ describe('plugin end-to-end', function() {
             var cfg2 = new ConfigParser(configXmlPath);
             engines = cfg2.getEngines();
             // browser platform and spec have been added to config.xml.
-            engNames = engines.map(function(elem) {
+            engNames = engines.map(function (elem) {
                 return elem.name;
             });
-            engSpec = engines.map(function(elem) {  
+            engSpec = engines.map(function (elem) {
                 if (elem.name === 'browser') {
-                    var result = includeFunc(elem.spec , platformPath);
+                    var result = includeFunc(elem.spec, platformPath);
                     expect(result).toEqual(true);
                 }
             });
-        }).then(function() {
+        }).then(function () {
             // Run cordova plugin add local path --save --fetch.
-            return cordova.plugin('add', pluginPath, {'save':true, 'fetch':true});
-        }).then(function() {
+            return cordova.plugin('add', pluginPath, {'save': true, 'fetch': true});
+        }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Pkg.json has geolocation plugin.
@@ -348,19 +348,19 @@ describe('plugin end-to-end', function() {
             var cfg3 = new ConfigParser(configXmlPath);
             engines = cfg3.getEngines();
             // Check that browser and spec have been added to config.xml
-            engNames = engines.map(function(elem) {
+            engNames = engines.map(function (elem) {
                 return elem.name;
             });
-            engSpec = engines.map(function(elem) {  
+            engSpec = engines.map(function (elem) {
                 if (elem.name === 'browser') {
-                    var result = includeFunc(elem.spec , platformPath);
+                    var result = includeFunc(elem.spec, platformPath);
                     expect(result).toEqual(true);
                 }
             });
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
-    },60000);
+    }, 60000);
 });
 
 // This group of tests checks if platforms are added and removed as expected from package.json.
@@ -369,7 +369,7 @@ describe('platform end-to-end with --save', function () {
     var project = path.join(tmpDir, 'project');
     var results;
 
-    beforeEach(function() {
+    beforeEach(function () {
         shell.rm('-rf', tmpDir);
 
         // cp then mv because we need to copy everything, but that means it'll copy the whole directory.
@@ -377,137 +377,137 @@ describe('platform end-to-end with --save', function () {
         shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson'), tmpDir);
         shell.mv(path.join(tmpDir, 'basePkgJson'), project);
         process.chdir(project);
-        events.on('results', function(res) { results = res; });
+        events.on('results', function (res) { results = res; });
     });
 
-    afterEach(function() {
+    afterEach(function () {
         // Delete any previous caches of require(package.json).
-        cordova_util.requireNoCache(path.join(process.cwd(),'package.json'));
+        cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordova.platform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
+    function emptyPlatformList () {
+        return cordova.platform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
             expect(installed).toBeDefined();
             expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
         });
     }
-    function fullPlatformList() {
-        return cordova.platform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
+    function fullPlatformList () {
+        return cordova.platform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
             expect(installed).toBeDefined();
             expect(installed[1].indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
         });
     }
 
-    it('Test#006 : platform is added and removed correctly with --save', function(done) {
-        var pkgJsonPath = path.join(process.cwd(),'package.json');
+    it('Test#006 : platform is added and removed correctly with --save', function (done) {
+        var pkgJsonPath = path.join(process.cwd(), 'package.json');
         expect(pkgJsonPath).toExist();
         var pkgJson;
 
         // Check there are no platforms yet.
-        emptyPlatformList().then(function() {
+        emptyPlatformList().then(function () {
             // Add the testing platform with --save.
-            return cordova.platform('add', [helpers.testPlatform], {'save':true});
-        }).then(function() {
+            return cordova.platform('add', [helpers.testPlatform], {'save': true});
+        }).then(function () {
             // Check the platform add was successful.
             pkgJson = require(pkgJsonPath);
             expect(pkgJson.cordova.platforms).not.toBeUndefined();
             expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(0);
         }).then(fullPlatformList) // Platform should still be in platform ls.
-        .then(function() {
+        .then(function () {
             // And now remove it with --save.
-            return cordova.platform('rm', [helpers.testPlatform], {'save':true});
-        }).then(function() {
+            return cordova.platform('rm', [helpers.testPlatform], {'save': true});
+        }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Checking that the platform removed is in not in the platforms key.
             expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(-1);
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     }, TIMEOUT);
 
-    it('Test#007 : should not remove platforms from package.json when removing without --save', function(done) {
-        var pkgJsonPath = path.join(process.cwd(),'package.json');
+    it('Test#007 : should not remove platforms from package.json when removing without --save', function (done) {
+        var pkgJsonPath = path.join(process.cwd(), 'package.json');
         expect(pkgJsonPath).toExist();
         var pkgJson = cordova_util.requireNoCache(pkgJsonPath);
 
-        emptyPlatformList().then(function() {
+        emptyPlatformList().then(function () {
             // Add the testing platform with --save.
-            return cordova.platform('add', [helpers.testPlatform], {'save':true});
-        }).then(function() {
+            return cordova.platform('add', [helpers.testPlatform], {'save': true});
+        }).then(function () {
             // Check the platform add was successful.
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             expect(pkgJson.cordova.platforms).not.toBeUndefined();
             expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
         }).then(fullPlatformList) // Platform should still be in platform ls.
-        .then(function() {
+        .then(function () {
             // And now remove it without --save.
             return cordova.platform('rm', [helpers.testPlatform]);
-        }).then(function() {
+        }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Check that the platform removed without --save is still in platforms key.
             expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
         }).then(emptyPlatformList)
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     }, TIMEOUT);
 
-    it('Test#008 : should not add platform to package.json when adding without --save', function(done) {
-        var pkgJsonPath = path.join(process.cwd(),'package.json');
+    it('Test#008 : should not add platform to package.json when adding without --save', function (done) {
+        var pkgJsonPath = path.join(process.cwd(), 'package.json');
         expect(pkgJsonPath).toExist();
         // Delete any previous caches of require(package.json).
         var pkgJson = cordova_util.requireNoCache(pkgJsonPath);
         // Pkg.json "platforms" should be empty and helpers.testPlatform should not exist in pkg.json.
         expect(pkgJson.cordova).toBeUndefined();
         // Add platform without --save.
-        cordova.platform('add',[helpers.testPlatform])
-        .then(function() {
+        cordova.platform('add', [helpers.testPlatform])
+        .then(function () {
             // Check the platform add was successful, reload, skipping cache.
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // PkgJson.cordova should not be defined and helpers.testPlatform should NOT have been added.
             expect(pkgJson.cordova).toBeUndefined();
         }).then(fullPlatformList)
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, TIMEOUT);
 
-    it('Test#009 : should only add the platform to package.json with --save', function(done) {
-        var pkgJsonPath = path.join(process.cwd(),'package.json');
+    it('Test#009 : should only add the platform to package.json with --save', function (done) {
+        var pkgJsonPath = path.join(process.cwd(), 'package.json');
         var pkgJson;
         var platformNotToAdd = 'browser';
         expect(pkgJsonPath).toExist();
 
         // Add a platform without --save.
-        cordova.platform('add',platformNotToAdd)
-        .then(function() {
+        cordova.platform('add', platformNotToAdd)
+        .then(function () {
             // And now add another platform with --save.
-            return cordova.platform('add', [helpers.testPlatform], {'save':true});
-        }).then(function() {
+            return cordova.platform('add', [helpers.testPlatform], {'save': true});
+        }).then(function () {
             // Check the platform add was successful, reload, skipping cache.
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Beware empty/missing cordova object.
-            var pkgJsonCordova = pkgJson.cordova || {platforms:[]};
+            var pkgJsonCordova = pkgJson.cordova || {platforms: []};
             // Check that only the platform added with --save was added to package.json.
             expect(pkgJsonCordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
             expect(pkgJsonCordova.platforms.indexOf(platformNotToAdd)).toEqual(-1);
         })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, TIMEOUT);
 
-    it('Test#010 : two platforms are added and removed correctly with --save --fetch', function(done) {
-        var pkgJsonPath = path.join(process.cwd(),'package.json');
+    it('Test#010 : two platforms are added and removed correctly with --save --fetch', function (done) {
+        var pkgJsonPath = path.join(process.cwd(), 'package.json');
         expect(pkgJsonPath).toExist();
         var pkgJson;
         // Delete any previous caches of require(package.json).
@@ -516,7 +516,7 @@ describe('platform end-to-end with --save', function () {
         var configXmlPath = path.join(cwd, 'config.xml');
         var cfg = new ConfigParser(configXmlPath);
         var engines = cfg.getEngines();
-        var engNames = engines.map(function(elem) {
+        var engNames = engines.map(function (elem) {
             return elem.name;
         });
         var configEngArray = engNames.slice();
@@ -525,10 +525,10 @@ describe('platform end-to-end with --save', function () {
         expect(pkgJson.cordova).toBeUndefined();
         expect(configEngArray.length === 0);
         // Check there are no platforms yet.
-        emptyPlatformList().then(function() {
+        emptyPlatformList().then(function () {
             // Add the testing platform with --save and add specific version to android platform.
-            return cordova.platform('add', ['android@6.1.0', 'browser@4.1.0'], {'save':true, 'fetch':true});
-        }).then(function() {
+            return cordova.platform('add', ['android@6.1.0', 'browser@4.1.0'], {'save': true, 'fetch': true});
+        }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Check the platform add was successful in platforms list and in dependencies.
@@ -543,7 +543,7 @@ describe('platform end-to-end with --save', function () {
 
             var cfg3 = new ConfigParser(configXmlPath);
             engines = cfg3.getEngines();
-            engNames = engines.map(function(elem) {
+            engNames = engines.map(function (elem) {
                 return elem.name;
             });
             configEngArray = engNames.slice();
@@ -552,10 +552,10 @@ describe('platform end-to-end with --save', function () {
             expect(engines).toEqual([ { name: 'android', spec: '~6.1.0' }, { name: 'browser', spec: '~4.1.0' } ]);
 
         }).then(fullPlatformList) // Platform should still be in platform ls.
-        .then(function() {
+        .then(function () {
             // And now remove it with --save.
-            return cordova.platform('rm', ['android', 'browser'], {'save':true, 'fetch':true});
-        }).then(function() {
+            return cordova.platform('rm', ['android', 'browser'], {'save': true, 'fetch': true});
+        }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Checking that the platform removed is in not in the platforms key.
@@ -567,14 +567,14 @@ describe('platform end-to-end with --save', function () {
             // Platforms are removed from config.xml.
             var cfg4 = new ConfigParser(configXmlPath);
             engines = cfg4.getEngines();
-            engNames = engines.map(function(elem) {
+            engNames = engines.map(function (elem) {
                 return elem.name;
             });
             configEngArray = engNames.slice();
             // Platforms are removed from config.xml.
             expect(configEngArray.length === 0);
         }).then(emptyPlatformList) // platform ls should be empty too.
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     }, TIMEOUT);
@@ -586,7 +586,7 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
     var project = path.join(tmpDir, 'project');
     var results;
 
-    beforeEach(function() {
+    beforeEach(function () {
         shell.rm('-rf', tmpDir);
 
         // cp then mv because we need to copy everything, but that means it'll copy the whole directory.
@@ -594,20 +594,20 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
         shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson15'), tmpDir);
         shell.mv(path.join(tmpDir, 'basePkgJson15'), project);
         process.chdir(project);
-        events.on('results', function(res) { results = res; });
+        events.on('results', function (res) { results = res; });
     });
 
-    afterEach(function() {
+    afterEach(function () {
         // Delete any previous caches of require(package.json).
-        cordova_util.requireNoCache(path.join(process.cwd(),'package.json'));
+        cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordova.platform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
+    function emptyPlatformList () {
+        return cordova.platform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
             expect(installed).toBeDefined();
             expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
         });
@@ -616,14 +616,14 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
     /** Test#020 will check that pkg.json, config.xml, platforms.json, and cordova platform ls
     *   are updated with the correct (platform and plugin) specs from pkg.json.
     */
-    it('Test#020 : During add, if pkg.json has a spec, use that one.', function(done) {
+    it('Test#020 : During add, if pkg.json has a spec, use that one.', function (done) {
         var iosPlatform = 'ios';
         var iosVersion;
         var cwd = process.cwd();
         var iosDirectory = path.join(cwd, 'platforms/ios/cordova/version');
-        var platformsFolderPath = path.join(cwd,'platforms/platforms.json');
+        var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
         var configXmlPath = path.join(cwd, 'config.xml');
-        var pkgJsonPath = path.join(cwd,'package.json');
+        var pkgJsonPath = path.join(cwd, 'package.json');
         var pkgJson = cordova_util.requireNoCache(pkgJsonPath);
         var cfg = new ConfigParser(configXmlPath);
         var engines = cfg.getEngines();
@@ -636,15 +636,15 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
 
         // Pkg.json has ios and spec '^4.2.1' and splashscreen '^3.2.2'.
         expect(pkgJson.cordova.platforms).toEqual([ iosPlatform ]);
-        expect(pkgJson.dependencies).toEqual({ 'cordova-plugin-splashscreen' : '^3.2.2', 'cordova-ios' : '^4.2.1' });
+        expect(pkgJson.dependencies).toEqual({ 'cordova-plugin-splashscreen': '^3.2.2', 'cordova-ios': '^4.2.1' });
         // Config.xml has no platforms or plugins yet.
         expect(engines.length).toEqual(0);
         expect(configPlugins.length).toEqual(0);
 
-        emptyPlatformList().then(function() {
+        emptyPlatformList().then(function () {
             // Add ios with --save and --fetch.
-            return cordova.platform('add', [iosPlatform], {'save':true , 'fetch':true});
-        }).then(function() {
+            return cordova.platform('add', [iosPlatform], {'save': true, 'fetch': true});
+        }).then(function () {
             // Require platformsFolderPath, ios and spec should be in there.
             platformsJson = cordova_util.requireNoCache(platformsFolderPath);
             // Delete any previous caches of require(package.json).
@@ -657,12 +657,12 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
             engines = cfg2.getEngines();
             // ios platform has been added to config.xml.
             expect(engines.length).toEqual(1);
-            engNames = engines.map(function(elem) {
+            engNames = engines.map(function (elem) {
                 // ios is added to config
                 expect(elem.name).toEqual(iosPlatform);
                 return elem.name;
             });
-            engSpec = engines.map(function(elem) {
+            engSpec = engines.map(function (elem) {
                 // Check that config and ios/cordova/version versions "satify" each other.
                 iosVersion = cordova_util.requireNoCache(iosDirectory);
                 expect(semver.satisfies(iosVersion.version, elem.spec)).toEqual(true);
@@ -675,19 +675,19 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
             expect(semver.satisfies(iosVersion.version, pkgJson.dependencies['cordova-ios'])).toEqual(true);
             // Check that pkg.json and platforms.json "satisfy".
             expect(semver.satisfies(platformsJson[iosPlatform], pkgJson.dependencies['cordova-ios'])).toEqual(true);
-        }).then(function() {
+        }).then(function () {
             // Add splashscreen plugin with --save --fetch.
-            return cordova.plugin('add', 'cordova-plugin-splashscreen', {'save':true, 'fetch':true});
-        }).then(function() {
+            return cordova.plugin('add', 'cordova-plugin-splashscreen', {'save': true, 'fetch': true});
+        }).then(function () {
             pluginPkgJsonVersion = cordova_util.requireNoCache(pluginPkgJsonDir);
             // Check that pkg.json version and plugin pkg.json version "satisfy" each other.
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             expect(semver.satisfies(pluginPkgJsonVersion.version, pkgJson.dependencies['cordova-plugin-splashscreen'])).toEqual(true);
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },60000); 
+    }, 60000);
 });
 
 // Test #021 : use basePkgJson16 as config.xml contains platform/spec and plugin/spec pkg.json does not.
@@ -696,7 +696,7 @@ describe('During add, if config.xml has a platform/plugin spec and pkg.json does
     var project = path.join(tmpDir, 'project');
     var results;
 
-    beforeEach(function() {
+    beforeEach(function () {
         shell.rm('-rf', tmpDir);
 
         // cp then mv because we need to copy everything, but that means it'll copy the whole directory.
@@ -704,34 +704,34 @@ describe('During add, if config.xml has a platform/plugin spec and pkg.json does
         shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson16'), tmpDir);
         shell.mv(path.join(tmpDir, 'basePkgJson16'), project);
         process.chdir(project);
-        events.on('results', function(res) { results = res; });
+        events.on('results', function (res) { results = res; });
     });
 
-    afterEach(function() {
+    afterEach(function () {
         // Delete any previous caches of require(package.json).
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordova.platform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
+    function emptyPlatformList () {
+        return cordova.platform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
             expect(installed).toBeDefined();
             expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
         });
     }
 
-    /** Test#021 during add, this test will check that pkg.json, config.xml, platforms.json, 
+    /** Test#021 during add, this test will check that pkg.json, config.xml, platforms.json,
     *   and cordova platform ls are updated with the correct platform/plugin spec from config.xml.
     */
-    it('Test#021 : If config.xml has a spec (and none was specified and pkg.json does not have one), use config.', function(done) {
+    it('Test#021 : If config.xml has a spec (and none was specified and pkg.json does not have one), use config.', function (done) {
         var iosPlatform = 'ios';
         var iosVersion;
         var cwd = process.cwd();
         var iosDirectory = path.join(cwd, 'platforms/ios/cordova/version');
         var configXmlPath = path.join(cwd, 'config.xml');
-        var pkgJsonPath = path.join(cwd,'package.json');
+        var pkgJsonPath = path.join(cwd, 'package.json');
         var cfg = new ConfigParser(configXmlPath);
         var pkgJson;
         var engines = cfg.getEngines();
@@ -744,11 +744,11 @@ describe('During add, if config.xml has a platform/plugin spec and pkg.json does
 
         // Pkg.json does not have platform or spec yet. Config.xml has ios and spec '~4.2.1'.
         // Remove for testing purposes so platform is not pre-installed.
-        cordova.platform('rm', [iosPlatform], {'save':true});
-        emptyPlatformList().then(function() {
+        cordova.platform('rm', [iosPlatform], {'save': true});
+        emptyPlatformList().then(function () {
             // Add ios with --save and --fetch.
-            return cordova.platform('add', [iosPlatform], {'save':true , 'fetch':true});
-        }).then(function() {
+            return cordova.platform('add', [iosPlatform], {'save': true, 'fetch': true});
+        }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // pkg.json has new platform.
@@ -758,20 +758,20 @@ describe('During add, if config.xml has a platform/plugin spec and pkg.json does
             engines = cfg2.getEngines();
             // ios platform is in config.xml.
             expect(engines.length).toEqual(1);
-            engNames = engines.map(function(elem) {
+            engNames = engines.map(function (elem) {
                 return elem.name;
             });
             // Config.xml has ios platform.
             expect(engNames).toEqual([ 'ios' ]);
-            engSpec = engines.map(function(elem) {
+            engSpec = engines.map(function (elem) {
                 iosVersion = cordova_util.requireNoCache(iosDirectory);
                 // Config and ios/cordova/version versions "satisfy" each other.
                 expect(semver.satisfies(iosVersion.version, elem.spec)).toEqual(true);
             });
-        }).then(function() {
+        }).then(function () {
             // Add splashscreen with --save --fetch.
-            return cordova.plugin('add', 'cordova-plugin-splashscreen', {'save':true, 'fetch':true});
-        }).then(function() {
+            return cordova.plugin('add', 'cordova-plugin-splashscreen', {'save': true, 'fetch': true});
+        }).then(function () {
             var cfg3 = new ConfigParser(configXmlPath);
             // Check config.xml for plugins and spec.
             configPlugins = cfg3.getPluginIdList();
@@ -782,11 +782,11 @@ describe('During add, if config.xml has a platform/plugin spec and pkg.json does
             pluginPkgJsonVersion = cordova_util.requireNoCache(pluginPkgJsonDir);
             // Check that version in plugin pkg.json and config version "satisfy" each other.
             expect(semver.satisfies(pluginPkgJsonVersion.version, configPlugin.spec)).toEqual(true);
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },60000); 
+    }, 60000);
 });
 
 // Test #022 : use basePkgJson17 (config.xml and pkg.json each have ios platform with different specs).
@@ -795,27 +795,27 @@ describe('During add, if add specifies a platform spec, use that one regardless
     var project = path.join(tmpDir, 'project');
     var results;
 
-    beforeEach(function() {
+    beforeEach(function () {
         shell.rm('-rf', tmpDir);
         // cp then mv because we need to copy everything, but that means it'll copy the whole directory.
         // Using /* doesn't work because of hidden files.
         shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson17'), tmpDir);
         shell.mv(path.join(tmpDir, 'basePkgJson17'), project);
         process.chdir(project);
-        events.on('results', function(res) { results = res; });
+        events.on('results', function (res) { results = res; });
     });
 
-    afterEach(function() {
+    afterEach(function () {
         // Delete any previous caches of require(package.json).
-        cordova_util.requireNoCache(path.join(process.cwd(),'package.json'));
+        cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordova.platform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
+    function emptyPlatformList () {
+        return cordova.platform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
             expect(installed).toBeDefined();
             expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
         });
@@ -824,13 +824,13 @@ describe('During add, if add specifies a platform spec, use that one regardless
     /** Test#022 : when adding with a specific platform version, always use that one
     *   regardless of what is in package.json or config.xml.
     */
-    it('Test#022 : when adding with a specific platform version, always use that one.', function(done) {
+    it('Test#022 : when adding with a specific platform version, always use that one.', function (done) {
         var iosPlatform = 'ios';
         var iosVersion;
         var cwd = process.cwd();
         var iosDirectory = path.join(cwd, 'platforms/ios/cordova/version');
         var configXmlPath = path.join(cwd, 'config.xml');
-        var pkgJsonPath = path.join(cwd,'package.json');
+        var pkgJsonPath = path.join(cwd, 'package.json');
         var pkgJson = cordova_util.requireNoCache(pkgJsonPath);
         var cfg = new ConfigParser(configXmlPath);
         var engines = cfg.getEngines();
@@ -842,14 +842,14 @@ describe('During add, if add specifies a platform spec, use that one regardless
 
         // Pkg.json has ios and spec '^4.2.1'.
         expect(pkgJson.cordova.platforms).toEqual([ iosPlatform ]);
-        expect(pkgJson.dependencies).toEqual({ 'cordova-ios' : '^4.2.1', 'cordova-plugin-splashscreen' : '~3.2.2' });
+        expect(pkgJson.dependencies).toEqual({ 'cordova-ios': '^4.2.1', 'cordova-plugin-splashscreen': '~3.2.2' });
         // Config.xml has ios and spec ~4.2.1.
         expect(engines.length).toEqual(1);
         expect(engines).toEqual([ { name: 'ios', spec: '~4.2.1' } ]);
-        emptyPlatformList().then(function() {
+        emptyPlatformList().then(function () {
             // Add ios with --save and --fetch.
-            return cordova.platform('add', ['ios@4.3.0'], {'save':true , 'fetch':true});
-        }).then(function() {
+            return cordova.platform('add', ['ios@4.3.0'], {'save': true, 'fetch': true});
+        }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Pkg.json has ios.
@@ -859,7 +859,7 @@ describe('During add, if add specifies a platform spec, use that one regardless
             engines = cfg2.getEngines();
             // ios platform has been added to config.xml.
             expect(engines.length).toEqual(1);
-            engNames = engines.map(function(elem) {
+            engNames = engines.map(function (elem) {
                 return elem.name;
             });
             // Config.xml has ios platform.
@@ -868,10 +868,10 @@ describe('During add, if add specifies a platform spec, use that one regardless
             iosVersion = cordova_util.requireNoCache(iosDirectory);
             // Check that pkg.json and ios/cordova/version versions "satisfy" each other.
             expect(semver.satisfies(iosVersion.version, pkgJson.dependencies['cordova-ios'])).toEqual(true);
-        }).then(function() {
+        }).then(function () {
             // Add splashscreen with --save --fetch.
-            return cordova.plugin('add', 'cordova-plugin-splashscreen@4.0.0', {'save':true, 'fetch':true});
-        }).then(function() {
+            return cordova.plugin('add', 'cordova-plugin-splashscreen@4.0.0', {'save': true, 'fetch': true});
+        }).then(function () {
             var cfg3 = new ConfigParser(configXmlPath);
             // Check config.xml for plugins and spec.
             configPlugins = cfg3.getPluginIdList();
@@ -885,11 +885,11 @@ describe('During add, if add specifies a platform spec, use that one regardless
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Check that pkg.json and plugin pkg.json versions "satisfy".
             expect(semver.satisfies(pluginPkgJsonVersion.version, pkgJson.dependencies['cordova-ios']));
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-    },60000); 
+    }, 60000);
 });
 
 // No pkg.json included in test file.
@@ -899,8 +899,7 @@ describe('local path is added to config.xml without pkg.json', function () {
     var results;
     var testRunRoot = process.cwd();
 
-
-    beforeEach(function() {
+    beforeEach(function () {
         shell.rm('-rf', tmpDir);
 
         // cp then mv because we need to copy everything, but that means it'll copy the whole directory.
@@ -908,10 +907,10 @@ describe('local path is added to config.xml without pkg.json', function () {
         shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson13'), tmpDir);
         shell.mv(path.join(tmpDir, 'basePkgJson13'), project);
         process.chdir(project);
-        events.on('results', function(res) { results = res; });
+        events.on('results', function (res) { results = res; });
     });
 
-    afterEach(function() {
+    afterEach(function () {
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
@@ -924,39 +923,39 @@ describe('local path is added to config.xml without pkg.json', function () {
         var engines = cfg.getEngines();
         var engNames;
         var engSpec;
-        var platformPath = path.join(testRunRoot,'spec', 'cordova/fixtures/platforms/cordova-browser');
+        var platformPath = path.join(testRunRoot, 'spec', 'cordova/fixtures/platforms/cordova-browser');
 
         // Run cordova platform add local path --save --fetch.
-        return cordova.platform('add', platformPath, {'save':true, 'fetch':true})
-        .then(function() {
+        return cordova.platform('add', platformPath, {'save': true, 'fetch': true})
+        .then(function () {
             var cfg2 = new ConfigParser(configXmlPath);
             engines = cfg2.getEngines();
             // ios platform and spec have been added to config.xml.
-            engNames = engines.map(function(elem) {
+            engNames = engines.map(function (elem) {
                 return elem.name;
             });
-            engSpec = engines.map(function(elem) {  
+            engSpec = engines.map(function (elem) {
                 if (elem.name === 'browser') {
-                    var result = includeFunc(elem.spec , platformPath);
+                    var result = includeFunc(elem.spec, platformPath);
                     expect(result).toEqual(true);
                 }
             });
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
-    },60000);
+    }, 60000);
 
     // Test#027: has NO pkg.json. Checks if local path is added to config.xml and has no errors.
     it('Test#027 : if you add a plugin with local path, config.xml gets updated', function (done) {
         var cwd = process.cwd();
-        var pluginPath = path.join(testRunRoot,'spec', 'cordova/fixtures/plugins/cordova-lib-test-plugin');
+        var pluginPath = path.join(testRunRoot, 'spec', 'cordova/fixtures/plugins/cordova-lib-test-plugin');
         var configXmlPath = path.join(cwd, 'config.xml');
         var cfg = new ConfigParser(configXmlPath);
         var configPlugins = cfg.getPluginIdList();
         var configPlugin = cfg.getPlugin(configPlugins);
         // Run platform add with local path.
-        return cordova.plugin('add', pluginPath, {'save':true, 'fetch':true})
-        .then(function() {
+        return cordova.plugin('add', pluginPath, {'save': true, 'fetch': true})
+        .then(function () {
             var cfg2 = new ConfigParser(configXmlPath);
             // Check config.xml for plugins and spec.
             configPlugins = cfg2.getPluginIdList();
@@ -964,10 +963,10 @@ describe('local path is added to config.xml without pkg.json', function () {
             // Plugin is added.
             expect(configPlugin.name).toEqual('cordova-lib-test-plugin');
             // Spec for geolocation plugin is added.
-            var result = includeFunc(configPlugin.spec , pluginPath);
+            var result = includeFunc(configPlugin.spec, pluginPath);
             expect(result).toEqual(true);
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
-    },60000);
+    }, 60000);
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/integration-tests/platform.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/platform.spec.js b/integration-tests/platform.spec.js
index 78164ee..dd6d2b7 100644
--- a/integration-tests/platform.spec.js
+++ b/integration-tests/platform.spec.js
@@ -41,7 +41,7 @@ describe('platform end-to-end', function () {
 
     var results;
 
-    beforeEach(function() {
+    beforeEach(function () {
         shell.rm('-rf', tmpDir);
 
         // cp then mv because we need to copy everything, but that means it'll copy the whole directory.
@@ -58,37 +58,37 @@ describe('platform end-to-end', function () {
 
         // The config.json in the fixture project points at fake "local" paths.
         // Since it's not a URL, the lazy-loader will just return the junk path.
-        spyOn(superspawn, 'spawn').and.callFake(function(cmd, args) {
+        spyOn(superspawn, 'spawn').and.callFake(function (cmd, args) {
             if (cmd.match(/create\b/)) {
                 // This is a call to the bin/create script, so do the copy ourselves.
                 shell.cp('-R', path.join(fixturesDir, 'platforms', 'android'), path.join(project, 'platforms'));
-            } else if(cmd.match(/version\b/)) {
+            } else if (cmd.match(/version\b/)) {
                 return Q('3.3.0');
-            } else if(cmd.match(/update\b/)) {
+            } else if (cmd.match(/update\b/)) {
                 fs.writeFileSync(path.join(project, 'platforms', helpers.testPlatform, 'updated'), 'I was updated!', 'utf-8');
             }
             return Q();
         });
 
-        events.on('results', function(res) { results = res; });
+        events.on('results', function (res) { results = res; });
     });
 
-    afterEach(function() {
+    afterEach(function () {
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
     // Factoring out some repeated checks.
-    function emptyPlatformList() {
-        return cordova.platform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
+    function emptyPlatformList () {
+        return cordova.platform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
             expect(installed).toBeDefined();
             expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
         });
     }
-    function fullPlatformList() {
-        return cordova.platform('list').then(function() {
-            var installed = results.match(/Installed platforms:\n  (.*)/);
+    function fullPlatformList () {
+        return cordova.platform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
             expect(installed).toBeDefined();
             expect(installed[1].indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
         });
@@ -101,67 +101,67 @@ describe('platform end-to-end', function () {
     //
     // This test was designed to use a older version of android before API.js
     // It is not valid anymore.
-    xit('Test 001 : should successfully run', function(done) {
+    xit('Test 001 : should successfully run', function (done) {
 
         // Check there are no platforms yet.
-        emptyPlatformList().then(function() {
+        emptyPlatformList().then(function () {
             // Add the testing platform.
             return cordova.platform('add', [helpers.testPlatform]);
-        }).then(function() {
+        }).then(function () {
             // Check the platform add was successful.
             expect(path.join(project, 'platforms', helpers.testPlatform)).toExist();
             expect(path.join(project, 'platforms', helpers.testPlatform, 'cordova')).toExist();
         }).then(fullPlatformList) // Check for it in platform ls.
-        .then(function() {
+        .then(function () {
             // Try to update the platform.
             return cordova.platform('update', [helpers.testPlatform]);
-        }).then(function() {
+        }).then(function () {
             // Our fake update script in the exec mock above creates this dummy file.
             expect(path.join(project, 'platforms', helpers.testPlatform, 'updated')).toExist();
         }).then(fullPlatformList) // Platform should still be in platform ls.
-        .then(function() {
+        .then(function () {
             // And now remove it.
             return cordova.platform('rm', [helpers.testPlatform]);
-        }).then(function() {
+        }).then(function () {
             // It should be gone.
             expect(path.join(project, 'platforms', helpers.testPlatform)).not.toExist();
         }).then(emptyPlatformList) // platform ls should be empty too.
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     });
 
-    it('Test 002 : should install plugins correctly while adding platform', function(done) {
+    it('Test 002 : should install plugins correctly while adding platform', function (done) {
 
         cordova.plugin('add', path.join(pluginsDir, 'test'))
-        .then(function() {
+        .then(function () {
             return cordova.platform('add', [helpers.testPlatform]);
         })
-        .then(function() {
+        .then(function () {
             // Check the platform add was successful.
             expect(path.join(project, 'platforms', helpers.testPlatform)).toExist();
             // Check that plugin files exists in www dir
             expect(path.join(project, 'platforms', helpers.testPlatform, 'assets/www/test.js')).toExist();
         })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
-    },60000);
+    }, 60000);
 
-   xit('Test 003 : should call prepare after plugins were installed into platform', function(done) {
+    xit('Test 003 : should call prepare after plugins were installed into platform', function (done) {
         var order = '';
         var fail = jasmine.createSpy(fail);
-        spyOn(plugman, 'install').and.callFake(function() { order += 'I'; });
-        //below line won't work since prepare is inline require in addHelper, not global
-        var x = addHelper.__set__('prepare', function() { order += 'P'; });
-        //spyOn(prepare).and.callFake(function() { console.log('prepare'); order += 'P'; });
+        spyOn(plugman, 'install').and.callFake(function () { order += 'I'; });
+        // below line won't work since prepare is inline require in addHelper, not global
+        var x = addHelper.__set__('prepare', function () { order += 'P'; });
+        // spyOn(prepare).and.callFake(function() { console.log('prepare'); order += 'P'; });
         cordova.plugin('add', path.join(pluginsDir, 'test'))
-        .then(function() {
+        .then(function () {
             return platform('add', [helpers.testPlatform]);
         })
         .fail(fail)
-        .fin(function() {
+        .fin(function () {
             expect(order).toBe('IP'); // Install first, then prepare
             expect(fail).not.toHaveBeenCalled();
             done();
@@ -169,47 +169,46 @@ describe('platform end-to-end', function () {
     });
 });
 
-
 describe('platform add plugin rm end-to-end', function () {
 
     var tmpDir = helpers.tmpDir('plugin_rm_test');
     var project = path.join(tmpDir, 'hello');
     var pluginsDir = path.join(project, 'plugins');
 
-    beforeEach(function() {
+    beforeEach(function () {
         process.chdir(tmpDir);
     });
 
-    afterEach(function() {
+    afterEach(function () {
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
-    it('Test 006 : should remove dependency when removing parent plugin', function(done) {
+    it('Test 006 : should remove dependency when removing parent plugin', function (done) {
 
         cordova.create('hello')
-        .then(function() {
+        .then(function () {
             process.chdir(project);
             return cordova.platform('add', 'browser@latest');
         })
-        .then(function() {
+        .then(function () {
             return cordova.plugin('add', 'cordova-plugin-media');
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
             expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
             return cordova.platform('add', 'android');
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
             expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
             return cordova.plugin('rm', 'cordova-plugin-media');
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(pluginsDir, 'cordova-plugin-media')).not.toExist();
             expect(path.join(pluginsDir, 'cordova-plugin-file')).not.toExist();
         })
-        .fail(function(err) {
+        .fail(function (err) {
             console.error(err);
             expect(err).toBeUndefined();
         })
@@ -224,44 +223,44 @@ describe('platform add and remove --fetch', function () {
     var platformsDir = path.join(project, 'platforms');
     var nodeModulesDir = path.join(project, 'node_modules');
 
-    beforeEach(function() {
+    beforeEach(function () {
         process.chdir(tmpDir);
     });
 
-    afterEach(function() {
+    afterEach(function () {
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
-    it('Test 007 : should add and remove platform from node_modules directory', function(done) {
+    it('Test 007 : should add and remove platform from node_modules directory', function (done) {
 
         cordova.create('helloFetch')
-        .then(function() {
+        .then(function () {
             process.chdir(project);
-            return cordova.platform('add', 'browser', {'fetch':true});
+            return cordova.platform('add', 'browser', {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(nodeModulesDir, 'cordova-browser')).toExist();
             expect(path.join(platformsDir, 'browser')).toExist();
-            return cordova.platform('add', 'android', {'fetch':true});
+            return cordova.platform('add', 'android', {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(nodeModulesDir, 'cordova-browser')).toExist();
             expect(path.join(platformsDir, 'android')).toExist();
-            //Tests finish before this command finishes resolving
-            //return cordova.platform('rm', 'ios', {'fetch':true});
+            // Tests finish before this command finishes resolving
+            // return cordova.platform('rm', 'ios', {'fetch':true});
         })
-        .then(function() {
-            //expect(path.join(nodeModulesDir, 'cordova-ios')).not.toExist();
-            //expect(path.join(platformsDir, 'ios')).not.toExist();
-            //Tests finish before this command finishes resolving
-            //return cordova.platform('rm', 'android', {'fetch':true});
+        .then(function () {
+            // expect(path.join(nodeModulesDir, 'cordova-ios')).not.toExist();
+            // expect(path.join(platformsDir, 'ios')).not.toExist();
+            // Tests finish before this command finishes resolving
+            // return cordova.platform('rm', 'android', {'fetch':true});
         })
-        .then(function() {
-            //expect(path.join(nodeModulesDir, 'cordova-android')).not.toExist();
-            //expect(path.join(platformsDir, 'android')).not.toExist();
+        .then(function () {
+            // expect(path.join(nodeModulesDir, 'cordova-android')).not.toExist();
+            // expect(path.join(platformsDir, 'android')).not.toExist();
         })
-        .fail(function(err) {
+        .fail(function (err) {
             console.error(err);
             expect(err).toBeUndefined();
         })
@@ -275,94 +274,93 @@ describe('plugin add and rm end-to-end --fetch', function () {
     var project = path.join(tmpDir, 'hello3');
     var pluginsDir = path.join(project, 'plugins');
 
-    beforeEach(function() {
+    beforeEach(function () {
         process.chdir(tmpDir);
     });
 
-    afterEach(function() {
+    afterEach(function () {
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
-    it('Test 008 : should remove dependency when removing parent plugin', function(done) {
+    it('Test 008 : should remove dependency when removing parent plugin', function (done) {
 
         cordova.create('hello3')
-        .then(function() {
+        .then(function () {
             process.chdir(project);
             return cordova.platform('add', 'browser', {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             return cordova.plugin('add', 'cordova-plugin-media', {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
             expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
             expect(path.join(pluginsDir, 'cordova-plugin-compat')).toExist();
             expect(path.join(project, 'node_modules', 'cordova-plugin-media')).toExist();
             expect(path.join(project, 'node_modules', 'cordova-plugin-file')).toExist();
             expect(path.join(project, 'node_modules', 'cordova-plugin-compat')).toExist();
-            return cordova.platform('add', 'android', {'fetch':true});
+            return cordova.platform('add', 'android', {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
             expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
-            return cordova.plugin('rm', 'cordova-plugin-media', {'fetch':true});
+            return cordova.plugin('rm', 'cordova-plugin-media', {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(pluginsDir, 'cordova-plugin-media')).not.toExist();
             expect(path.join(pluginsDir, 'cordova-plugin-file')).not.toExist();
             expect(path.join(pluginsDir, 'cordova-plugin-compat')).not.toExist();
-            //These don't work yet due to the tests finishing before the promise resolves.
-            //expect(path.join(project, 'node_modules', 'cordova-plugin-media')).not.toExist();
-            //expect(path.join(project, 'node_modules', 'cordova-plugin-file')).not.toExist();
-            //expect(path.join(project, 'node_modules', 'cordova-plugin-compat')).not.toExist();
+            // These don't work yet due to the tests finishing before the promise resolves.
+            // expect(path.join(project, 'node_modules', 'cordova-plugin-media')).not.toExist();
+            // expect(path.join(project, 'node_modules', 'cordova-plugin-file')).not.toExist();
+            // expect(path.join(project, 'node_modules', 'cordova-plugin-compat')).not.toExist();
         })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, 60000);
 });
 
-
 describe('non-core platform add and rm end-to-end --fetch', function () {
 
     var tmpDir = helpers.tmpDir('non-core-platform-test');
     var project = path.join(tmpDir, 'hello');
     var results;
 
-    beforeEach(function() {
+    beforeEach(function () {
         process.chdir(tmpDir);
-        events.on('results', function(res) { results = res; });
+        events.on('results', function (res) { results = res; });
     });
 
-    afterEach(function() {
+    afterEach(function () {
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
-    it('Test 009 : should add and remove 3rd party platforms', function(done) {
+    it('Test 009 : should add and remove 3rd party platforms', function (done) {
         var installed;
         cordova.create('hello')
-        .then(function() {
+        .then(function () {
             process.chdir(project);
-            //add cordova-android instead of android
+            // add cordova-android instead of android
             return cordova.platform('add', 'cordova-android', {'fetch': true});
-        }).then(function() {
-            //3rd party platform from npm
+        }).then(function () {
+            // 3rd party platform from npm
             return cordova.platform('add', 'cordova-platform-test', {'fetch': true});
-        }).then(function() {
+        }).then(function () {
             expect(path.join(project, 'platforms', 'android')).toExist();
             expect(path.join(project, 'platforms', 'cordova-platform-test')).toExist();
             return cordova.platform('ls');
         })
-        .then(function() {
-            //use regex to grab installed platforms
-            installed = results.match(/Installed platforms:\n  (.*)\n  (.*)/);
+        .then(function () {
+            // use regex to grab installed platforms
+            installed = results.match(/Installed platforms:\n {2}(.*)\n {2}(.*)/);
             expect(installed).toBeDefined();
             expect(installed[1].indexOf('android')).toBeGreaterThan(-1);
             expect(installed[2].indexOf('cordova-platform-test')).toBeGreaterThan(-1);
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/integration-tests/plugin.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/plugin.spec.js b/integration-tests/plugin.spec.js
index c08eb99..499ab6c 100644
--- a/integration-tests/plugin.spec.js
+++ b/integration-tests/plugin.spec.js
@@ -52,37 +52,37 @@ var testGitPluginId = 'cordova-plugin-device';
 var results;
 
 // Runs: list, add, list
-function addPlugin(target, id, options) {
+function addPlugin (target, id, options) {
     // Check there are no plugins yet.
-    return cordova.plugin('list').then(function() {
+    return cordova.plugin('list').then(function () {
         expect(results).toMatch(/No plugins added/gi);
-    }).then(function() {
+    }).then(function () {
         // Add a fake plugin from fixtures.
         return cordova.plugin('add', target, options);
-    }).then(function() {
+    }).then(function () {
         expect(path.join(project, 'plugins', id, 'plugin.xml')).toExist();
-    }).then(function() {
+    }).then(function () {
         return cordova.plugin('ls');
-    }).then(function() {
+    }).then(function () {
         expect(results).toContain(id);
     });
 }
 
 // Runs: remove, list
-function removePlugin(id) {
+function removePlugin (id) {
     return cordova.plugin('rm', id)
-    .then(function() {
+    .then(function () {
         // The whole dir should be gone.
         expect(path.join(project, 'plugins', id)).not.toExist();
-    }).then(function() {
+    }).then(function () {
         return cordova.plugin('ls');
-    }).then(function() {
+    }).then(function () {
         expect(results).toMatch(/No plugins added/gi);
     });
 }
 
 var errorHandler = {
-    errorCallback: function(error) {
+    errorCallback: function (error) {
         // We want the error to be printed by jasmine
         expect(error).toBeUndefined();
     }
@@ -91,8 +91,8 @@ var errorHandler = {
 // We can't call add with a searchpath or else we will conflict with other tests
 // that use a searchpath. See loadLocalPlugins() in plugman/fetch.js for details.
 // The searchpath behavior gets tested in the plugman spec
-function mockPluginFetch(id, dir) {
-    spyOn(plugman, 'fetch').and.callFake(function(target, pluginPath, fetchOptions) {
+function mockPluginFetch (id, dir) {
+    spyOn(plugman, 'fetch').and.callFake(function (target, pluginPath, fetchOptions) {
         var dest = path.join(project, 'plugins', id);
         var src = path.join(dir, 'plugin.xml');
 
@@ -102,10 +102,10 @@ function mockPluginFetch(id, dir) {
     });
 }
 
-describe('plugin end-to-end', function() {
-    events.on('results', function(res) { results = res; });
+describe('plugin end-to-end', function () {
+    events.on('results', function (res) { results = res; });
 
-    beforeEach(function() {
+    beforeEach(function () {
         shell.rm('-rf', project);
 
         // cp then mv because we need to copy everything, but that means it'll copy the whole directory.
@@ -125,27 +125,27 @@ describe('plugin end-to-end', function() {
         spyOn(errorHandler, 'errorCallback').and.callThrough();
     });
 
-    afterEach(function() {
+    afterEach(function () {
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
         expect(errorHandler.errorCallback).not.toHaveBeenCalled();
     });
 
-    it('Test 001 : should successfully add and remove a plugin with no options', function(done) {
+    it('Test 001 : should successfully add and remove a plugin with no options', function (done) {
         addPlugin(path.join(pluginsDir, 'fake1'), pluginId, {}, done)
-        .then(function() {
+        .then(function () {
             expect(install.runInstall).toHaveBeenCalled();
             expect(platforms.getPlatformApi.calls.count()).toEqual(1);
             return removePlugin(pluginId);
-        }).then(function() {
+        }).then(function () {
             expect(platforms.getPlatformApi.calls.count()).toEqual(2);
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, 30000);
 
-    it('Test 004 : should successfully add a plugin using relative path when running from subdir inside of project', function(done) {
+    it('Test 004 : should successfully add a plugin using relative path when running from subdir inside of project', function (done) {
         // Copy plugin to subdir inside of the project. This is required since path.relative
         // returns an absolute path when source and dest are on different drives
         var plugindir = path.join(project, 'custom-plugins/some-plugin-inside-subfolder');
@@ -159,110 +159,110 @@ describe('plugin end-to-end', function() {
 
         // Add plugin using relative path
         addPlugin(path.relative(subdir, plugindir), pluginId, {}, done)
-        .then(function() {
+        .then(function () {
             return removePlugin(pluginId);
         })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, 30000);
 
-    it('Test 005 : should respect preference default values', function (done) {    
-       addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED:'NO', REQUIRED_ANDROID:'NO'}}, done)
-       .then(function() {
-            var platformJsonPath = path.join(project, 'plugins', helpers.testPlatform + '.json');
-            var installed_plugins = require(platformJsonPath).installed_plugins;
-            var defaultPluginPreferences = installed_plugins[org_test_defaultvariables];
-            expect(defaultPluginPreferences).toBeDefined();
-            expect(defaultPluginPreferences.DEFAULT).toBe('yes');
-            expect(defaultPluginPreferences.DEFAULT_ANDROID).toBe('yes');
-            expect(defaultPluginPreferences.REQUIRED_ANDROID).toBe('NO');
-            expect(defaultPluginPreferences.REQUIRED).toBe('NO');
-            return removePlugin(org_test_defaultvariables);
+    it('Test 005 : should respect preference default values', function (done) {
+        addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED: 'NO', REQUIRED_ANDROID: 'NO'}}, done)
+       .then(function () {
+           var platformJsonPath = path.join(project, 'plugins', helpers.testPlatform + '.json');
+           var installed_plugins = require(platformJsonPath).installed_plugins;
+           var defaultPluginPreferences = installed_plugins[org_test_defaultvariables];
+           expect(defaultPluginPreferences).toBeDefined();
+           expect(defaultPluginPreferences.DEFAULT).toBe('yes');
+           expect(defaultPluginPreferences.DEFAULT_ANDROID).toBe('yes');
+           expect(defaultPluginPreferences.REQUIRED_ANDROID).toBe('NO');
+           expect(defaultPluginPreferences.REQUIRED).toBe('NO');
+           return removePlugin(org_test_defaultvariables);
        })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, 30000);
 
-    it('Test 006 : should successfully add a plugin when specifying CLI variables', function(done) {
-        addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED:'yes', REQUIRED_ANDROID:'yes'}}, done)
-        .fail(function(err) {
+    it('Test 006 : should successfully add a plugin when specifying CLI variables', function (done) {
+        addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED: 'yes', REQUIRED_ANDROID: 'yes'}}, done)
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, 30000);
 
-    it('Test 007 : should not check npm info when using the searchpath flag', function(done) {
+    it('Test 007 : should not check npm info when using the searchpath flag', function (done) {
         mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
         spyOn(registry, 'info');
         return addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {searchpath: pluginsDir}, done)
-        .then(function() {
+        .then(function () {
             expect(registry.info).not.toHaveBeenCalled();
             var fetchOptions = plugman.fetch.calls.mostRecent().args[2];
             expect(fetchOptions.searchpath[0]).toExist();
         })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, 30000);
 
-    it('Test 008 : should not check npm info when using the noregistry flag', function(done) {
+    it('Test 008 : should not check npm info when using the noregistry flag', function (done) {
         mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
 
         spyOn(registry, 'info');
-        addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {noregistry:true}, done)
-        .then(function() {
+        addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {noregistry: true}, done)
+        .then(function () {
             expect(registry.info).not.toHaveBeenCalled();
 
             var fetchOptions = plugman.fetch.calls.mostRecent().args[2];
             expect(fetchOptions.noregistry).toBeTruthy();
         })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, 30000);
 
-    it('Test 009 : should not check npm info when fetching from a Git repository', function(done) {
+    it('Test 009 : should not check npm info when fetching from a Git repository', function (done) {
         spyOn(registry, 'info');
         addPlugin(testGitPluginRepository, testGitPluginId, {}, done)
-        .then(function() {
+        .then(function () {
             expect(registry.info).not.toHaveBeenCalled();
         })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, 30000);
 
-    it('Test 010 : should select the plugin version based on npm info when fetching from npm', function(done) {
+    it('Test 010 : should select the plugin version based on npm info when fetching from npm', function (done) {
         mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
 
         spyOn(registry, 'info').and.callThrough();
-        addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {'fetch':true}, done)
-        .then(function() {
+        addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {'fetch': true}, done)
+        .then(function () {
             expect(registry.info).toHaveBeenCalled();
 
             var fetchTarget = plugman.fetch.calls.mostRecent().args[0];
             expect(fetchTarget).toEqual(npmInfoTestPlugin + '@' + npmInfoTestPluginVersion);
         })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, 30000);
 
-    it('Test 011 : should handle scoped npm packages', function(done) {
+    it('Test 011 : should handle scoped npm packages', function (done) {
         var scopedPackage = '@testscope/' + npmInfoTestPlugin;
         mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
 
         spyOn(registry, 'info').and.returnValue(Q({}));
         addPlugin(scopedPackage, npmInfoTestPlugin, {}, done)
-        .then(function() {
+        .then(function () {
             // Check to make sure that we are at least trying to get the correct package.
             // This package is not published to npm, so we can't truly do end-to-end tests
 
@@ -271,25 +271,25 @@ describe('plugin end-to-end', function() {
             var fetchTarget = plugman.fetch.calls.mostRecent().args[0];
             expect(fetchTarget).toEqual(scopedPackage);
         })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, 30000);
 
-    it('Test 012 : should handle scoped npm packages with given version tags', function(done) {
+    it('Test 012 : should handle scoped npm packages with given version tags', function (done) {
         var scopedPackage = '@testscope/' + npmInfoTestPlugin + '@latest';
         mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
 
         spyOn(registry, 'info');
         addPlugin(scopedPackage, npmInfoTestPlugin, {}, done)
-        .then(function() {
+        .then(function () {
             expect(registry.info).not.toHaveBeenCalled();
 
             var fetchTarget = plugman.fetch.calls.mostRecent().args[0];
             expect(fetchTarget).toEqual(scopedPackage);
         })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);


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


[17/18] cordova-lib git commit: CB-12895 : updated integration tests with eslint format and rebased

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/integration-tests/pkgJson-restore.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/pkgJson-restore.spec.js b/integration-tests/pkgJson-restore.spec.js
index a241b74..80ae1f8 100644
--- a/integration-tests/pkgJson-restore.spec.js
+++ b/integration-tests/pkgJson-restore.spec.js
@@ -15,18 +15,18 @@
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
-    */
-    var helpers = require('../spec/helpers'),
-        path = require('path'),
-        shell = require('shelljs'),
-        events = require('cordova-common').events,
-        ConfigParser = require('cordova-common').ConfigParser,
-        cordovaPlatform = require('../src/cordova/platform'),
-        prepare = require('../src/cordova/prepare'),
-        cordova_util = require('../src/cordova/util'),
-        cordovaPlugin = require('../src/cordova/plugin'),
-    // cordova = require('../src/cordova/cordova'),
-        TIMEOUT = 60 * 1000;
+*/
+var helpers = require('../spec/helpers');
+var path = require('path');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var ConfigParser = require('cordova-common').ConfigParser;
+var cordovaPlatform = require('../src/cordova/platform');
+var prepare = require('../src/cordova/prepare');
+var cordova_util = require('../src/cordova/util');
+var cordovaPlugin = require('../src/cordova/plugin');
+// cordova = require('../src/cordova/cordova'),
+var TIMEOUT = 60 * 1000;
 
 /** Testing will check if "cordova prepare" is restoring platforms and plugins as expected.
 *   Uses different basePkgJson files depending on testing expecations of what (platforms/plugins/variables)
@@ -34,1337 +34,1337 @@
 */
 
 // Use basePkgJson
-    describe('tests platform/spec restore with --save', function () {
-        var tmpDir = helpers.tmpDir('platform_test_pkgjson2');
-        var project = path.join(tmpDir, 'project');
-        var results;
+describe('tests platform/spec restore with --save', function () {
+    var tmpDir = helpers.tmpDir('platform_test_pkgjson2');
+    var project = path.join(tmpDir, 'project');
+    var results;
 
-        beforeEach(function () {
-            shell.rm('-rf', project);
+    beforeEach(function () {
+        shell.rm('-rf', project);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson'), tmpDir);
-            shell.mv(path.join(tmpDir, 'basePkgJson'), project);
-            process.chdir(project);
-            delete process.env.PWD;
-            events.on('results', function (res) { results = res; });
-        });
+        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson'), tmpDir);
+        shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+        process.chdir(project);
+        delete process.env.PWD;
+        events.on('results', function (res) { results = res; });
+    });
 
-        afterEach(function () {
-            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
-            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-            shell.rm('-rf', tmpDir);
-        });
+    afterEach(function () {
+        cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
+        shell.rm('-rf', tmpDir);
+    });
 
     // Factoring out some repeated checks.
-        function emptyPlatformList () {
-            return cordovaPlatform('list').then(function () {
-                var installed = results.match(/Installed platforms:\n {2}(.*)/);
-                expect(installed).toBeDefined();
-                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-            });
-        }
+    function emptyPlatformList () {
+        return cordovaPlatform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
+            expect(installed).toBeDefined();
+            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+        });
+    }
     /** Test#000 will check that when a platform is added with a spec, it will
     *   add to pkg.json with a '^' and to config.xml with a '~'. When prepare is run,
     *   pkg.json will have no change and config.xml (first char) will change from a '~' to a '^'.
     */
-        it('Test#000 : tests that the spec (~,^) is added and updated as expected in config.xml', function (done) {
-            var cwd = process.cwd();
-            var pkgJsonPath = path.join(cwd, 'package.json');
-            cordova_util.requireNoCache(pkgJsonPath);
-            var pkgJson;
-            var androidPlatform = 'android';
-            var configXmlPath = path.join(cwd, 'config.xml');
-            var firstCharConfig;
-            var engines;
-            var engNames;
-            var engSpec;
-
-            emptyPlatformList().then(function () {
+    it('Test#000 : tests that the spec (~,^) is added and updated as expected in config.xml', function (done) {
+        var cwd = process.cwd();
+        var pkgJsonPath = path.join(cwd, 'package.json');
+        cordova_util.requireNoCache(pkgJsonPath);
+        var pkgJson;
+        var androidPlatform = 'android';
+        var configXmlPath = path.join(cwd, 'config.xml');
+        var firstCharConfig;
+        var engines;
+        var engNames;
+        var engSpec;
+
+        emptyPlatformList().then(function () {
             // Add platform with save, fetch
-                return cordovaPlatform('add', androidPlatform, {'save': true, 'fetch': true});
-            }).then(function () {
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            return cordovaPlatform('add', androidPlatform, {'save': true, 'fetch': true});
+        }).then(function () {
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Added platform properly to pkg.json
-                expect(pkgJson.cordova.platforms).toBeDefined();
-                expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
+            expect(pkgJson.cordova.platforms).toBeDefined();
+            expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
             // When spec is added to pkg.json, first char is '^'.
-                expect(pkgJson.dependencies['cordova-' + androidPlatform].charAt(0)).toEqual('^');
-
-                var cfg = new ConfigParser(configXmlPath);
-                engines = cfg.getEngines();
-                engNames = engines.map(function (elem) {
-                    return elem.name;
-                });
-                engSpec = engines.map(function (elem) {
-                    return elem.spec;
-                });
+            expect(pkgJson.dependencies['cordova-' + androidPlatform].charAt(0)).toEqual('^');
+
+            var cfg = new ConfigParser(configXmlPath);
+            engines = cfg.getEngines();
+            engNames = engines.map(function (elem) {
+                return elem.name;
+            });
+            engSpec = engines.map(function (elem) {
+                return elem.spec;
+            });
             // Only android platform added to config.xml
-                expect(engNames).toEqual([ androidPlatform ]);
-                expect(engines.length === 1);
+            expect(engNames).toEqual([ androidPlatform ]);
+            expect(engines.length === 1);
             // When spec is added to config.xml, first char is '~'.
-                firstCharConfig = engSpec[0].charAt(0);
-                expect(firstCharConfig === '~');
-            }).then(function () {
+            firstCharConfig = engSpec[0].charAt(0);
+            expect(firstCharConfig === '~');
+        }).then(function () {
             // Run cordova prepare
-                return prepare();
-            }).then(function () {
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            return prepare();
+        }).then(function () {
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // No changes to pkg.json spec for android.
-                expect(pkgJson.dependencies['cordova-' + androidPlatform].charAt(0)).toEqual('^');
-                expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
+            expect(pkgJson.dependencies['cordova-' + androidPlatform].charAt(0)).toEqual('^');
+            expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
             // Config.xml spec (first char) should change from '~' to '^'.
-                var cfg1 = new ConfigParser(configXmlPath);
-                engines = cfg1.getEngines();
-                engNames = engines.map(function (elem) {
-                    return elem.name;
-                });
-                engSpec = engines.map(function (elem) {
-                    return elem.spec;
-                });
-                firstCharConfig = engSpec[0].charAt(0);
+            var cfg1 = new ConfigParser(configXmlPath);
+            engines = cfg1.getEngines();
+            engNames = engines.map(function (elem) {
+                return elem.name;
+            });
+            engSpec = engines.map(function (elem) {
+                return elem.spec;
+            });
+            firstCharConfig = engSpec[0].charAt(0);
             // When spec is added to config.xml, first char is '~'.
-                expect(firstCharConfig === '^');
-                expect(engNames).toEqual([ androidPlatform ]);
-                expect(engines.length === 1);
-            }).fail(function (err) {
-                expect(err).toBeUndefined();
-            }).fin(done);
+            expect(firstCharConfig === '^');
+            expect(engNames).toEqual([ androidPlatform ]);
+            expect(engines.length === 1);
+        }).fail(function (err) {
+            expect(err).toBeUndefined();
+        }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-        }, 300000);
+    }, 300000);
 
     /** Test#017
     *   When platform is added with url and fetch and restored with fetch,
     *   pkg.json and config.xml would add it to their files properly.
     *   When prepare is run with fetch, platform should be installed.
     */
-        it('Test#017 : test to make sure that platform url is added and restored properly', function (done) {
-            var cwd = process.cwd();
-            var pkgJsonPath = path.join(cwd, 'package.json');
-            var pkgJson;
-            var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
-            var platformsJson;
-            var configXmlPath = path.join(cwd, 'config.xml');
-            var bPlatform = 'browser';
-            var engines;
-            var engNames;
-            var engSpec;
-
-            emptyPlatformList().then(function () {
+    it('Test#017 : test to make sure that platform url is added and restored properly', function (done) {
+        var cwd = process.cwd();
+        var pkgJsonPath = path.join(cwd, 'package.json');
+        var pkgJson;
+        var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
+        var platformsJson;
+        var configXmlPath = path.join(cwd, 'config.xml');
+        var bPlatform = 'browser';
+        var engines;
+        var engNames;
+        var engSpec;
+
+        emptyPlatformList().then(function () {
             // Add platform with save and fetch
-                return cordovaPlatform('add', 'https://github.com/apache/cordova-browser', {'save': true, 'fetch': true});
-            }).then(function () {
+            return cordovaPlatform('add', 'https://github.com/apache/cordova-browser', {'save': true, 'fetch': true});
+        }).then(function () {
             // Check that platform was added to config.xml successfully.
-                var cfg = new ConfigParser(configXmlPath);
-                engines = cfg.getEngines();
-                engNames = engines.map(function (elem) {
-                    return elem.name;
-                });
-                engSpec = engines.map(function (elem) {
-                    return elem.spec;
-                });
-                expect(engNames).toEqual([bPlatform]);
-                expect(engSpec).toEqual([ 'https://github.com/apache/cordova-browser' ]);
+            var cfg = new ConfigParser(configXmlPath);
+            engines = cfg.getEngines();
+            engNames = engines.map(function (elem) {
+                return elem.name;
+            });
+            engSpec = engines.map(function (elem) {
+                return elem.spec;
+            });
+            expect(engNames).toEqual([bPlatform]);
+            expect(engSpec).toEqual([ 'https://github.com/apache/cordova-browser' ]);
             // Check that platform was added to pkg.json successfully.
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-                expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
-                expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
+            expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
             // Check that platform was added to platforms list successfully.
-                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-                expect(platformsJson[bPlatform]).toBeDefined();
-            }).then(function () {
+            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+            expect(platformsJson[bPlatform]).toBeDefined();
+        }).then(function () {
             // Remove platform without --save.
-                return cordovaPlatform('rm', bPlatform, {'fetch': true});
-            }).then(function () {
+            return cordovaPlatform('rm', bPlatform, {'fetch': true});
+        }).then(function () {
             // Platform in pkg.json should still be there.
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-                expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
-                expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
+            expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
             // Platform in platforms.json should not be there.
-                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-                expect(platformsJson[bPlatform]).toBeUndefined();
-            }).then(function () {
+            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+            expect(platformsJson[bPlatform]).toBeUndefined();
+        }).then(function () {
             // Run cordova prepare
-                return prepare({'fetch': true});
-            }).then(function () {
+            return prepare({'fetch': true});
+        }).then(function () {
             // Check config.xml for spec modification.
-                var cfg3 = new ConfigParser(configXmlPath);
-                engines = cfg3.getEngines();
-                engNames = engines.map(function (elem) {
-                    return elem.name;
-                });
-                engSpec = engines.map(function (elem) {
-                    return elem.spec;
-                });
-                expect(engNames).toEqual([ 'browser' ]);
-                expect(engSpec).toEqual([ 'git+https://github.com/apache/cordova-browser.git' ]);
+            var cfg3 = new ConfigParser(configXmlPath);
+            engines = cfg3.getEngines();
+            engNames = engines.map(function (elem) {
+                return elem.name;
+            });
+            engSpec = engines.map(function (elem) {
+                return elem.spec;
+            });
+            expect(engNames).toEqual([ 'browser' ]);
+            expect(engSpec).toEqual([ 'git+https://github.com/apache/cordova-browser.git' ]);
             // No change to pkg.json.
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-                expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
-                expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
+            expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
             // Check that platform was restored to platform.json list successfully.
-                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-                expect(platformsJson[bPlatform]).toBeDefined();
-            }).fail(function (err) {
-                expect(err).toBeUndefined();
-            }).fin(done);
+            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+            expect(platformsJson[bPlatform]).toBeDefined();
+        }).fail(function (err) {
+            expect(err).toBeUndefined();
+        }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-        }, TIMEOUT);
+    }, TIMEOUT);
 
     /** Test#018
     *   When plugin is added with url and fetch and restored with fetch,
     *   pkg.json and config.xml would add it to their files properly.
     *   When prepare is run with fetch, plugin should be installed.
     */
-        it('Test#018 : test to make sure that plugin url is added and restored properly', function (done) {
-            var cwd = process.cwd();
-            var pkgJsonPath = path.join(cwd, 'package.json');
-            var pkgJson;
-            var pluginsFolderPath = path.join(cwd, 'plugins');
-            var configXmlPath = path.join(cwd, 'config.xml');
-            var configPlugins;
-            var configPlugin;
-
-            emptyPlatformList().then(function () {
+    it('Test#018 : test to make sure that plugin url is added and restored properly', function (done) {
+        var cwd = process.cwd();
+        var pkgJsonPath = path.join(cwd, 'package.json');
+        var pkgJson;
+        var pluginsFolderPath = path.join(cwd, 'plugins');
+        var configXmlPath = path.join(cwd, 'config.xml');
+        var configPlugins;
+        var configPlugin;
+
+        emptyPlatformList().then(function () {
             // Add plugin with save and fetch.
-                return cordovaPlugin('add', ['https://github.com/apache/cordova-plugin-splashscreen'], {'save': true, 'fetch': true});
-            }).then(function () {
+            return cordovaPlugin('add', ['https://github.com/apache/cordova-plugin-splashscreen'], {'save': true, 'fetch': true});
+        }).then(function () {
             // Plugin id and spec were added to config.xml successfully.
-                var cfg = new ConfigParser(configXmlPath);
-                configPlugins = cfg.getPluginIdList();
-                configPlugin = cfg.getPlugin(configPlugins);
-                expect(configPlugin.spec).toEqual('https://github.com/apache/cordova-plugin-splashscreen');
-                expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
+            var cfg = new ConfigParser(configXmlPath);
+            configPlugins = cfg.getPluginIdList();
+            configPlugin = cfg.getPlugin(configPlugins);
+            expect(configPlugin.spec).toEqual('https://github.com/apache/cordova-plugin-splashscreen');
+            expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
             // Plugin was added to pkg.json successfully in plugin list and dependencies.
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-                expect(pkgJson.dependencies).toEqual({ 'cordova-plugin-splashscreen': 'git+https://github.com/apache/cordova-plugin-splashscreen.git' });
-                expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            expect(pkgJson.dependencies).toEqual({ 'cordova-plugin-splashscreen': 'git+https://github.com/apache/cordova-plugin-splashscreen.git' });
+            expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
             // Plugin was added to installed plugin list successfully.
-                expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).toExist();
-            }).then(function () {
+            expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).toExist();
+        }).then(function () {
             // Remove plugin without --save.
-                return cordovaPlugin('rm', 'cordova-plugin-splashscreen', {'fetch': true});
-            }).then(function () {
+            return cordovaPlugin('rm', 'cordova-plugin-splashscreen', {'fetch': true});
+        }).then(function () {
             // Plugin id and spec are still in config.xml.
-                var cfg2 = new ConfigParser(configXmlPath);
-                configPlugins = cfg2.getPluginIdList();
-                configPlugin = cfg2.getPlugin(configPlugins);
-                expect(configPlugin.spec).toEqual('https://github.com/apache/cordova-plugin-splashscreen');
-                expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
+            var cfg2 = new ConfigParser(configXmlPath);
+            configPlugins = cfg2.getPluginIdList();
+            configPlugin = cfg2.getPlugin(configPlugins);
+            expect(configPlugin.spec).toEqual('https://github.com/apache/cordova-plugin-splashscreen');
+            expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
             // Plugin still in pkg.json plugin list and dependencies.
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-                expect(pkgJson.dependencies).toEqual({ 'cordova-plugin-splashscreen': 'git+https://github.com/apache/cordova-plugin-splashscreen.git' });
-                expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            expect(pkgJson.dependencies).toEqual({ 'cordova-plugin-splashscreen': 'git+https://github.com/apache/cordova-plugin-splashscreen.git' });
+            expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
             // Plugin was removed from the installed plugin list successfully.
-                expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).not.toExist();
-            }).then(function () {
+            expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).not.toExist();
+        }).then(function () {
             // Add platform (so that prepare can run).
-                return cordovaPlatform('add', 'browser', {'save': true});
-            }).then(function () {
+            return cordovaPlatform('add', 'browser', {'save': true});
+        }).then(function () {
             // Run cordova prepare with fetch.
-                return prepare({'fetch': true});
-            }).then(function () {
+            return prepare({'fetch': true});
+        }).then(function () {
             // Config.xml spec is modified.
-                var cfg3 = new ConfigParser(configXmlPath);
-                configPlugins = cfg3.getPluginIdList();
-                configPlugin = cfg3.getPlugin(configPlugins);
-                expect(configPlugin.spec).toEqual('git+https://github.com/apache/cordova-plugin-splashscreen.git');
-                expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
+            var cfg3 = new ConfigParser(configXmlPath);
+            configPlugins = cfg3.getPluginIdList();
+            configPlugin = cfg3.getPlugin(configPlugins);
+            expect(configPlugin.spec).toEqual('git+https://github.com/apache/cordova-plugin-splashscreen.git');
+            expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
             // Pkg.json splashscreen dependency has no changes.
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-                expect(pkgJson.dependencies['cordova-plugin-splashscreen']).toEqual('git+https://github.com/apache/cordova-plugin-splashscreen.git');
-                expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            expect(pkgJson.dependencies['cordova-plugin-splashscreen']).toEqual('git+https://github.com/apache/cordova-plugin-splashscreen.git');
+            expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
             // Plugin was restored and added to installed plugin list successfully.
-                expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).toExist();
-            }).fail(function (err) {
+            expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).toExist();
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-        }, TIMEOUT);
-    });
+    }, TIMEOUT);
+});
 
 // Use basePkgJson
-    describe('tests platform/spec restore with --save', function () {
-        var tmpDir = helpers.tmpDir('platform_test_pkgjson2');
-        var project = path.join(tmpDir, 'project');
-        var results;
+describe('tests platform/spec restore with --save', function () {
+    var tmpDir = helpers.tmpDir('platform_test_pkgjson2');
+    var project = path.join(tmpDir, 'project');
+    var results;
 
-        beforeEach(function () {
-            shell.rm('-rf', tmpDir);
+    beforeEach(function () {
+        shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson'), tmpDir);
-            shell.mv(path.join(tmpDir, 'basePkgJson'), project);
-            process.chdir(project);
-            events.on('results', function (res) { results = res; });
-        });
+        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson'), tmpDir);
+        shell.mv(path.join(tmpDir, 'basePkgJson'), project);
+        process.chdir(project);
+        events.on('results', function (res) { results = res; });
+    });
 
-        afterEach(function () {
-            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
-            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-            shell.rm('-rf', tmpDir);
-        });
+    afterEach(function () {
+        cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
+        shell.rm('-rf', tmpDir);
+    });
 
     // Factoring out some repeated checks.
-        function emptyPlatformList () {
-            return cordovaPlatform('list').then(function () {
-                var installed = results.match(/Installed platforms:\n {2}(.*)/);
-                expect(installed).toBeDefined();
-                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-            });
-        }
+    function emptyPlatformList () {
+        return cordovaPlatform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
+            expect(installed).toBeDefined();
+            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+        });
+    }
 
-        function fullPlatformList () {
-            return cordovaPlatform('list').then(function () {
-                var installed = results.match(/Installed platforms:\n {2}(.*)/);
-                expect(installed).toBeDefined();
-                expect(installed[1].indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
-            });
-        }
+    function fullPlatformList () {
+        return cordovaPlatform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
+            expect(installed).toBeDefined();
+            expect(installed[1].indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
+        });
+    }
     /** Test#003 will add two platforms to package.json - one with the 'save' flag and one
     *   without the 'save' flag. It will remove both platforms without a 'save' flag.
     *   After running cordova prepare, only the platform added with the 'save' flag is restored
     *   in platforms.json.
     */
-        it('Test#003 : should NOT restore platform that was not saved and removed', function (done) {
-            var cwd = process.cwd();
-            var pkgJsonPath = path.join(cwd, 'package.json');
-            var pkgJson;
-            var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
-            var secondPlatformAdded = 'browser';
-            var platformsJson;
-
-            emptyPlatformList().then(function () {
+    it('Test#003 : should NOT restore platform that was not saved and removed', function (done) {
+        var cwd = process.cwd();
+        var pkgJsonPath = path.join(cwd, 'package.json');
+        var pkgJson;
+        var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
+        var secondPlatformAdded = 'browser';
+        var platformsJson;
+
+        emptyPlatformList().then(function () {
             // Add 'browser' platform to project without --save
-                return cordovaPlatform('add', secondPlatformAdded);
-            }).then(function () {
-            // Add helpers.testPlatform to project with --save
-                return cordovaPlatform('add', [helpers.testPlatform], {'save': true});
-            }).then(function () {
-            // Delete any previous caches of require(package.json) and (platformsJson)
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-            // Check the platform add of only helpers.testPlatform was successful in package.json.
-                expect(pkgJson.cordova.platforms).toBeDefined();
-                expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
-                expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(-1);
-            // Expect both platforms to be installed platform list in platforms.json
-                expect(platformsJson[helpers.testPlatform]).toBeDefined();
-                expect(platformsJson[secondPlatformAdded]).toBeDefined();
-            }).then(fullPlatformList) // Platforms should still be in platform ls.
-        .then(function () {
-            // Remove helpers.testPlatform without --save.
-            return cordovaPlatform('rm', [helpers.testPlatform]);
+            return cordovaPlatform('add', secondPlatformAdded);
         }).then(function () {
-            // Remove secondPlatformAdded without --save.
-            return cordovaPlatform('rm', secondPlatformAdded);
+            // Add helpers.testPlatform to project with --save
+            return cordovaPlatform('add', [helpers.testPlatform], {'save': true});
         }).then(function () {
-            // Delete any previous caches of require(pkgJson) and (platformsJson)
-            platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+            // Delete any previous caches of require(package.json) and (platformsJson)
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Check that the platform that was added with --save is still in package.json.
-            expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
-            // Check that both platforms were removed from the platforms.json.
-            expect(platformsJson[secondPlatformAdded]).toBeUndefined();
-            expect(platformsJson[helpers.testPlatform]).toBeUndefined();
-        }).then(function () {
-            // Run cordova prepare
-            return prepare();
-        }).then(function () {
-            // Delete any previous caches of platformsJson
             platformsJson = cordova_util.requireNoCache(platformsFolderPath);
-            // Expect "helpers.testPlatform" to be in the installed platforms list.
+            // Check the platform add of only helpers.testPlatform was successful in package.json.
+            expect(pkgJson.cordova.platforms).toBeDefined();
+            expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
+            expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(-1);
+            // Expect both platforms to be installed platform list in platforms.json
             expect(platformsJson[helpers.testPlatform]).toBeDefined();
-            // Expect that 'browser' will not be in platforms.json and has not been restored.
-            expect(platformsJson[secondPlatformAdded]).toBeUndefined();
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            expect(platformsJson[secondPlatformAdded]).toBeDefined();
+        }).then(fullPlatformList) // Platforms should still be in platform ls.
+            .then(function () {
+                // Remove helpers.testPlatform without --save.
+                return cordovaPlatform('rm', [helpers.testPlatform]);
+            }).then(function () {
+                // Remove secondPlatformAdded without --save.
+                return cordovaPlatform('rm', secondPlatformAdded);
+            }).then(function () {
+                // Delete any previous caches of require(pkgJson) and (platformsJson)
+                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Check that the platform that was added with --save is still in package.json.
+                expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
+                // Check that both platforms were removed from the platforms.json.
+                expect(platformsJson[secondPlatformAdded]).toBeUndefined();
+                expect(platformsJson[helpers.testPlatform]).toBeUndefined();
+            }).then(function () {
+                // Run cordova prepare
+                return prepare();
+            }).then(function () {
+                // Delete any previous caches of platformsJson
+                platformsJson = cordova_util.requireNoCache(platformsFolderPath);
+                // Expect "helpers.testPlatform" to be in the installed platforms list.
+                expect(platformsJson[helpers.testPlatform]).toBeDefined();
+                // Expect that 'browser' will not be in platforms.json and has not been restored.
+                expect(platformsJson[secondPlatformAdded]).toBeUndefined();
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-        }, TIMEOUT);
-    });
+    }, TIMEOUT);
+});
 
 // Use basePkgJson6 because pkg.json and config.xml contain only android
-    describe('files should not be modified if their platforms are identical', function () {
-        var tmpDir = helpers.tmpDir('platform_test_pkgjson');
-        var project = path.join(tmpDir, 'project');
-        var results;
+describe('files should not be modified if their platforms are identical', function () {
+    var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+    var project = path.join(tmpDir, 'project');
+    var results;
 
-        beforeEach(function () {
-            shell.rm('-rf', tmpDir);
+    beforeEach(function () {
+        shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
         // Use basePkgJson6 because pkg.json and config.xml contain only android
-            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson6'), tmpDir);
-            shell.mv(path.join(tmpDir, 'basePkgJson6'), project);
-            process.chdir(project);
-            events.on('results', function (res) { results = res; });
-        });
+        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson6'), tmpDir);
+        shell.mv(path.join(tmpDir, 'basePkgJson6'), project);
+        process.chdir(project);
+        events.on('results', function (res) { results = res; });
+    });
 
-        afterEach(function () {
-            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
-            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-            shell.rm('-rf', tmpDir);
-        });
+    afterEach(function () {
+        cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
+        shell.rm('-rf', tmpDir);
+    });
 
     // Factoring out some repeated checks.
-        function emptyPlatformList () {
-            return cordovaPlatform('list').then(function () {
-                var installed = results.match(/Installed platforms:\n {2}(.*)/);
-                expect(installed).toBeDefined();
-                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-            });
-        }
+    function emptyPlatformList () {
+        return cordovaPlatform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
+            expect(installed).toBeDefined();
+            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+        });
+    }
     /** Test#004 will check the platform list in package.json and config.xml.
     *   When both files contain the same platforms and cordova prepare is run,
     *   neither file is modified.
     */
-        it('Test#004 : if pkg.json and config.xml have the same platforms, do not modify either file', function (done) {
-            var cwd = process.cwd();
-            var configXmlPath = path.join(cwd, 'config.xml');
-            var cfg1 = new ConfigParser(configXmlPath);
-            var engines = cfg1.getEngines();
-            var pkgJsonPath = path.join(cwd, 'package.json');
-            var pkgJson;
-            var engNames = engines.map(function (elem) {
-                return elem.name;
-            });
-            var configEngArray = engNames.slice();
+    it('Test#004 : if pkg.json and config.xml have the same platforms, do not modify either file', function (done) {
+        var cwd = process.cwd();
+        var configXmlPath = path.join(cwd, 'config.xml');
+        var cfg1 = new ConfigParser(configXmlPath);
+        var engines = cfg1.getEngines();
+        var pkgJsonPath = path.join(cwd, 'package.json');
+        var pkgJson;
+        var engNames = engines.map(function (elem) {
+            return elem.name;
+        });
+        var configEngArray = engNames.slice();
         // Pkg.json and config.xml contain only android at this point (basePkgJson6).
-            emptyPlatformList().then(function () {
+        emptyPlatformList().then(function () {
             // Run cordova prepare.
-                return prepare();
-            }).then(function () {
-                var cfg2 = new ConfigParser(configXmlPath);
-                engines = cfg2.getEngines();
-                engNames = engines.map(function (elem) {
-                    return elem.name;
-                });
-                configEngArray = engNames.slice();
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            return prepare();
+        }).then(function () {
+            var cfg2 = new ConfigParser(configXmlPath);
+            engines = cfg2.getEngines();
+            engNames = engines.map(function (elem) {
+                return elem.name;
+            });
+            configEngArray = engNames.slice();
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Expect android to be in both pkg.json and config.xml.
-                expect(pkgJson.cordova.platforms.indexOf('android')).toBeGreaterThan(-1);
-                expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
+            expect(pkgJson.cordova.platforms.indexOf('android')).toBeGreaterThan(-1);
+            expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
             // Expect pkg.json and config.xml to have only 1 element each.
-                expect(configEngArray.length === 1);
-                expect(pkgJson.cordova.platforms.length === 1);
-            }).fail(function (err) {
-                expect(err).toBeUndefined();
-            }).fin(done);
+            expect(configEngArray.length === 1);
+            expect(pkgJson.cordova.platforms.length === 1);
+        }).fail(function (err) {
+            expect(err).toBeUndefined();
+        }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-        }, TIMEOUT);
-    });
+    }, TIMEOUT);
+});
 
 // Use a new basePkgJson5 as config.xml contains android/browser and pkg.json contains android
-    describe('update pkg.json to include platforms in config.xml', function () {
-        var tmpDir = helpers.tmpDir('platform_test_pkgjson');
-        var project = path.join(tmpDir, 'project');
-        var results;
+describe('update pkg.json to include platforms in config.xml', function () {
+    var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+    var project = path.join(tmpDir, 'project');
+    var results;
 
-        beforeEach(function () {
-            shell.rm('-rf', tmpDir);
+    beforeEach(function () {
+        shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson5'), tmpDir);
-            shell.mv(path.join(tmpDir, 'basePkgJson5'), project);
-            process.chdir(project);
-            events.on('results', function (res) { results = res; });
-        });
+        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson5'), tmpDir);
+        shell.mv(path.join(tmpDir, 'basePkgJson5'), project);
+        process.chdir(project);
+        events.on('results', function (res) { results = res; });
+    });
 
-        afterEach(function () {
-            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
-            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-            shell.rm('-rf', tmpDir);
-        });
+    afterEach(function () {
+        cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
+        shell.rm('-rf', tmpDir);
+    });
 
     // Factoring out some repeated checks.
-        function emptyPlatformList () {
-            return cordovaPlatform('list').then(function () {
-                var installed = results.match(/Installed platforms:\n {2}(.*)/);
-                expect(installed).toBeDefined();
-                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-            });
-        }
+    function emptyPlatformList () {
+        return cordovaPlatform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
+            expect(installed).toBeDefined();
+            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+        });
+    }
     /** Test#005 will check the platform list in package.json and config.xml.
     *   When config.xml has 'android and browser' and pkg.json only contains 'android', run cordova
     *   and pkg.json is updated to include 'browser'. This test will also check that pkg.json
     *   is updated with the correct spec/dependencies when restored. Checks that specs are
     *   added properly, too.
     */
-        it('Test#005 : if config.xml has android & browser platforms and pkg.json has android, update pkg.json to also include browser with spec', function (done) {
-            var cwd = process.cwd();
-            var configXmlPath = path.join(cwd, 'config.xml');
-            var cfg = new ConfigParser(configXmlPath);
-            var engines = cfg.getEngines();
-            var pkgJsonPath = path.join(cwd, 'package.json');
-            cordova_util.requireNoCache(pkgJsonPath);
-            var pkgJson = require(pkgJsonPath);
-            var engNames = engines.map(function (elem) {
-                return elem.name;
-            });
-            var configEngArray = engNames.slice();
-            var androidPlatform = 'android';
-            var browserPlatform = 'browser';
+    it('Test#005 : if config.xml has android & browser platforms and pkg.json has android, update pkg.json to also include browser with spec', function (done) {
+        var cwd = process.cwd();
+        var configXmlPath = path.join(cwd, 'config.xml');
+        var cfg = new ConfigParser(configXmlPath);
+        var engines = cfg.getEngines();
+        var pkgJsonPath = path.join(cwd, 'package.json');
+        cordova_util.requireNoCache(pkgJsonPath);
+        var pkgJson = require(pkgJsonPath);
+        var engNames = engines.map(function (elem) {
+            return elem.name;
+        });
+        var configEngArray = engNames.slice();
+        var androidPlatform = 'android';
+        var browserPlatform = 'browser';
 
         // Config.xml contains(android & browser) and pkg.json contains android (basePkgJson5).
-            expect(configEngArray.indexOf(androidPlatform)).toBeGreaterThan(-1);
-            expect(configEngArray.indexOf(browserPlatform)).toBeGreaterThan(-1);
+        expect(configEngArray.indexOf(androidPlatform)).toBeGreaterThan(-1);
+        expect(configEngArray.indexOf(browserPlatform)).toBeGreaterThan(-1);
         // pkg.json should not contain 'browser' platform before cordova prepare.
-            expect(pkgJson.cordova.platforms.indexOf(browserPlatform)).toEqual(-1);
-            expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
+        expect(pkgJson.cordova.platforms.indexOf(browserPlatform)).toEqual(-1);
+        expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
         // pkg.json browser/android specs should be undefined.
-            expect(pkgJson.dependencies[browserPlatform]).toBeUndefined();
-            expect(pkgJson.dependencies[androidPlatform]).toBeUndefined();
-            emptyPlatformList().then(function () {
-                return prepare();
-            }).then(function () {
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+        expect(pkgJson.dependencies[browserPlatform]).toBeUndefined();
+        expect(pkgJson.dependencies[androidPlatform]).toBeUndefined();
+        emptyPlatformList().then(function () {
+            return prepare();
+        }).then(function () {
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Expect 'browser' to be added to pkg.json.
-                expect(pkgJson.cordova.platforms.indexOf(browserPlatform)).toBeGreaterThan(-1);
+            expect(pkgJson.cordova.platforms.indexOf(browserPlatform)).toBeGreaterThan(-1);
             // Expect 'android' to still be there in pkg.json.
-                expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
+            expect(pkgJson.cordova.platforms.indexOf(androidPlatform)).toBeGreaterThan(-1);
             // Expect both pkg.json and config.xml to each have both platforms in their arrays.
-                expect(configEngArray.length === 2);
-                expect(pkgJson.cordova.platforms.length === 2);
+            expect(configEngArray.length === 2);
+            expect(pkgJson.cordova.platforms.length === 2);
             // No changes to config.xml.
-                expect(configEngArray.indexOf(androidPlatform)).toBeGreaterThan(-1);
-                expect(configEngArray.indexOf(browserPlatform)).toBeGreaterThan(-1);
+            expect(configEngArray.indexOf(androidPlatform)).toBeGreaterThan(-1);
+            expect(configEngArray.indexOf(browserPlatform)).toBeGreaterThan(-1);
             // Platform specs from config.xml have been added to pkg.json.
-                expect(pkgJson.dependencies['cordova-browser']).toEqual('^4.1.0');
-                expect(pkgJson.dependencies['cordova-android']).toEqual('6.1.1');
-            }).fail(function (err) {
-                expect(err).toBeUndefined();
-            }).fin(done);
+            expect(pkgJson.dependencies['cordova-browser']).toEqual('^4.1.0');
+            expect(pkgJson.dependencies['cordova-android']).toEqual('6.1.1');
+        }).fail(function (err) {
+            expect(err).toBeUndefined();
+        }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-        }, TIMEOUT);
-    });
+    }, TIMEOUT);
+});
 
 // Use basePkgJson3 as it has 'android' in config.xml and pkg.json (no cordova key).
-    describe('update empty package.json to match config.xml', function () {
-        var tmpDir = helpers.tmpDir('platform_test_pkgjson');
-        var project = path.join(tmpDir, 'project');
-        var results;
+describe('update empty package.json to match config.xml', function () {
+    var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+    var project = path.join(tmpDir, 'project');
+    var results;
 
-        beforeEach(function () {
-            shell.rm('-rf', tmpDir);
+    beforeEach(function () {
+        shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson3'), tmpDir);
-            shell.mv(path.join(tmpDir, 'basePkgJson3'), project);
-            process.chdir(project);
-            events.on('results', function (res) { results = res; });
-        });
+        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson3'), tmpDir);
+        shell.mv(path.join(tmpDir, 'basePkgJson3'), project);
+        process.chdir(project);
+        events.on('results', function (res) { results = res; });
+    });
 
-        afterEach(function () {
-            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
-            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-            shell.rm('-rf', tmpDir);
-        });
+    afterEach(function () {
+        cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
+        shell.rm('-rf', tmpDir);
+    });
 
     // Factoring out some repeated checks.
-        function emptyPlatformList () {
-            return cordovaPlatform('list').then(function () {
-                var installed = results.match(/Installed platforms:\n {2}(.*)/);
-                expect(installed).toBeDefined();
-                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-            });
-        }
+    function emptyPlatformList () {
+        return cordovaPlatform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
+            expect(installed).toBeDefined();
+            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+        });
+    }
     /** Test#006 will check if pkg.json has a cordova key and platforms installed already.
      *   If it does not and config.xml has a platform(s) installed already, run cordova prepare
      *   and it will add a cordova key and the platform(s) from config.xml to package.json.
      */
-        it('Test#006 : if pkg.json exists without cordova key, create one with same platforms in config.xml ', function (done) {
-            var cwd = process.cwd();
-            var configXmlPath = path.join(cwd, 'config.xml');
-            var pkgJsonPath = path.join(cwd, 'package.json');
-            cordova_util.requireNoCache(pkgJsonPath);
-            var cfg1 = new ConfigParser(configXmlPath);
-            var engines = cfg1.getEngines();
-            var pkgJson = require(pkgJsonPath);
-            var engNames = engines.map(function (elem) {
-                return elem.name;
-            });
-            var configEngArray = engNames.slice();
+    it('Test#006 : if pkg.json exists without cordova key, create one with same platforms in config.xml ', function (done) {
+        var cwd = process.cwd();
+        var configXmlPath = path.join(cwd, 'config.xml');
+        var pkgJsonPath = path.join(cwd, 'package.json');
+        cordova_util.requireNoCache(pkgJsonPath);
+        var cfg1 = new ConfigParser(configXmlPath);
+        var engines = cfg1.getEngines();
+        var pkgJson = require(pkgJsonPath);
+        var engNames = engines.map(function (elem) {
+            return elem.name;
+        });
+        var configEngArray = engNames.slice();
 
         // Expect that pkg.json exists without a cordova key.
-            expect(pkgJson).toBeDefined();
-            expect(pkgJson.cordova).toBeUndefined();
+        expect(pkgJson).toBeDefined();
+        expect(pkgJson.cordova).toBeUndefined();
         // Expect that config.xml contains only android at this point.
-            expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
-            expect(configEngArray.length === 1);
+        expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
+        expect(configEngArray.length === 1);
         // Run cordova prepare.
-            prepare();
-            emptyPlatformList().then(function () {
-                var cfg2 = new ConfigParser(configXmlPath);
-                engines = cfg2.getEngines();
-                engNames = engines.map(function (elem) {
-                    return elem.name;
-                });
-                configEngArray = engNames.slice();
+        prepare();
+        emptyPlatformList().then(function () {
+            var cfg2 = new ConfigParser(configXmlPath);
+            engines = cfg2.getEngines();
+            engNames = engines.map(function (elem) {
+                return elem.name;
+            });
+            configEngArray = engNames.slice();
             // Delete any previous caches of require(package.json).
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
             // Expect no change to config.xml.
-                expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
+            expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
             // Expect cordova key and 'android' platform to be added to pkg.json.
-                expect(pkgJson.cordova.platforms.indexOf('android')).toBeGreaterThan(-1);
+            expect(pkgJson.cordova.platforms.indexOf('android')).toBeGreaterThan(-1);
             // Expect both pkg.json and config.xml to each have (only) android in their arrays.
-                expect(configEngArray.length === 1);
-                expect(pkgJson.cordova.platforms.length === 1);
-            }).fail(function (err) {
-                expect(err).toBeUndefined();
-            }).fin(done);
+            expect(configEngArray.length === 1);
+            expect(pkgJson.cordova.platforms.length === 1);
+        }).fail(function (err) {
+            expect(err).toBeUndefined();
+        }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-        }, TIMEOUT);
-    });
+    }, TIMEOUT);
+});
 
 // Use a new basePkgJson4 as pkg.json contains android/browser and config.xml contains android.
-    describe('update config.xml to include platforms in pkg.json', function () {
-        var tmpDir = helpers.tmpDir('platform_test_pkgjson');
-        var project = path.join(tmpDir, 'project');
-        var results;
+describe('update config.xml to include platforms in pkg.json', function () {
+    var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+    var project = path.join(tmpDir, 'project');
+    var results;
 
-        beforeEach(function () {
-            shell.rm('-rf', tmpDir);
+    beforeEach(function () {
+        shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson4'), tmpDir);
-            shell.mv(path.join(tmpDir, 'basePkgJson4'), project);
-            process.chdir(project);
-            events.on('results', function (res) { results = res; });
-        });
+        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson4'), tmpDir);
+        shell.mv(path.join(tmpDir, 'basePkgJson4'), project);
+        process.chdir(project);
+        events.on('results', function (res) { results = res; });
+    });
 
-        afterEach(function () {
-            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
-            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-            shell.rm('-rf', tmpDir);
-        });
+    afterEach(function () {
+        cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
+        shell.rm('-rf', tmpDir);
+    });
 
     // Factoring out some repeated checks.
-        function emptyPlatformList () {
-            return cordovaPlatform('list').then(function () {
-                var installed = results.match(/Installed platforms:\n {2}(.*)/);
-                expect(installed).toBeDefined();
-                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-            });
-        }
+    function emptyPlatformList () {
+        return cordovaPlatform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
+            expect(installed).toBeDefined();
+            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+        });
+    }
     /** Test#007 will check the platform list in package.json and config.xml.
     *   When package.json has 'android and browser' and config.xml only contains 'android', run cordova
     *   and config.xml is updated to include 'browser'. Also, if there is a specified spec in pkg.json,
     *   it should be added to config.xml during restore.
     */
-        it('Test#007 : if pkgJson has android & browser platforms and config.xml has android, update config to also include browser and spec', function (done) {
-            var cwd = process.cwd();
-            var configXmlPath = path.join(cwd, 'config.xml');
-            var cfg1 = new ConfigParser(configXmlPath);
-            var engines = cfg1.getEngines();
-            var pkgJsonPath = path.join(cwd, 'package.json');
-            cordova_util.requireNoCache(pkgJsonPath);
-            var pkgJson = require(pkgJsonPath);
-            var engNames = engines.map(function (elem) {
-                return elem.name;
-            });
-            var configEngArray = engNames.slice();
+    it('Test#007 : if pkgJson has android & browser platforms and config.xml has android, update config to also include browser and spec', function (done) {
+        var cwd = process.cwd();
+        var configXmlPath = path.join(cwd, 'config.xml');
+        var cfg1 = new ConfigParser(configXmlPath);
+        var engines = cfg1.getEngines();
+        var pkgJsonPath = path.join(cwd, 'package.json');
+        cordova_util.requireNoCache(pkgJsonPath);
+        var pkgJson = require(pkgJsonPath);
+        var engNames = engines.map(function (elem) {
+            return elem.name;
+        });
+        var configEngArray = engNames.slice();
 
         // Expect that config.xml contains only android at this point (basePjgJson4)
-            expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
-            expect(configEngArray.indexOf('browser')).toEqual(-1);
-            expect(configEngArray.length === 1);
+        expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
+        expect(configEngArray.indexOf('browser')).toEqual(-1);
+        expect(configEngArray.length === 1);
         // Pkg.json has cordova-browser in its dependencies.
-            expect(pkgJson.dependencies).toEqual({ 'cordova-android': '^3.1.0', 'cordova-browser': '^4.1.0' });
-            emptyPlatformList().then(function () {
+        expect(pkgJson.dependencies).toEqual({ 'cordova-android': '^3.1.0', 'cordova-browser': '^4.1.0' });
+        emptyPlatformList().then(function () {
             // Run cordova prepare.
-                return prepare();
-            }).then(function () {
+            return prepare();
+        }).then(function () {
             // Delete any previous caches of require(package.json).
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-                var cfg2 = new ConfigParser(configXmlPath);
-                engines = cfg2.getEngines();
-                engNames = engines.map(function (elem) {
-                    return elem.name;
-                });
-                configEngArray = engNames.slice();
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            var cfg2 = new ConfigParser(configXmlPath);
+            engines = cfg2.getEngines();
+            engNames = engines.map(function (elem) {
+                return elem.name;
+            });
+            configEngArray = engNames.slice();
             // Expect 'browser' to be added to config.xml.
-                expect(configEngArray.indexOf('browser')).toBeGreaterThan(-1);
+            expect(configEngArray.indexOf('browser')).toBeGreaterThan(-1);
             // Expect 'android' to still be in config.xml.
-                expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
+            expect(configEngArray.indexOf('android')).toBeGreaterThan(-1);
             // Expect config.xml array to have 2 elements (platforms).
-                expect(configEngArray.length === 2);
+            expect(configEngArray.length === 2);
             // Check to make sure that 'browser' spec was added properly.
-                expect(engines).toEqual([ { name: 'android', spec: '^3.1.0' }, { name: 'browser', spec: '^4.1.0' } ]);
+            expect(engines).toEqual([ { name: 'android', spec: '^3.1.0' }, { name: 'browser', spec: '^4.1.0' } ]);
             // No change to pkg.json dependencies.
-                expect(pkgJson.dependencies).toEqual({ 'cordova-android': '^3.1.0', 'cordova-browser': '^4.1.0' });
-                expect(pkgJson.dependencies['cordova-android']).toEqual('^3.1.0');
-                expect(pkgJson.dependencies['cordova-browser']).toEqual('^4.1.0');
-            }).fail(function (err) {
-                expect(err).toBeUndefined();
-            }).fin(done);
+            expect(pkgJson.dependencies).toEqual({ 'cordova-android': '^3.1.0', 'cordova-browser': '^4.1.0' });
+            expect(pkgJson.dependencies['cordova-android']).toEqual('^3.1.0');
+            expect(pkgJson.dependencies['cordova-browser']).toEqual('^4.1.0');
+        }).fail(function (err) {
+            expect(err).toBeUndefined();
+        }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-        }, TIMEOUT);
-    });
+    }, TIMEOUT);
+});
 
 // Plugin testing begins here.
 
 // Use basePkgJson8 as pkg.json contains 1 plugin and 1 variable and config contains 1 plugin 1 var
 // Same variable, different values... pkg.json should win
-    describe('update config.xml to use the variable found in pkg.json', function () {
-        var tmpDir = helpers.tmpDir('platform_test_pkgjson');
-        var project = path.join(tmpDir, 'project');
-        var results;
+describe('update config.xml to use the variable found in pkg.json', function () {
+    var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+    var project = path.join(tmpDir, 'project');
+    var results;
 
-        beforeEach(function () {
-            shell.rm('-rf', tmpDir);
+    beforeEach(function () {
+        shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson8'), tmpDir);
-            shell.mv(path.join(tmpDir, 'basePkgJson8'), project);
-            process.chdir(project);
-            events.on('results', function (res) { results = res; });
-        });
+        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson8'), tmpDir);
+        shell.mv(path.join(tmpDir, 'basePkgJson8'), project);
+        process.chdir(project);
+        events.on('results', function (res) { results = res; });
+    });
 
-        afterEach(function () {
-            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
-            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-            shell.rm('-rf', tmpDir);
-        });
+    afterEach(function () {
+        cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
+        shell.rm('-rf', tmpDir);
+    });
     // Factoring out some repeated checks.
-        function emptyPlatformList () {
-            return cordovaPlatform('list').then(function () {
-                var installed = results.match(/Installed platforms:\n {2}(.*)/);
-                expect(installed).toBeDefined();
-                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-            });
-        }
+    function emptyPlatformList () {
+        return cordovaPlatform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
+            expect(installed).toBeDefined();
+            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+        });
+    }
     /** Test#011 will check the plugin/variable list in package.json and config.xml.
     *   When pkg.json and config.xml have the same variables, but different values,
     *   pkg.json should win and that value will be used and replaces config's value.
     */
-        it('Test#011 : if pkg.Json has 1 plugin and 1 variable, update config.xml to include these variables', function (done) {
-            var cwd = process.cwd();
-            var configXmlPath = path.join(cwd, 'config.xml');
-            var pkgJsonPath = path.join(cwd, 'package.json');
-            cordova_util.requireNoCache(pkgJsonPath);
-            var cfg1 = new ConfigParser(configXmlPath);
-            var configPlugins = cfg1.getPluginIdList();
-            var configPlugin = cfg1.getPlugin(configPlugins);
-            var configPluginVariables = configPlugin.variables;
-            var pkgJson = require(pkgJsonPath);
-            var pluginsFolderPath = path.join(cwd, 'plugins');
+    it('Test#011 : if pkg.Json has 1 plugin and 1 variable, update config.xml to include these variables', function (done) {
+        var cwd = process.cwd();
+        var configXmlPath = path.join(cwd, 'config.xml');
+        var pkgJsonPath = path.join(cwd, 'package.json');
+        cordova_util.requireNoCache(pkgJsonPath);
+        var cfg1 = new ConfigParser(configXmlPath);
+        var configPlugins = cfg1.getPluginIdList();
+        var configPlugin = cfg1.getPlugin(configPlugins);
+        var configPluginVariables = configPlugin.variables;
+        var pkgJson = require(pkgJsonPath);
+        var pluginsFolderPath = path.join(cwd, 'plugins');
 
         // Expect that pkg.json exists with 1 plugin, 1 variable, and a different value ('json').
-            expect(pkgJson.cordova.plugins).toBeDefined();
-            expect(Object.keys(pkgJson.cordova.plugins).length === 1);
-            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
-            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toEqual({ variable_1: 'json' });
+        expect(pkgJson.cordova.plugins).toBeDefined();
+        expect(Object.keys(pkgJson.cordova.plugins).length === 1);
+        expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
+        expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toEqual({ variable_1: 'json' });
         // Expect that config.xml exists with 1 plugin, 1 variable, but a different value ('config').
-            expect(configPlugin.name).toEqual('cordova-plugin-camera');
-            expect(configPluginVariables).toEqual({ variable_1: 'config' });
-            expect(Object.keys(configPlugin).length === 1);
+        expect(configPlugin.name).toEqual('cordova-plugin-camera');
+        expect(configPluginVariables).toEqual({ variable_1: 'config' });
+        expect(Object.keys(configPlugin).length === 1);
 
-            emptyPlatformList().then(function () {
+        emptyPlatformList().then(function () {
             // Run cordova prepare.
-                return prepare();
-            }).then(function () {
+            return prepare();
+        }).then(function () {
             // Delete any previous caches of require(package.json).
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-                var cfg2 = new ConfigParser(configXmlPath);
-                configPlugins = cfg2.getPluginIdList();
-                configPlugin = cfg2.getPlugin(configPlugins);
-                configPluginVariables = configPlugin.variables;
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            var cfg2 = new ConfigParser(configXmlPath);
+            configPlugins = cfg2.getPluginIdList();
+            configPlugin = cfg2.getPlugin(configPlugins);
+            configPluginVariables = configPlugin.variables;
             // Expect that pkg.json exists with 1 plugin, 1 variable, and the pkg.json value.
-                expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
-                expect(Object.keys(pkgJson.cordova.plugins).length === 1);
-                expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toEqual({ variable_1: 'json' });
+            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
+            expect(Object.keys(pkgJson.cordova.plugins).length === 1);
+            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toEqual({ variable_1: 'json' });
             // Expect that config.xml exists with 1 plugin, 1 variable and pkg.json's value.
-                expect(configPlugin.name).toEqual('cordova-plugin-camera');
-                expect(configPluginVariables).toEqual({ variable_1: 'json' });
-                expect(Object.keys(configPlugin).length === 1);
+            expect(configPlugin.name).toEqual('cordova-plugin-camera');
+            expect(configPluginVariables).toEqual({ variable_1: 'json' });
+            expect(Object.keys(configPlugin).length === 1);
             // Expect that the camera plugin is restored.
-                expect(path.join(pluginsFolderPath, 'cordova-plugin-camera')).toExist();
-            }).fail(function (err) {
-                expect(err).toBeUndefined();
-            }).fin(done);
+            expect(path.join(pluginsFolderPath, 'cordova-plugin-camera')).toExist();
+        }).fail(function (err) {
+            expect(err).toBeUndefined();
+        }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-        }, TIMEOUT);
-    });
+    }, TIMEOUT);
+});
 
 // Use basePkgJson9 as config contains 1 plugin and 1 variable and pkg.json contains 1 plugin 0 var
-    describe('update pkg.json to include plugin and variable found in config.xml', function () {
-        var tmpDir = helpers.tmpDir('platform_test_pkgjson');
-        var project = path.join(tmpDir, 'project');
-        var results;
+describe('update pkg.json to include plugin and variable found in config.xml', function () {
+    var tmpDir = helpers.tmpDir('platform_test_pkgjson');
+    var project = path.join(tmpDir, 'project');
+    var results;
 
-        beforeEach(function () {
-            shell.rm('-rf', tmpDir);
+    beforeEach(function () {
+        shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson9'), tmpDir);
-            shell.mv(path.join(tmpDir, 'basePkgJson9'), project);
-            process.chdir(project);
-            events.on('results', function (res) { results = res; });
-        });
+        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson9'), tmpDir);
+        shell.mv(path.join(tmpDir, 'basePkgJson9'), project);
+        process.chdir(project);
+        events.on('results', function (res) { results = res; });
+    });
 
-        afterEach(function () {
-            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
-            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-            shell.rm('-rf', tmpDir);
-        });
+    afterEach(function () {
+        cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
+        shell.rm('-rf', tmpDir);
+    });
 
     // Factoring out some repeated checks.
-        function emptyPlatformList () {
-            return cordovaPlatform('list').then(function () {
-                var installed = results.match(/Installed platforms:\n {2}(.*)/);
-                expect(installed).toBeDefined();
-                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-            });
-        }
+    function emptyPlatformList () {
+        return cordovaPlatform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
+            expect(installed).toBeDefined();
+            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+        });
+    }
     /** Test#012 will check the plugin/variable list in package.json and config.xml.
     *   When config.xml has a 'camera plugin and 1 variable' and pkg.json has 1 plugins/0 variables,
     *   cordova prepare runs and will update pkg.json to match config.xml's plugins/variables.
     */
-        it('Test#012 : if pkg.Json has 1 plugin and 2 variables, update config.xml to include these plugins/variables', function (done) {
-            var cwd = process.cwd();
-            var configXmlPath = path.join(cwd, 'config.xml');
-            var pkgJsonPath = path.join(cwd, 'package.json');
+    it('Test#012 : if pkg.Json has 1 plugin and 2 variables, update config.xml to include these plugins/variables', function (done) {
+        var cwd = process.cwd();
+        var configXmlPath = path.join(cwd, 'config.xml');
+        var pkgJsonPath = path.join(cwd, 'package.json');
         // Delete any previous caches of require(package.json).
-            cordova_util.requireNoCache(pkgJsonPath);
-            var cfg1 = new ConfigParser(configXmlPath);
-            var configPlugins = cfg1.getPluginIdList();
-            var configPlugin = cfg1.getPlugin(configPlugins);
-            var configPluginVariables = configPlugin.variables;
-            var pkgJson = require(pkgJsonPath);
-            var pluginsFolderPath12 = path.join(cwd, 'plugins');
+        cordova_util.requireNoCache(pkgJsonPath);
+        var cfg1 = new ConfigParser(configXmlPath);
+        var configPlugins = cfg1.getPluginIdList();
+        var configPlugin = cfg1.getPlugin(configPlugins);
+        var configPluginVariables = configPlugin.variables;
+        var pkgJson = require(pkgJsonPath);
+        var pluginsFolderPath12 = path.join(cwd, 'plugins');
 
         // Expect that pkg.json exists with 1 plugin without a variable.
-            expect(pkgJson.cordova.plugins).toBeDefined();
-            expect(Object.keys(pkgJson.cordova.plugins).length === 1);
-            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
-            expect(pkgJson.cordova.plugins).toEqual({ 'cordova-plugin-camera': {} });
+        expect(pkgJson.cordova.plugins).toBeDefined();
+        expect(Object.keys(pkgJson.cordova.plugins).length === 1);
+        expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
+        expect(pkgJson.cordova.plugins).toEqual({ 'cordova-plugin-camera': {} });
 
         // Expect that config.xml exists with 1 plugin and 1 variable with value_1.
-            expect(configPlugin.name).toEqual('cordova-plugin-camera');
-            expect(configPluginVariables).toEqual({ variable_1: 'value_1' });
-            expect(Object.keys(configPlugin).length === 1);
+        expect(configPlugin.name).toEqual('cordova-plugin-camera');
+        expect(configPluginVariables).toEqual({ variable_1: 'value_1' });
+        expect(Object.keys(configPlugin).length === 1);
 
-            emptyPlatformList().then(function () {
+        emptyPlatformList().then(function () {
             // Run cordova prepare.
-                return prepare();
-            }).then(function () {
+            return prepare();
+        }).then(function () {
             // Delete any previous caches of require(package.json).
-                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-                var cfg2 = new ConfigParser(configXmlPath);
-                configPlugins = cfg2.getPluginIdList();
-                configPlugin = cfg2.getPlugin(configPlugins);
-                configPluginVariables = configPlugin.variables;
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            var cfg2 = new ConfigParser(configXmlPath);
+            configPlugins = cfg2.getPluginIdList();
+            configPlugin = cfg2.getPlugin(configPlugins);
+            configPluginVariables = configPlugin.variables;
             // Expect that pkg.json exists with 1 plugin, 1 variable, and 1 value.
-                expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
-                expect(Object.keys(pkgJson.cordova.plugins).length === 1);
-                expect(pkgJson.cordova.plugins).toEqual({ 'cordova-plugin-camera': { variable_1: 'value_1' } });
+            expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
+            expect(Object.keys(pkgJson.cordova.plugins).length === 1);
+            expect(pkgJson.cordova.plugins).toEqual({ 'cordova-plugin-camera': { variable_1: 'value_1' } });
             // Expect that config.xml exists with 1 plugin, 1 variable and 1 value.
-                expect(configPlugin.name).toEqual('cordova-plugin-camera');
-                expect(configPluginVariables).toEqual({ variable_1: 'value_1' });
-                expect(Object.keys(configPlugin).length === 1);
+            expect(configPlugin.name).toEqual('cordova-plugin-camera');
+            expect(configPluginVariables).toEqual({ variable_1: 'value_1' });
+            expect(Object.keys(configPlugin).length === 1);
             // Expect camera to be restored and in the installed plugin list.
-                expect(path.join(pluginsFolderPath12, 'cordova-plugin-camera')).toExist();
-            }).fail(function (err) {
-                expect(err).toBeUndefined();
-            }).fin(done);
+            expect(path.join(pluginsFolderPath12, 'cordova-plugin-camera')).toExist();
+        }).fail(function (err) {
+            expect(err).toBeUndefined();
+        }).fin(done);
     // Cordova prepare needs extra wait time to complete.
-        }, TIMEOUT);
-    });
+    }, TIMEOUT);
+});
 
 // Use basePkgJson10 as pkg.json contains (camera plugin: var 1/var 2, splashscreen plugin).
 // and config contains (camera plugin: var 3, value 1, device plugin).
-    describe('update pkg.json AND config.xml to include all plugins and merge unique variables', function () {
-        var tmpDir = helpers.tmpDir('plugin_test_pkgjson');
-        var project = path.join(tmpDir, 'project');
-        var results;
+describe('update pkg.json AND config.xml to include all plugins and merge unique variables', function () {
+    var tmpDir = helpers.tmpDir('plugin_test_pkgjson');
+    var project = path.join(tmpDir, 'project');
+    var results;
 
-        beforeEach(function () {
-            shell.rm('-rf', tmpDir);
+    beforeEach(function () {
+        shell.rm('-rf', tmpDir);
         // Copy then move because we need to copy everything, but that means it will copy the whole directory.
         // Using /* doesn't work because of hidden files.
-            shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson10'), tmpDir);
-            shell.mv(path.join(tmpDir, 'basePkgJson10'), project);
-            process.chdir(project);
-            events.on('results', function (res) { results = res; });
-        });
+        shell.cp('-R', path.join(__dirname, '..', 'spec', 'cordova', 'fixtures', 'basePkgJson10'), tmpDir);
+        shell.mv(path.join(tmpDir, 'basePkgJson10'), project);
+        process.chdir(project);
+        events.on('results', function (res) { results = res; });
+    });
 
-        afterEach(function () {
-            cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
-            process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
-            shell.rm('-rf', tmpDir);
-        });
+    afterEach(function () {
+        cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
+        shell.rm('-rf', tmpDir);
+    });
 
     // Factoring out some repeated checks.
-        function emptyPlatformList () {
-            return cordovaPlatform('list').then(function () {
-                var installed = results.match(/Installed platforms:\n {2}(.*)/);
-                expect(installed).toBeDefined();
-                expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
-            });
-        }
+    function emptyPlatformList () {
+        return cordovaPlatform('list').then(function () {
+            var installed = results.match(/Installed platforms:\n {2}(.*)/);
+            expect(installed).toBeDefined();
+            expect(installed[1].indexOf(helpers.testPlatform)).toBe(-1);
+        });
+    }
     /** Test#013 will check the plugin/variable list in package.json and config.xml.
     *   For plugins that are the same, it will merge their variables together for the final list.
     *   Plugins that are unique to that file, will be copied over to the file that is missing it.
     *   Config.xml and pkg.json will have identical plugins and variables after cordova prepare.
     */
-        it('Test#013 : update pkg.json AND config.xml to include all plugins and merge unique variables', function (done) {
-            var cwd = process.cwd();
-            var configXmlPath = path.join(cwd, 'config.xml');
-            var pkgJsonPath = path.join(cwd, 'package.json');
-            cordova_util.requireNoCache(pkgJsonPath);
-            var cfg1 = new ConfigParser(configXmlPath);
-            var configPlugins = cfg1.getPluginIdList();
-            var pkgJson = require(pkgJsonPath);
-            var configPlugin;
-            var configPluginVariables;
-            var pluginsFolderPath13 = path.join(cwd, 'plugins');
+    it('Test#013 : update pkg.json AND config.xml to include all plugins and merge unique variables', function (done) {
+        var cwd = process.cwd();
+        var configXmlPath = path.join(cwd, 'config.xml');
+        var pkgJsonPath = path.join(cwd, 'package.json');
+        cordova_util.requireNoCache(pkgJsonPath);
+        var cfg1 = new ConfigParser(configXmlPath);
+        var configPlugins = cfg1.getPluginIdList();
+        var pkgJson = require(pkgJsonPath);
+        var configPlugin;
+        var configPluginVariables;
+        var pluginsFolderPath13 = path.join(cwd, 'plugins');
 
         // Config.xml has 2 plugins and does not have device plugin yet.
-            expect(Object.keys(configPlugins).length === 2);
-            expect(configPlugins.indexOf('cordova-plugin-device')).toEqual(-1);
-            expect(configPlugins.indexOf('cordova-plugin-camera')).toEqual(0);
-            expect(configPlugins.indexOf('cordova-plugin-splashscreen')).toEqual(1);
+        expect(Object.keys(configPlugins).length === 2);
+        expect(configPlugins.indexOf('cordova-plugin-device')).toEqual(-1);
+        expect(configPlugins.indexOf('cordova-plugin-camera')).toEqual(0);
+        expect(configPlugins.indexOf('cordova-plugin-splashscreen')).toEqual(1);
         // Config.xml camera plugin has var_3,value_3 and splashscreen has 0 variables.
+        for (var i = 0; i < configPlugins.length; i++) {
+            configPlugin = cfg1.getPlugin(configPlugins[i]);
+            configPluginVariables = configPlugin.variables;
+            if (configPlugin.name === 'cordova-plugin-camera') {
+                expect(configPluginVariables).toEqual({ variable_3: 'value_3' });
+            }
+            if (configPlugin.name === 'cordova-plugin-splashscreen') {
+                expect(configPluginVariables).toEqual({});
+            }
+        }
+        // Expect that pkg.json exists with 3 plugins (camera, device, and splashscreen)
+        expect(pkgJson.cordova.plugins).toBeDefined();
+        expect(Object.keys(pkgJson.cordova.plugins).length === 3);
+        expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
+        expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
+        expect(pkgJson.cordova.plugins['cordova-plugin-device']).toBeDefined();
+        // Splashscreen has no variables and camera has var_1 and var_2 and device has var_1, val_1.
+        expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toEqual({});
+        expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toEqual({ variable_1: ' ', variable_2: ' ' });
+        expect(pkgJson.cordova.plugins['cordova-plugin-device']).toEqual({ variable_1: 'value_1' });
+
+        emptyPlatformList().then(function () {
+            // Run cordova prepare.
+            return prepare();
+        }).then(function () {
+            // Delete any previous caches of require(package.json).
+            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            var cfg2 = new ConfigParser(configXmlPath);
+            configPlugins = cfg2.getPluginIdList();
+            // Check to make sure that variables were added as expected.
             for (var i = 0; i < configPlugins.length; i++) {
-                configPlugin = cfg1.getPlugin(configPlugins[i]);
+                configPlugin = cfg2.getPlugin(configPlugins[i]);
                 configPluginVariables = configPlugin.variables;
+                // Config.xml camera variables have been merged, no duplicates.
                 if (configPlugin.name === 'cordova-plugin-camera') {
-                    expect(configPluginVariables).toEqual({ variable_3: 'value_3'});
+                    expect(configPluginVariables).toEqual({ variable_1: ' ',
+                        variable_2: ' ',
+                        variable_3: 'value_3' });
+                }
+                // Expect that device has var1, val1 and splashscreen has 0 var.
+                if (configPlugin.name === 'cordova-plugin-device') {
+                    expect(configPluginVariables).toEqual({ variable_1: 'value_1' });
                 }
                 if (configPlugin.name === 'cordova-plugin-splashscreen') {
                     expect(configPluginVariables).toEqual({});
                 }
             }
-        // Expect

<TRUNCATED>

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


[06/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/platform/check.js
----------------------------------------------------------------------
diff --git a/src/cordova/platform/check.js b/src/cordova/platform/check.js
index 20a13c9..e190f37 100644
--- a/src/cordova/platform/check.js
+++ b/src/cordova/platform/check.js
@@ -36,8 +36,8 @@ function check (hooksRunner, projectRoot) {
     var result = Q.defer();
     var updateCordova = Q.defer();
     superspawn.spawn('npm',
-                     ['--loglevel=silent', '--json', 'outdated', 'cordova-lib'],
-                     {cwd: path.dirname(require.main.filename)}
+        ['--loglevel=silent', '--json', 'outdated', 'cordova-lib'],
+        {cwd: path.dirname(require.main.filename)}
     ).then(function (output) {
         var vers;
         try {
@@ -56,100 +56,96 @@ function check (hooksRunner, projectRoot) {
         updateCordova.resolve();
     });
     require('../cordova').create(scratch)
-    .then(function () {
-        var h = new HooksRunner(scratch);
-        // Acquire the version number of each platform we have installed, and output that too.
-        Q.all(platforms_on_fs.map(function (p) {
-            var d = Q.defer();
-            var d_avail = Q.defer();
-            var d_cur = Q.defer();
-            require('./index').add(h, scratch, [p], {spawnoutput: {stdio: 'ignore'}})
-            .then(function () {
-                // TODO: couldnt we return the promise on the next line, and then
-                // unindent all the promise handlers one level?
-                superspawn.maybeSpawn(path.join(scratch, 'platforms', p, 'cordova', 'version'), [], { chmod: true })
-                .then(function (avail) {
-                    if (!avail) {
-                        /* Platform version script was silent, we can't work with this */
-                        d_avail.resolve('version-empty');
-                    } else {
-                        d_avail.resolve(avail);
-                    }
-                })
-                .catch(function () {
-                    /* Platform version script failed, we can't work with this */
-                    d_avail.resolve('version-failed');
-                });
-            }).catch(function () {
-                /* If a platform doesn't install, then we can't realistically suggest updating */
-                d_avail.resolve('install-failed');
-            });
+        .then(function () {
+            var h = new HooksRunner(scratch);
+            // Acquire the version number of each platform we have installed, and output that too.
+            Q.all(platforms_on_fs.map(function (p) {
+                var d = Q.defer();
+                var d_avail = Q.defer();
+                var d_cur = Q.defer();
+                require('./index').add(h, scratch, [p], {spawnoutput: {stdio: 'ignore'}})
+                    .then(function () {
+                        // TODO: couldnt we return the promise on the next line, and then
+                        // unindent all the promise handlers one level?
+                        superspawn.maybeSpawn(path.join(scratch, 'platforms', p, 'cordova', 'version'), [], { chmod: true })
+                            .then(function (avail) {
+                                if (!avail) {
+                                    /* Platform version script was silent, we can't work with this */
+                                    d_avail.resolve('version-empty');
+                                } else {
+                                    d_avail.resolve(avail);
+                                }
+                            })
+                            .catch(function () {
+                                /* Platform version script failed, we can't work with this */
+                                d_avail.resolve('version-failed');
+                            });
+                    }).catch(function () {
+                        /* If a platform doesn't install, then we can't realistically suggest updating */
+                        d_avail.resolve('install-failed');
+                    });
+
+                superspawn.maybeSpawn(path.join(projectRoot, 'platforms', p, 'cordova', 'version'), [], { chmod: true })
+                    .then(function (v) {
+                        d_cur.resolve(v || '');
+                    }).catch(function () {
+                        d_cur.resolve('broken');
+                    });
 
-            superspawn.maybeSpawn(path.join(projectRoot, 'platforms', p, 'cordova', 'version'), [], { chmod: true })
-            .then(function (v) {
-                d_cur.resolve(v || '');
-            }).catch(function () {
-                d_cur.resolve('broken');
-            });
+                Q.all([d_avail.promise, d_cur.promise]).spread(function (avail, v) {
+                    var m;
+                    var prefix = p + ' @ ' + (v || 'unknown');
+                    switch (avail) {
+                    case 'install-failed':
+                        m = prefix + '; current did not install, and thus its version cannot be determined';
+                        break;
+                    case 'version-failed':
+                        m = prefix + '; current version script failed, and thus its version cannot be determined';
+                        break;
+                    case 'version-empty':
+                        m = prefix + '; current version script failed to return a version, and thus its version cannot be determined';
+                        break;
+                    default:
+                        if (!v || v === 'broken' || semver.gt(avail, v)) {
+                            m = prefix + ' could be updated to: ' + avail;
+                        }
+                    }
+                    if (m) {
+                        platformsText.push(m);
+                    }
+                    d.resolve(m);
+                }).catch(function () {
+                    d.resolve(p + ' ?');
+                }).done();
 
-            Q.all([d_avail.promise, d_cur.promise]).spread(function (avail, v) {
-                var m;
-                var prefix = p + ' @ ' + (v || 'unknown');
-                switch (avail) {
-                case 'install-failed':
-                    m = prefix + '; current did not install, and thus its version cannot be determined';
-                    break;
-                case 'version-failed':
-                    m = prefix + '; current version script failed, and thus its version cannot be determined';
-                    break;
-                case 'version-empty':
-                    m = prefix + '; current version script failed to return a version, and thus its version cannot be determined';
-                    break;
-                default:
-                    if (!v || v === 'broken' || semver.gt(avail, v)) {
-                        m = prefix + ' could be updated to: ' + avail;
+                return d.promise;
+            })).then(function () {
+                var results = '';
+                var resultQ = Q.defer();
+                events._events = listeners;
+                shell.rm('-rf', scratch);
+                updateCordova.promise.then(function (versions) {
+                    var message = '';
+                    if (versions && semver.gt(versions[0], versions[1])) {
+                        message = 'An update of cordova is available: ' + versions[0] + '\n';
                     }
+                    resultQ.promise.then(function (output) {
+                        var results = message + output;
+                        events.emit('results', results);
+                        result.resolve();
+                    });
+                });
+                if (platformsText) {
+                    results = platformsText.filter(function (p) { return !!p; }).sort().join('\n');
                 }
-                if (m) {
-                    platformsText.push(m);
+                if (!results) {
+                    results = 'No platforms can be updated at this time.';
                 }
-                d.resolve(m);
-            })
-            .catch(function () {
-                d.resolve(p + ' ?');
-            })
-            .done();
-
-            return d.promise;
-        })).then(function () {
-            var results = '';
-            var resultQ = Q.defer();
+                resultQ.resolve(results);
+            }).done();
+        }).catch(function () {
             events._events = listeners;
             shell.rm('-rf', scratch);
-            updateCordova.promise.then(function (versions) {
-                var message = '';
-                if (versions && semver.gt(versions[0], versions[1])) {
-                    message = 'An update of cordova is available: ' + versions[0] + '\n';
-                }
-                resultQ.promise.then(function (output) {
-                    var results = message + output;
-                    events.emit('results', results);
-                    result.resolve();
-                });
-            });
-            if (platformsText) {
-                results = platformsText.filter(function (p) { return !!p; }).sort().join('\n');
-            }
-            if (!results) {
-                results = 'No platforms can be updated at this time.';
-            }
-            resultQ.resolve(results);
-        })
-        .done();
-    }).catch(function () {
-        events._events = listeners;
-        shell.rm('-rf', scratch);
-    })
-    .done();
+        }).done();
     return result.promise;
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/platform/list.js
----------------------------------------------------------------------
diff --git a/src/cordova/platform/list.js b/src/cordova/platform/list.js
index d7c2d4e..edd7d6c 100644
--- a/src/cordova/platform/list.js
+++ b/src/cordova/platform/list.js
@@ -24,33 +24,33 @@ module.exports.addDeprecatedInformationToPlatforms = addDeprecatedInformationToP
 
 function list (hooksRunner, projectRoot, opts) {
     return hooksRunner.fire('before_platform_ls', opts)
-    .then(function () {
-        return cordova_util.getInstalledPlatformsWithVersions(projectRoot);
-    }).then(function (platformMap) {
-        var platformsText = [];
-        for (var plat in platformMap) {
-            platformsText.push(platformMap[plat] ? plat + ' ' + platformMap[plat] : plat);
-        }
+        .then(function () {
+            return cordova_util.getInstalledPlatformsWithVersions(projectRoot);
+        }).then(function (platformMap) {
+            var platformsText = [];
+            for (var plat in platformMap) {
+                platformsText.push(platformMap[plat] ? plat + ' ' + platformMap[plat] : plat);
+            }
 
-        platformsText = addDeprecatedInformationToPlatforms(platformsText);
-        var results = 'Installed platforms:\n  ' + platformsText.sort().join('\n  ') + '\n';
-        var available = Object.keys(platforms).filter(cordova_util.hostSupports);
+            platformsText = addDeprecatedInformationToPlatforms(platformsText);
+            var results = 'Installed platforms:\n  ' + platformsText.sort().join('\n  ') + '\n';
+            var available = Object.keys(platforms).filter(cordova_util.hostSupports);
 
-        available = available.filter(function (p) {
-            return !platformMap[p]; // Only those not already installed.
-        });
+            available = available.filter(function (p) {
+                return !platformMap[p]; // Only those not already installed.
+            });
 
-        available = available.map(function (p) {
-            return p.concat(' ', platforms[p].version);
-        });
+            available = available.map(function (p) {
+                return p.concat(' ', platforms[p].version);
+            });
 
-        available = addDeprecatedInformationToPlatforms(available);
-        results += 'Available platforms: \n  ' + available.sort().join('\n  ');
+            available = addDeprecatedInformationToPlatforms(available);
+            results += 'Available platforms: \n  ' + available.sort().join('\n  ');
 
-        events.emit('results', results);
-    }).then(function () {
-        return hooksRunner.fire('after_platform_ls', opts);
-    });
+            events.emit('results', results);
+        }).then(function () {
+            return hooksRunner.fire('after_platform_ls', opts);
+        });
 }
 
 function addDeprecatedInformationToPlatforms (platformsList) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/platform/remove.js
----------------------------------------------------------------------
diff --git a/src/cordova/platform/remove.js b/src/cordova/platform/remove.js
index 1e5bf54..cf7cc41 100644
--- a/src/cordova/platform/remove.js
+++ b/src/cordova/platform/remove.js
@@ -36,63 +36,63 @@ function remove (hooksRunner, projectRoot, targets, opts) {
         return Q.reject(new CordovaError('No platform(s) specified. Please specify platform(s) to remove. See `' + cordova_util.binname + ' platform list`.'));
     }
     return hooksRunner.fire('before_platform_rm', opts)
-    .then(function () {
-        targets.forEach(function (target) {
-            shell.rm('-rf', path.join(projectRoot, 'platforms', target));
-            cordova_util.removePlatformPluginsJson(projectRoot, target);
-        });
-    }).then(function () {
-        var config_json = config.read(projectRoot);
-        var autosave = config_json.auto_save_platforms || false;
-        var modifiedPkgJson = false;
-        var pkgJson;
-        var pkgJsonPath = path.join(projectRoot, 'package.json');
-        // If statement to see if pkgJsonPath exists in the filesystem
-        if (fs.existsSync(pkgJsonPath)) {
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-        }
-        if (opts.save || autosave) {
+        .then(function () {
             targets.forEach(function (target) {
-                var platformName = target.split('@')[0];
-                var xml = cordova_util.projectConfig(projectRoot);
-                var cfg = new ConfigParser(xml);
-                events.emit('log', 'Removing platform ' + target + ' from config.xml file...');
-                cfg.removeEngine(platformName);
-                cfg.write();
-                // If package.json exists and contains a specified platform in cordova.platforms, it will be removed.
-                if (pkgJson !== undefined && pkgJson.cordova !== undefined && pkgJson.cordova.platforms !== undefined) {
-                    var index = pkgJson.cordova.platforms.indexOf(platformName);
-                    // Check if platform exists in platforms array.
-                    if (pkgJson.cordova.platforms !== undefined && index > -1) {
-                        events.emit('log', 'Removing ' + platformName + ' from cordova.platforms array in package.json');
-                        pkgJson.cordova.platforms.splice(index, 1);
-                        modifiedPkgJson = true;
+                shell.rm('-rf', path.join(projectRoot, 'platforms', target));
+                cordova_util.removePlatformPluginsJson(projectRoot, target);
+            });
+        }).then(function () {
+            var config_json = config.read(projectRoot);
+            var autosave = config_json.auto_save_platforms || false;
+            var modifiedPkgJson = false;
+            var pkgJson;
+            var pkgJsonPath = path.join(projectRoot, 'package.json');
+            // If statement to see if pkgJsonPath exists in the filesystem
+            if (fs.existsSync(pkgJsonPath)) {
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+            }
+            if (opts.save || autosave) {
+                targets.forEach(function (target) {
+                    var platformName = target.split('@')[0];
+                    var xml = cordova_util.projectConfig(projectRoot);
+                    var cfg = new ConfigParser(xml);
+                    events.emit('log', 'Removing platform ' + target + ' from config.xml file...');
+                    cfg.removeEngine(platformName);
+                    cfg.write();
+                    // If package.json exists and contains a specified platform in cordova.platforms, it will be removed.
+                    if (pkgJson !== undefined && pkgJson.cordova !== undefined && pkgJson.cordova.platforms !== undefined) {
+                        var index = pkgJson.cordova.platforms.indexOf(platformName);
+                        // Check if platform exists in platforms array.
+                        if (pkgJson.cordova.platforms !== undefined && index > -1) {
+                            events.emit('log', 'Removing ' + platformName + ' from cordova.platforms array in package.json');
+                            pkgJson.cordova.platforms.splice(index, 1);
+                            modifiedPkgJson = true;
+                        }
                     }
+                });
+                // Write out new package.json if changes have been made.
+                if (modifiedPkgJson === true) {
+                    fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2), 'utf8');
                 }
+            }
+        }).then(function () {
+            // Remove targets from platforms.json.
+            targets.forEach(function (target) {
+                events.emit('verbose', 'Removing platform ' + target + ' from platforms.json file...');
+                platformMetadata.remove(projectRoot, target);
             });
-            // Write out new package.json if changes have been made.
-            if (modifiedPkgJson === true) {
-                fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2), 'utf8');
+        }).then(function () {
+            // Remove from node_modules if it exists and --fetch was used.
+            if (opts.fetch) {
+                return promiseutil.Q_chainmap(targets, function (target) {
+                    if (target in platforms) {
+                        target = 'cordova-' + target;
+                    }
+                    // Edits package.json.
+                    return npmUninstall(target, projectRoot, opts);
+                });
             }
-        }
-    }).then(function () {
-        // Remove targets from platforms.json.
-        targets.forEach(function (target) {
-            events.emit('verbose', 'Removing platform ' + target + ' from platforms.json file...');
-            platformMetadata.remove(projectRoot, target);
+        }).then(function () {
+            return hooksRunner.fire('after_platform_rm', opts);
         });
-    }).then(function () {
-        // Remove from node_modules if it exists and --fetch was used.
-        if (opts.fetch) {
-            return promiseutil.Q_chainmap(targets, function (target) {
-                if (target in platforms) {
-                    target = 'cordova-' + target;
-                }
-                // Edits package.json.
-                return npmUninstall(target, projectRoot, opts);
-            });
-        }
-    }).then(function () {
-        return hooksRunner.fire('after_platform_rm', opts);
-    });
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/platform_metadata.js
----------------------------------------------------------------------
diff --git a/src/cordova/platform_metadata.js b/src/cordova/platform_metadata.js
index bf9682e..4dc101d 100644
--- a/src/cordova/platform_metadata.js
+++ b/src/cordova/platform_metadata.js
@@ -17,47 +17,45 @@
     under the License.
 */
 
+var path = require('path');
+var cordova_util = require('./util');
+var fs = require('fs');
+var Q = require('q');
+var child_process = require('child_process');
 
-var path         = require('path'),
-    cordova_util = require('./util'),
-    fs           = require('fs'),
-    Q            = require('q'),
-    child_process = require('child_process');
-
-
-function getJson(jsonFile) {
+function getJson (jsonFile) {
     return JSON.parse(fs.readFileSync(jsonFile, 'utf-8'));
 }
 
 // Retrieves the platforms and their versions from the platforms.json file
 // Returns an array of {platform: platform, version: version} ...
 // ... where version could be '3.4.0', '/path/to/platform' or 'git://...'
-function getVersions(projectRoot) {
+function getVersions (projectRoot) {
     var platformsDir = path.join(projectRoot, 'platforms');
     var platformsJsonFile = path.join(platformsDir, 'platforms.json');
 
     // If the platforms.json file doesn't exist, retrieve versions from platforms installed on the filesystem...
     // ...Note that in this case, we won't be able to know what source(folder, git-url) the platform came from, we'll just use versions
-    return getPlatVersionsFromFile(platformsJsonFile).fail(function(){
+    return getPlatVersionsFromFile(platformsJsonFile).fail(function () {
         return getPlatVersionsFromFileSystem(projectRoot);
     });
 }
 
 // Returns a promise
-function getPlatVersionsFromFile(platformsJsonFile){
+function getPlatVersionsFromFile (platformsJsonFile) {
 
     var platformData;
 
     // Handle 'file not found' exception and stay within the 'promise monad'
-    try{
+    try {
         platformData = getJson(platformsJsonFile);
-    } catch(e) {
+    } catch (e) {
         return Q.reject(e);
     }
 
     var platformVersions = [];
 
-    platformVersions = Object.keys(platformData).map(function(p){
+    platformVersions = Object.keys(platformData).map(function (p) {
         return {platform: p, version: platformData[p]};
     });
 
@@ -65,11 +63,11 @@ function getPlatVersionsFromFile(platformsJsonFile){
 }
 
 // Returns a promise
-function getPlatVersionsFromFileSystem(projectRoot){
+function getPlatVersionsFromFileSystem (projectRoot) {
     var platforms_on_fs = cordova_util.listPlatforms(projectRoot);
-    var platformVersions = platforms_on_fs.map(function(platform){
+    var platformVersions = platforms_on_fs.map(function (platform) {
         var script = path.join(projectRoot, 'platforms', platform, 'cordova', 'version');
-        return Q.ninvoke(child_process, 'exec', script, {}).then(function(result){
+        return Q.ninvoke(child_process, 'exec', script, {}).then(function (result) {
             var version = result[0];
 
             // clean the version we get back from the script
@@ -85,22 +83,22 @@ function getPlatVersionsFromFileSystem(projectRoot){
 }
 
 // Saves platform@version into platforms.json
-function save(projectRoot, platform, version) {
+function save (projectRoot, platform, version) {
     var platformsDir = path.join(projectRoot, 'platforms');
     var platformJsonFile = path.join(platformsDir, 'platforms.json');
 
     var data = {};
-    if(fs.existsSync(platformJsonFile)){
+    if (fs.existsSync(platformJsonFile)) {
         data = getJson(platformJsonFile);
     }
     data[platform] = version;
     fs.writeFileSync(platformJsonFile, JSON.stringify(data, null, 2), 'utf-8');
 }
 
-function remove(projectRoot, platform){
+function remove (projectRoot, platform) {
     var platformsDir = path.join(projectRoot, 'platforms');
     var platformJsonFile = path.join(platformsDir, 'platforms.json');
-    if(!fs.existsSync(platformJsonFile)){
+    if (!fs.existsSync(platformJsonFile)) {
         return;
     }
     var data = getJson(platformJsonFile);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/plugin/add.js
----------------------------------------------------------------------
diff --git a/src/cordova/plugin/add.js b/src/cordova/plugin/add.js
index 4e975d3..203cf09 100644
--- a/src/cordova/plugin/add.js
+++ b/src/cordova/plugin/add.js
@@ -70,157 +70,156 @@ function add (projectRoot, hooksRunner, opts) {
 
     opts.cordova = { plugins: cordova_util.findPlugins(pluginPath) };
     return hooksRunner.fire('before_plugin_add', opts)
-    .then(function () {
-        var pluginInfoProvider = new PluginInfoProvider();
-        return opts.plugins.reduce(function (soFar, target) {
-            return soFar.then(function () {
-                if (target[target.length - 1] === path.sep) {
-                    target = target.substring(0, target.length - 1);
-                }
-
-                // Fetch the plugin first.
-                var fetchOptions = {
-                    searchpath: searchPath,
-                    noregistry: opts.noregistry,
-                    fetch: opts.fetch || false,
-                    save: opts.save,
-                    nohooks: opts.nohooks,
-                    link: opts.link,
-                    pluginInfoProvider: pluginInfoProvider,
-                    variables: opts.cli_variables,
-                    is_top_level: true
-                };
-
-                return module.exports.determinePluginTarget(projectRoot, cfg, target, fetchOptions).then(function (resolvedTarget) {
-                    target = resolvedTarget;
-                    events.emit('verbose', 'Calling plugman.fetch on plugin "' + target + '"');
-                    return plugman.fetch(target, pluginPath, fetchOptions);
-                });
-            }).then(function (directory) {
-                return pluginInfoProvider.get(directory);
-            }).then(function (pluginInfo) {
-                // Validate top-level required variables
-                var pluginVariables = pluginInfo.getPreferences();
-                opts.cli_variables = opts.cli_variables || {};
-                var pluginEntry = cfg.getPlugin(pluginInfo.id);
-                // Get variables from config.xml
-                var configVariables = pluginEntry ? pluginEntry.variables : {};
-                // Add config variable if it's missing in cli_variables
-                Object.keys(configVariables).forEach(function (variable) {
-                    opts.cli_variables[variable] = opts.cli_variables[variable] || configVariables[variable];
-                });
-                var missingVariables = Object.keys(pluginVariables)
-                .filter(function (variableName) {
-                    // discard variables with default value
-                    return !(pluginVariables[variableName] || opts.cli_variables[variableName]);
-                });
-
-                if (missingVariables.length) {
-                    events.emit('verbose', 'Removing ' + pluginInfo.dir + ' because mandatory plugin variables were missing.');
-                    shell.rm('-rf', pluginInfo.dir);
-                    var msg = 'Variable(s) missing (use: --variable ' + missingVariables.join('=value --variable ') + '=value).';
-                    return Q.reject(new CordovaError(msg));
-                }
+        .then(function () {
+            var pluginInfoProvider = new PluginInfoProvider();
+            return opts.plugins.reduce(function (soFar, target) {
+                return soFar.then(function () {
+                    if (target[target.length - 1] === path.sep) {
+                        target = target.substring(0, target.length - 1);
+                    }
 
-                // Iterate (in serial!) over all platforms in the project and install the plugin.
-                return chainMap(platformList, function (platform) {
-                    var platformRoot = path.join(projectRoot, 'platforms', platform);
-                    var options = {
-                        cli_variables: opts.cli_variables || {},
-                        browserify: opts.browserify || false,
-                        fetch: opts.fetch || false,
-                        save: opts.save,
+                    // Fetch the plugin first.
+                    var fetchOptions = {
                         searchpath: searchPath,
                         noregistry: opts.noregistry,
+                        fetch: opts.fetch || false,
+                        save: opts.save,
+                        nohooks: opts.nohooks,
                         link: opts.link,
                         pluginInfoProvider: pluginInfoProvider,
-                        // Set up platform to install asset files/js modules to <platform>/platform_www dir
-                        // instead of <platform>/www. This is required since on each prepare platform's www dir is changed
-                        // and files from 'platform_www' merged into 'www'. Thus we need to persist these
-                        // files platform_www directory, so they'll be applied to www on each prepare.
-                        usePlatformWww: true,
-                        nohooks: opts.nohooks,
-                        force: opts.force
+                        variables: opts.cli_variables,
+                        is_top_level: true
                     };
 
-                    events.emit('verbose', 'Calling plugman.install on plugin "' + pluginInfo.dir + '" for platform "' + platform);
-                    return plugman.install(platform, platformRoot, path.basename(pluginInfo.dir), pluginPath, options)
-                    .then(function (didPrepare) {
-                        // If platform does not returned anything we'll need
-                        // to trigger a prepare after all plugins installed
-                        if (!didPrepare) shouldRunPrepare = true;
+                    return module.exports.determinePluginTarget(projectRoot, cfg, target, fetchOptions).then(function (resolvedTarget) {
+                        target = resolvedTarget;
+                        events.emit('verbose', 'Calling plugman.fetch on plugin "' + target + '"');
+                        return plugman.fetch(target, pluginPath, fetchOptions);
                     });
-                })
-                .thenResolve(pluginInfo);
-            })
-            .then(function (pluginInfo) {
-                var pkgJson;
-                var pkgJsonPath = path.join(projectRoot, 'package.json');
-
-                // save to config.xml
-                if (plugin_util.saveToConfigXmlOn(config_json, opts)) {
-                    // If statement to see if pkgJsonPath exists in the filesystem
-                    if (fs.existsSync(pkgJsonPath)) {
-                        // Delete any previous caches of require(package.json)
-                        pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-                    }
-                    // If package.json exists, the plugin object and plugin name
-                    // will be added to package.json if not already there.
-                    if (pkgJson) {
-                        pkgJson.cordova = pkgJson.cordova || {};
-                        pkgJson.cordova.plugins = pkgJson.cordova.plugins || {};
-                        // Plugin and variables are added.
-                        pkgJson.cordova.plugins[pluginInfo.id] = opts.cli_variables;
-                        events.emit('log', 'Adding ' + pluginInfo.id + ' to package.json');
-
-                        // Write to package.json
-                        fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2), 'utf8');
+                }).then(function (directory) {
+                    return pluginInfoProvider.get(directory);
+                }).then(function (pluginInfo) {
+                    // Validate top-level required variables
+                    var pluginVariables = pluginInfo.getPreferences();
+                    opts.cli_variables = opts.cli_variables || {};
+                    var pluginEntry = cfg.getPlugin(pluginInfo.id);
+                    // Get variables from config.xml
+                    var configVariables = pluginEntry ? pluginEntry.variables : {};
+                    // Add config variable if it's missing in cli_variables
+                    Object.keys(configVariables).forEach(function (variable) {
+                        opts.cli_variables[variable] = opts.cli_variables[variable] || configVariables[variable];
+                    });
+                    var missingVariables = Object.keys(pluginVariables)
+                        .filter(function (variableName) {
+                            // discard variables with default value
+                            return !(pluginVariables[variableName] || opts.cli_variables[variableName]);
+                        });
+
+                    if (missingVariables.length) {
+                        events.emit('verbose', 'Removing ' + pluginInfo.dir + ' because mandatory plugin variables were missing.');
+                        shell.rm('-rf', pluginInfo.dir);
+                        var msg = 'Variable(s) missing (use: --variable ' + missingVariables.join('=value --variable ') + '=value).';
+                        return Q.reject(new CordovaError(msg));
                     }
 
-                    var src = module.exports.parseSource(target, opts);
-                    var attributes = {
-                        name: pluginInfo.id
-                    };
+                    // Iterate (in serial!) over all platforms in the project and install the plugin.
+                    return chainMap(platformList, function (platform) {
+                        var platformRoot = path.join(projectRoot, 'platforms', platform);
+                        var options = {
+                            cli_variables: opts.cli_variables || {},
+                            browserify: opts.browserify || false,
+                            fetch: opts.fetch || false,
+                            save: opts.save,
+                            searchpath: searchPath,
+                            noregistry: opts.noregistry,
+                            link: opts.link,
+                            pluginInfoProvider: pluginInfoProvider,
+                            // Set up platform to install asset files/js modules to <platform>/platform_www dir
+                            // instead of <platform>/www. This is required since on each prepare platform's www dir is changed
+                            // and files from 'platform_www' merged into 'www'. Thus we need to persist these
+                            // files platform_www directory, so they'll be applied to www on each prepare.
+                            usePlatformWww: true,
+                            nohooks: opts.nohooks,
+                            force: opts.force
+                        };
+
+                        events.emit('verbose', 'Calling plugman.install on plugin "' + pluginInfo.dir + '" for platform "' + platform);
+                        return plugman.install(platform, platformRoot, path.basename(pluginInfo.dir), pluginPath, options)
+                            .then(function (didPrepare) {
+                                // If platform does not returned anything we'll need
+                                // to trigger a prepare after all plugins installed
+                                if (!didPrepare) shouldRunPrepare = true;
+                            });
+                    })
+                        .thenResolve(pluginInfo);
+                }).then(function (pluginInfo) {
+                    var pkgJson;
+                    var pkgJsonPath = path.join(projectRoot, 'package.json');
+
+                    // save to config.xml
+                    if (plugin_util.saveToConfigXmlOn(config_json, opts)) {
+                        // If statement to see if pkgJsonPath exists in the filesystem
+                        if (fs.existsSync(pkgJsonPath)) {
+                            // Delete any previous caches of require(package.json)
+                            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                        }
+                        // If package.json exists, the plugin object and plugin name
+                        // will be added to package.json if not already there.
+                        if (pkgJson) {
+                            pkgJson.cordova = pkgJson.cordova || {};
+                            pkgJson.cordova.plugins = pkgJson.cordova.plugins || {};
+                            // Plugin and variables are added.
+                            pkgJson.cordova.plugins[pluginInfo.id] = opts.cli_variables;
+                            events.emit('log', 'Adding ' + pluginInfo.id + ' to package.json');
+
+                            // Write to package.json
+                            fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2), 'utf8');
+                        }
 
-                    if (src) {
-                        attributes.spec = src;
-                    } else {
-                        var ver = '~' + pluginInfo.version;
-                        // Scoped packages need to have the package-spec along with the version
-                        var parsedSpec = pluginSpec.parse(target);
-                        if (pkgJson && pkgJson.dependencies && pkgJson.dependencies[pluginInfo.id]) {
-                            attributes.spec = pkgJson.dependencies[pluginInfo.id];
+                        var src = module.exports.parseSource(target, opts);
+                        var attributes = {
+                            name: pluginInfo.id
+                        };
+
+                        if (src) {
+                            attributes.spec = src;
                         } else {
-                            if (parsedSpec.scope) {
-                                attributes.spec = parsedSpec.package + '@' + ver;
+                            var ver = '~' + pluginInfo.version;
+                            // Scoped packages need to have the package-spec along with the version
+                            var parsedSpec = pluginSpec.parse(target);
+                            if (pkgJson && pkgJson.dependencies && pkgJson.dependencies[pluginInfo.id]) {
+                                attributes.spec = pkgJson.dependencies[pluginInfo.id];
                             } else {
-                                attributes.spec = ver;
+                                if (parsedSpec.scope) {
+                                    attributes.spec = parsedSpec.package + '@' + ver;
+                                } else {
+                                    attributes.spec = ver;
+                                }
                             }
                         }
-                    }
-                    xml = cordova_util.projectConfig(projectRoot);
-                    cfg = new ConfigParser(xml);
-                    cfg.removePlugin(pluginInfo.id);
-                    cfg.addPlugin(attributes, opts.cli_variables);
-                    cfg.write();
+                        xml = cordova_util.projectConfig(projectRoot);
+                        cfg = new ConfigParser(xml);
+                        cfg.removePlugin(pluginInfo.id);
+                        cfg.addPlugin(attributes, opts.cli_variables);
+                        cfg.write();
 
-                    events.emit('results', 'Saved plugin info for "' + pluginInfo.id + '" to config.xml');
-                }
-            });
-        }, Q());
-    }).then(function () {
-        // CB-11022 We do not need to run prepare after plugin install until shouldRunPrepare flag is set to true
-        if (!shouldRunPrepare) {
-            return Q();
-        }
-        // Need to require right here instead of doing this at the beginning of file
-        // otherwise tests are failing without any real reason.
-        // TODO: possible circular dependency?
-        return require('../prepare').preparePlatforms(platformList, projectRoot, opts);
-    }).then(function () {
-        opts.cordova = { plugins: cordova_util.findPlugins(pluginPath) };
-        return hooksRunner.fire('after_plugin_add', opts);
-    });
+                        events.emit('results', 'Saved plugin info for "' + pluginInfo.id + '" to config.xml');
+                    }
+                });
+            }, Q());
+        }).then(function () {
+            // CB-11022 We do not need to run prepare after plugin install until shouldRunPrepare flag is set to true
+            if (!shouldRunPrepare) {
+                return Q();
+            }
+            // Need to require right here instead of doing this at the beginning of file
+            // otherwise tests are failing without any real reason.
+            // TODO: possible circular dependency?
+            return require('../prepare').preparePlatforms(platformList, projectRoot, opts);
+        }).then(function () {
+            opts.cordova = { plugins: cordova_util.findPlugins(pluginPath) };
+            return hooksRunner.fire('after_plugin_add', opts);
+        });
 }
 
 function determinePluginTarget (projectRoot, cfg, target, fetchOptions) {
@@ -299,12 +298,12 @@ function determinePluginTarget (projectRoot, cfg, target, fetchOptions) {
 
     // TODO: whoa wat
     return (shouldUseNpmInfo ? registry.info([id])
-    .then(function (pluginInfo) {
-        return module.exports.getFetchVersion(projectRoot, pluginInfo, cordovaVersion);
-    }) : Q(null))
-    .then(function (fetchVersion) {
-        return fetchVersion ? (id + '@' + fetchVersion) : target;
-    });
+        .then(function (pluginInfo) {
+            return module.exports.getFetchVersion(projectRoot, pluginInfo, cordovaVersion);
+        }) : Q(null))
+        .then(function (fetchVersion) {
+            return fetchVersion ? (id + '@' + fetchVersion) : target;
+        });
 }
 
 function parseSource (target, opts) {
@@ -359,13 +358,13 @@ function getFetchVersion (projectRoot, pluginInfo, cordovaVersion) {
         });
 
         return cordova_util.getInstalledPlatformsWithVersions(projectRoot)
-        .then(function (platformVersions) {
-            return module.exports.determinePluginVersionToFetch(
-                pluginInfo,
-                pluginMap,
-                platformVersions,
-                cordovaVersion);
-        });
+            .then(function (platformVersions) {
+                return module.exports.determinePluginVersionToFetch(
+                    pluginInfo,
+                    pluginMap,
+                    platformVersions,
+                    cordovaVersion);
+            });
     } else {
         // If we have no engine, we want to fall back to the default behavior
         events.emit('verbose', 'npm info for ' + pluginInfo.name + ' did not contain any engine info. Fetching latest release');

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/plugin/list.js
----------------------------------------------------------------------
diff --git a/src/cordova/plugin/list.js b/src/cordova/plugin/list.js
index 78d9521..ab634e0 100644
--- a/src/cordova/plugin/list.js
+++ b/src/cordova/plugin/list.js
@@ -27,49 +27,49 @@ module.exports = list;
 function list (projectRoot, hooksRunner, opts) {
     var pluginsList = [];
     return hooksRunner.fire('before_plugin_ls', opts)
-    .then(function () {
-        return plugin_util.getInstalledPlugins(projectRoot);
-    }).then(function (plugins) {
-        if (plugins.length === 0) {
-            events.emit('results', 'No plugins added. Use `' + cordova_util.binname + ' plugin add <plugin>`.');
-            return;
-        }
-        var pluginsDict = {};
-        var lines = [];
-        var txt, p;
-        for (var i = 0; i < plugins.length; i++) {
-            p = plugins[i];
-            pluginsDict[p.id] = p;
-            pluginsList.push(p.id);
-            txt = p.id + ' ' + p.version + ' "' + (p.name || p.description) + '"';
-            lines.push(txt);
-        }
-        // Add warnings for deps with wrong versions.
-        for (var id in pluginsDict) {
-            p = pluginsDict[id];
-            for (var depId in p.deps) {
-                var dep = pluginsDict[depId];
-                // events.emit('results', p.deps[depId].version);
-                // events.emit('results', dep != null);
-                if (!dep) {
-                    txt = 'WARNING, missing dependency: plugin ' + id +
-                          ' depends on ' + depId +
-                          ' but it is not installed';
-                    lines.push(txt);
-                } else if (!semver.satisfies(dep.version, p.deps[depId].version)) {
-                    txt = 'WARNING, broken dependency: plugin ' + id +
-                          ' depends on ' + depId + ' ' + p.deps[depId].version +
-                          ' but installed version is ' + dep.version;
-                    lines.push(txt);
+        .then(function () {
+            return plugin_util.getInstalledPlugins(projectRoot);
+        }).then(function (plugins) {
+            if (plugins.length === 0) {
+                events.emit('results', 'No plugins added. Use `' + cordova_util.binname + ' plugin add <plugin>`.');
+                return;
+            }
+            var pluginsDict = {};
+            var lines = [];
+            var txt, p;
+            for (var i = 0; i < plugins.length; i++) {
+                p = plugins[i];
+                pluginsDict[p.id] = p;
+                pluginsList.push(p.id);
+                txt = p.id + ' ' + p.version + ' "' + (p.name || p.description) + '"';
+                lines.push(txt);
+            }
+            // Add warnings for deps with wrong versions.
+            for (var id in pluginsDict) {
+                p = pluginsDict[id];
+                for (var depId in p.deps) {
+                    var dep = pluginsDict[depId];
+                    // events.emit('results', p.deps[depId].version);
+                    // events.emit('results', dep != null);
+                    if (!dep) {
+                        txt = 'WARNING, missing dependency: plugin ' + id +
+                              ' depends on ' + depId +
+                              ' but it is not installed';
+                        lines.push(txt);
+                    } else if (!semver.satisfies(dep.version, p.deps[depId].version)) {
+                        txt = 'WARNING, broken dependency: plugin ' + id +
+                              ' depends on ' + depId + ' ' + p.deps[depId].version +
+                              ' but installed version is ' + dep.version;
+                        lines.push(txt);
+                    }
                 }
             }
-        }
-        events.emit('results', lines.join('\n'));
-    })
-    .then(function () {
-        return hooksRunner.fire('after_plugin_ls', opts);
-    })
-    .then(function () {
-        return pluginsList;
-    });
+            events.emit('results', lines.join('\n'));
+        })
+        .then(function () {
+            return hooksRunner.fire('after_plugin_ls', opts);
+        })
+        .then(function () {
+            return pluginsList;
+        });
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/plugin/plugin_spec_parser.js
----------------------------------------------------------------------
diff --git a/src/cordova/plugin/plugin_spec_parser.js b/src/cordova/plugin/plugin_spec_parser.js
index 7ad1bae..3d41248 100644
--- a/src/cordova/plugin/plugin_spec_parser.js
+++ b/src/cordova/plugin/plugin_spec_parser.js
@@ -18,7 +18,7 @@
 */
 
 // npm packages follow the pattern of (@scope/)?package(@spec)? where scope and tag are optional
-var NPM_SPEC_REGEX = /^(@[^\/]+\/)?([^@\/]+)(?:@(.+))?$/;
+var NPM_SPEC_REGEX = /^(@[^\/]+\/)?([^@\/]+)(?:@(.+))?$/; // eslint-disable-line no-useless-escape
 
 module.exports.parse = parse;
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/plugin/remove.js
----------------------------------------------------------------------
diff --git a/src/cordova/plugin/remove.js b/src/cordova/plugin/remove.js
index 01de6fb..6cbd930 100644
--- a/src/cordova/plugin/remove.js
+++ b/src/cordova/plugin/remove.js
@@ -44,79 +44,79 @@ function remove (projectRoot, targets, hooksRunner, opts) {
 
     opts.cordova = { plugins: cordova_util.findPlugins(pluginPath) };
     return hooksRunner.fire('before_plugin_rm', opts)
-    .then(function () {
-        return opts.plugins.reduce(function (soFar, target) {
-            var validatedPluginId = module.exports.validatePluginId(target, plugins);
-            if (!validatedPluginId) {
-                return Q.reject(new CordovaError('Plugin "' + target + '" is not present in the project. See `' + cordova_util.binname + ' plugin list`.'));
-            }
-            target = validatedPluginId;
+        .then(function () {
+            return opts.plugins.reduce(function (soFar, target) {
+                var validatedPluginId = module.exports.validatePluginId(target, plugins);
+                if (!validatedPluginId) {
+                    return Q.reject(new CordovaError('Plugin "' + target + '" is not present in the project. See `' + cordova_util.binname + ' plugin list`.'));
+                }
+                target = validatedPluginId;
 
-            // Iterate over all installed platforms and uninstall.
-            // If this is a web-only or dependency-only plugin, then
-            // there may be nothing to do here except remove the
-            // reference from the platform's plugin config JSON.
-            return platformList.reduce(function (soFar, platform) {
-                return soFar.then(function () {
-                    var platformRoot = path.join(projectRoot, 'platforms', platform);
-                    events.emit('verbose', 'Calling plugman.uninstall on plugin "' + target + '" for platform "' + platform + '"');
-                    var options = {
-                        force: opts.force || false
-                    };
-                    return plugman.uninstall.uninstallPlatform(platform, platformRoot, target, pluginPath, options)
-                    .then(function (didPrepare) {
-                        // If platform does not returned anything we'll need
-                        // to trigger a prepare after all plugins installed
-                        // TODO: if didPrepare is falsy, what does that imply? WHY are we doing this?
-                        if (!didPrepare) shouldRunPrepare = true;
+                // Iterate over all installed platforms and uninstall.
+                // If this is a web-only or dependency-only plugin, then
+                // there may be nothing to do here except remove the
+                // reference from the platform's plugin config JSON.
+                return platformList.reduce(function (soFar, platform) {
+                    return soFar.then(function () {
+                        var platformRoot = path.join(projectRoot, 'platforms', platform);
+                        events.emit('verbose', 'Calling plugman.uninstall on plugin "' + target + '" for platform "' + platform + '"');
+                        var options = {
+                            force: opts.force || false
+                        };
+                        return plugman.uninstall.uninstallPlatform(platform, platformRoot, target, pluginPath, options)
+                            .then(function (didPrepare) {
+                                // If platform does not returned anything we'll need
+                                // to trigger a prepare after all plugins installed
+                                // TODO: if didPrepare is falsy, what does that imply? WHY are we doing this?
+                                if (!didPrepare) shouldRunPrepare = true;
+                            });
                     });
-                });
-            }, Q())
-            .then(function () {
-                // TODO: Should only uninstallPlugin when no platforms have it.
-                return plugman.uninstall.uninstallPlugin(target, pluginPath, opts);
-            }).then(function () {
-                // remove plugin from config.xml
-                if (plugin_util.saveToConfigXmlOn(config_json, opts)) {
-                    events.emit('log', 'Removing plugin ' + target + ' from config.xml file...');
-                    var configPath = cordova_util.projectConfig(projectRoot);
-                    if (fs.existsSync(configPath)) { // should not happen with real life but needed for tests
-                        var configXml = new ConfigParser(configPath);
-                        configXml.removePlugin(target);
-                        configXml.write();
-                    }
-                    var pkgJson;
-                    var pkgJsonPath = path.join(projectRoot, 'package.json');
-                    // If statement to see if pkgJsonPath exists in the filesystem
-                    if (fs.existsSync(pkgJsonPath)) {
-                        // delete any previous caches of require(package.json)
-                        pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-                    }
-                    // If package.json exists and contains a specified plugin in cordova['plugins'], it will be removed
-                    if (pkgJson !== undefined && pkgJson.cordova !== undefined && pkgJson.cordova.plugins !== undefined) {
-                        events.emit('log', 'Removing ' + target + ' from package.json');
-                        // Remove plugin from package.json
-                        delete pkgJson.cordova.plugins[target];
-                        // Write out new package.json with plugin removed correctly.
-                        fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2), 'utf8');
-                    }
-                }
-            }).then(function () {
-                // Remove plugin from fetch.json
-                events.emit('verbose', 'Removing plugin ' + target + ' from fetch.json');
-                metadata.remove_fetch_metadata(pluginPath, target);
-            });
-        }, Q());
-    }).then(function () {
-        // CB-11022 We do not need to run prepare after plugin install until shouldRunPrepare flag is set to true
-        if (!shouldRunPrepare) {
-            return Q();
-        }
-        return require('../prepare').preparePlatforms(platformList, projectRoot, opts);
-    }).then(function () {
-        opts.cordova = { plugins: cordova_util.findPlugins(pluginPath) };
-        return hooksRunner.fire('after_plugin_rm', opts);
-    });
+                }, Q())
+                    .then(function () {
+                        // TODO: Should only uninstallPlugin when no platforms have it.
+                        return plugman.uninstall.uninstallPlugin(target, pluginPath, opts);
+                    }).then(function () {
+                        // remove plugin from config.xml
+                        if (plugin_util.saveToConfigXmlOn(config_json, opts)) {
+                            events.emit('log', 'Removing plugin ' + target + ' from config.xml file...');
+                            var configPath = cordova_util.projectConfig(projectRoot);
+                            if (fs.existsSync(configPath)) { // should not happen with real life but needed for tests
+                                var configXml = new ConfigParser(configPath);
+                                configXml.removePlugin(target);
+                                configXml.write();
+                            }
+                            var pkgJson;
+                            var pkgJsonPath = path.join(projectRoot, 'package.json');
+                            // If statement to see if pkgJsonPath exists in the filesystem
+                            if (fs.existsSync(pkgJsonPath)) {
+                                // delete any previous caches of require(package.json)
+                                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                            }
+                            // If package.json exists and contains a specified plugin in cordova['plugins'], it will be removed
+                            if (pkgJson !== undefined && pkgJson.cordova !== undefined && pkgJson.cordova.plugins !== undefined) {
+                                events.emit('log', 'Removing ' + target + ' from package.json');
+                                // Remove plugin from package.json
+                                delete pkgJson.cordova.plugins[target];
+                                // Write out new package.json with plugin removed correctly.
+                                fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2), 'utf8');
+                            }
+                        }
+                    }).then(function () {
+                        // Remove plugin from fetch.json
+                        events.emit('verbose', 'Removing plugin ' + target + ' from fetch.json');
+                        metadata.remove_fetch_metadata(pluginPath, target);
+                    });
+            }, Q());
+        }).then(function () {
+            // CB-11022 We do not need to run prepare after plugin install until shouldRunPrepare flag is set to true
+            if (!shouldRunPrepare) {
+                return Q();
+            }
+            return require('../prepare').preparePlatforms(platformList, projectRoot, opts);
+        }).then(function () {
+            opts.cordova = { plugins: cordova_util.findPlugins(pluginPath) };
+            return hooksRunner.fire('after_plugin_rm', opts);
+        });
 }
 
 function validatePluginId (pluginId, installedPlugins) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/plugin/search.js
----------------------------------------------------------------------
diff --git a/src/cordova/plugin/search.js b/src/cordova/plugin/search.js
index 0108e4e..a419db8 100644
--- a/src/cordova/plugin/search.js
+++ b/src/cordova/plugin/search.js
@@ -24,18 +24,18 @@ module.exports = search;
 
 function search (hooksRunner, opts) {
     return hooksRunner.fire('before_plugin_search', opts)
-    .then(function () {
-        var link = 'http://cordova.apache.org/plugins/';
-        if (opts.plugins.length > 0) {
-            var keywords = (opts.plugins).join(' ');
-            var query = link + '?q=' + encodeURI(keywords);
-            opener(query);
-        } else {
-            opener(link);
-        }
+        .then(function () {
+            var link = 'http://cordova.apache.org/plugins/';
+            if (opts.plugins.length > 0) {
+                var keywords = (opts.plugins).join(' ');
+                var query = link + '?q=' + encodeURI(keywords);
+                opener(query);
+            } else {
+                opener(link);
+            }
 
-        return Q.resolve();
-    }).then(function () {
-        return hooksRunner.fire('after_plugin_search', opts);
-    });
+            return Q.resolve();
+        }).then(function () {
+            return hooksRunner.fire('after_plugin_search', opts);
+        });
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/prepare.js
----------------------------------------------------------------------
diff --git a/src/cordova/prepare.js b/src/cordova/prepare.js
index 9c02d51..7353a03 100644
--- a/src/cordova/prepare.js
+++ b/src/cordova/prepare.js
@@ -44,30 +44,30 @@ function prepare (options) {
         options.fetch = options.fetch || false;
         var hooksRunner = new HooksRunner(projectRoot);
         return hooksRunner.fire('before_prepare', options)
-        .then(function () {
-            return restore.installPlatformsFromConfigXML(options.platforms, { searchpath: options.searchpath, fetch: options.fetch, restoring: true });
-        })
-        .then(function () {
-            options = cordova_util.preProcessOptions(options);
-            var paths = options.platforms.map(function (p) {
-                var platform_path = path.join(projectRoot, 'platforms', p);
-                return platforms.getPlatformApi(p, platform_path).getPlatformInfo().locations.www;
-            });
-            options.paths = paths;
-        }).then(function () {
-            options = cordova_util.preProcessOptions(options);
-            return restore.installPluginsFromConfigXML(options);
-        }).then(function () {
-            options = cordova_util.preProcessOptions(options);
-            options.searchpath = options.searchpath || config_json.plugin_search_path;
-            // Iterate over each added platform
-            return module.exports.preparePlatforms(options.platforms, projectRoot, options);
-        }).then(function () {
-            options.paths = options.platforms.map(function (platform) {
-                return platforms.getPlatformApi(platform).getPlatformInfo().locations.www;
+            .then(function () {
+                return restore.installPlatformsFromConfigXML(options.platforms, { searchpath: options.searchpath, fetch: options.fetch, restoring: true });
+            })
+            .then(function () {
+                options = cordova_util.preProcessOptions(options);
+                var paths = options.platforms.map(function (p) {
+                    var platform_path = path.join(projectRoot, 'platforms', p);
+                    return platforms.getPlatformApi(p, platform_path).getPlatformInfo().locations.www;
+                });
+                options.paths = paths;
+            }).then(function () {
+                options = cordova_util.preProcessOptions(options);
+                return restore.installPluginsFromConfigXML(options);
+            }).then(function () {
+                options = cordova_util.preProcessOptions(options);
+                options.searchpath = options.searchpath || config_json.plugin_search_path;
+                // Iterate over each added platform
+                return module.exports.preparePlatforms(options.platforms, projectRoot, options);
+            }).then(function () {
+                options.paths = options.platforms.map(function (platform) {
+                    return platforms.getPlatformApi(platform).getPlatformInfo().locations.www;
+                });
+                return hooksRunner.fire('after_prepare', options);
             });
-            return hooksRunner.fire('after_prepare', options);
-        });
     });
 }
 
@@ -93,43 +93,43 @@ function preparePlatforms (platformList, projectRoot, options) {
         };
         // CB-9987 We need to reinstall the plugins for the platform it they were added by cordova@<5.4.0
         return module.exports.restoreMissingPluginsForPlatform(platform, projectRoot, options)
-        .then(function () {
-            // platformApi prepare takes care of all functionality
-            // which previously had been executed by cordova.prepare:
-            //   - reset config.xml and then merge changes from project's one,
-            //   - update www directory from project's one and merge assets from platform_www,
-            //   - reapply config changes, made by plugins,
-            //   - update platform's project
-            // Please note that plugins' changes, such as installed js files, assets and
-            // config changes is not being reinstalled on each prepare.
-            var platformApi = platforms.getPlatformApi(platform);
-            return platformApi.prepare(project, _.clone(options))
             .then(function () {
-                if (platform === 'windows') {
-                    // Windows Api doesn't fire 'pre_package' hook, so we fire it here
-                    return new HooksRunner(projectRoot).fire('pre_package', {
-                        wwwPath: platformApi.getPlatformInfo().locations.www,
-                        platforms: ['windows'],
-                        nohooks: options.nohooks
+                // platformApi prepare takes care of all functionality
+                // which previously had been executed by cordova.prepare:
+                //   - reset config.xml and then merge changes from project's one,
+                //   - update www directory from project's one and merge assets from platform_www,
+                //   - reapply config changes, made by plugins,
+                //   - update platform's project
+                // Please note that plugins' changes, such as installed js files, assets and
+                // config changes is not being reinstalled on each prepare.
+                var platformApi = platforms.getPlatformApi(platform);
+                return platformApi.prepare(project, _.clone(options))
+                    .then(function () {
+                        if (platform === 'windows') {
+                            // Windows Api doesn't fire 'pre_package' hook, so we fire it here
+                            return new HooksRunner(projectRoot).fire('pre_package', {
+                                wwwPath: platformApi.getPlatformInfo().locations.www,
+                                platforms: ['windows'],
+                                nohooks: options.nohooks
+                            });
+                        }
+                    })
+                    .then(function () {
+                        if (options.browserify) {
+                            // TODO: dynamic require here makes it difficult to test this code branch.
+                            var browserify = require('../plugman/browserify');
+                            return browserify(project, platformApi);
+                        }
+                    })
+                    .then(function () {
+                        // Handle edit-config in config.xml
+                        var platformRoot = path.join(projectRoot, 'platforms', platform);
+                        var platformJson = PlatformJson.load(platformRoot, platform);
+                        var munger = new PlatformMunger(platform, platformRoot, platformJson);
+                        // the boolean argument below is "should_increment"
+                        munger.add_config_changes(project.projectConfig, true).save_all();
                     });
-                }
-            })
-            .then(function () {
-                if (options.browserify) {
-                    // TODO: dynamic require here makes it difficult to test this code branch.
-                    var browserify = require('../plugman/browserify');
-                    return browserify(project, platformApi);
-                }
-            })
-            .then(function () {
-                // Handle edit-config in config.xml
-                var platformRoot = path.join(projectRoot, 'platforms', platform);
-                var platformJson = PlatformJson.load(platformRoot, platform);
-                var munger = new PlatformMunger(platform, platformRoot, platformJson);
-                // the boolean argument below is "should_increment"
-                munger.add_config_changes(project.projectConfig, true).save_all();
             });
-        });
     }));
 }
 
@@ -184,9 +184,9 @@ function restoreMissingPluginsForPlatform (platform, projectRoot, options) {
             events.emit('verbose', 'Reinstalling missing plugin ' + plugin.name + ' in ' + platform + ' platform');
             var pluginInfo = provider.get(path.join(projectRoot, 'plugins', plugin.name));
             return api.removePlugin(pluginInfo, pluginOptions)
-            .then(function () {
-                return api.addPlugin(pluginInfo, pluginOptions);
-            });
+                .then(function () {
+                    return api.addPlugin(pluginInfo, pluginOptions);
+                });
         });
     }, Q());
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/project_metadata.js
----------------------------------------------------------------------
diff --git a/src/cordova/project_metadata.js b/src/cordova/project_metadata.js
index afde4e0..1eb1cca 100644
--- a/src/cordova/project_metadata.js
+++ b/src/cordova/project_metadata.js
@@ -17,17 +17,16 @@
     under the License.
 */
 
-var cordova_util = require('./util'),
-    ConfigParser = require('cordova-common').ConfigParser,
-    Q            = require('q'),
-    semver       = require('semver');
-
+var cordova_util = require('./util');
+var ConfigParser = require('cordova-common').ConfigParser;
+var Q = require('q');
+var semver = require('semver');
 
 /** Returns all the platforms that are currently saved into config.xml
  *  @return {Promise<{name: string, version: string, src: string}[]>}
  *      e.g: [ {name: 'android', version: '3.5.0'}, {name: 'wp8', src: 'C:/path/to/platform'}, {name: 'ios', src: 'git://...'} ]
  */
-function getPlatforms(projectRoot){
+function getPlatforms (projectRoot) {
     var xml = cordova_util.projectConfig(projectRoot);
     var cfg = new ConfigParser(xml);
 
@@ -53,7 +52,7 @@ function getPlatforms(projectRoot){
  *  @return {Promise<{id: string, version: string, variables: {name: string, value: string}[]}[]>}
  *      e.g: [ {id: 'org.apache.cordova.device', variables: [{name: 'APP_ID', value: 'my-app-id'}, {name: 'APP_NAME', value: 'my-app-name'}]} ]
  */
-function getPlugins(projectRoot){
+function getPlugins (projectRoot) {
     var xml = cordova_util.projectConfig(projectRoot);
     var cfg = new ConfigParser(xml);
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/remote_load.js
----------------------------------------------------------------------
diff --git a/src/cordova/remote_load.js b/src/cordova/remote_load.js
index 90aa0b1..c6b72d6 100644
--- a/src/cordova/remote_load.js
+++ b/src/cordova/remote_load.js
@@ -31,7 +31,7 @@ passed containing a packageName, name, and version.
 
 options - Package options
  */
-function npmFetch(packageName, packageVersion) {
+function npmFetch (packageName, packageVersion) {
     return npmHelper.fetchPackage(packageName, packageVersion);
 }
 
@@ -44,11 +44,11 @@ passed.
 gitURL - URL to Git repository
 branch - Branch to checkout at
  */
-function gitClone(gitURL, branch) {
-    var cloneCallback;          // Resultant callback
-    var tmpSubDir;              // Temporary sub-directory
-    var tmpDir;                 // Temporary directory
-    var checkoutBranch;         // Branch to checkout
+function gitClone (gitURL, branch) {
+    var cloneCallback; // Resultant callback
+    var tmpSubDir; // Temporary sub-directory
+    var tmpDir; // Temporary directory
+    var checkoutBranch; // Branch to checkout
 
     checkoutBranch = branch || 'master';
     tmpSubDir = 'tmp_cordova_git_' + process.pid + '_' + (new Date()).valueOf();
@@ -61,7 +61,7 @@ function gitClone(gitURL, branch) {
 
     // Callback for Git clone
     cloneCallback.then(
-        function() {
+        function () {
             return tmpDir;
         },
         function (err) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/src/cordova/requirements.js
----------------------------------------------------------------------
diff --git a/src/cordova/requirements.js b/src/cordova/requirements.js
index 0d8d543..08da93c 100644
--- a/src/cordova/requirements.js
+++ b/src/cordova/requirements.js
@@ -18,7 +18,7 @@
 */
 
 var cordova_util = require('./util');
-var Q            = require('q');
+var Q = require('q');
 var CordovaError = require('cordova-common').CordovaError;
 var knownPlatforms = require('../platforms/platforms');
 
@@ -31,14 +31,13 @@ var knownPlatforms = require('../platforms/platforms');
  * @return {Promise<Object>}    Promise fullfilled with map of platforms and
  *   requirements check results for each platform.
  */
-module.exports = function check_reqs(platforms) {
-    return Q().then(function() {
-        var platforms = cordova_util.preProcessOptions(platforms).platforms;
+module.exports = function check_reqs (platforms) {
+    return Q().then(function () {
+        var platforms = cordova_util.preProcessOptions(platforms).platforms; // eslint-disable-line no-use-before-define
 
         return Q.allSettled(platforms.map(function (platform) {
             return knownPlatforms.getPlatformApi(platform).requirements();
-        }))
-        .then(function (settledChecks) {
+        })).then(function (settledChecks) {
             var res = {};
             settledChecks.reduce(function (result, settledCheck, idx) {
                 var platformName = platforms[idx];


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


[10/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/emulate.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/emulate.spec.js b/spec/cordova/emulate.spec.js
index 111bb78..f698a2e 100644
--- a/spec/cordova/emulate.spec.js
+++ b/spec/cordova/emulate.spec.js
@@ -16,20 +16,24 @@
     specific language governing permissions and limitations
     under the License.
 */
-var cordova = require('../../src/cordova/cordova'),
-    platforms = require('../../src/platforms/platforms'),
-    HooksRunner = require('../../src/hooks/HooksRunner'),
-    Q = require('q'),
-    util = require('../../src/cordova/util');
+var cordova = require('../../src/cordova/cordova');
+var platforms = require('../../src/platforms/platforms');
+var HooksRunner = require('../../src/hooks/HooksRunner');
+var Q = require('q');
+var util = require('../../src/cordova/util');
 
-var supported_platforms = Object.keys(platforms).filter(function(p) { return p != 'www'; });
+var supported_platforms = Object.keys(platforms).filter(function (p) { return p !== 'www'; });
 
-describe('emulate command', function() {
-    var is_cordova, cd_project_root, list_platforms, fire, fail;
+describe('emulate command', function () {
+    var is_cordova;
+    var cd_project_root; // eslint-disable-line no-unused-vars
+    var list_platforms;
+    var fire;
+    var fail;
     var project_dir = '/some/path';
     var prepare_spy, platformApi, getPlatformApi;
 
-    beforeEach(function() {
+    beforeEach(function () {
         is_cordova = spyOn(util, 'isCordova').and.returnValue(project_dir);
         cd_project_root = spyOn(util, 'cdProjectRoot').and.returnValue(project_dir);
         list_platforms = spyOn(util, 'listPlatforms').and.returnValue(supported_platforms);
@@ -40,152 +44,158 @@ describe('emulate command', function() {
             run: jasmine.createSpy('run').and.returnValue(Q()),
             build: jasmine.createSpy('build').and.returnValue(Q())
         };
-        
+
         getPlatformApi = spyOn(platforms, 'getPlatformApi').and.returnValue(platformApi);
     });
-    describe('failure', function() {
-        it('Test 001 : should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function(done) {
+    describe('failure', function () {
+        it('Test 001 : should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function (done) {
             list_platforms.and.returnValue([]);
             var success = jasmine.createSpy('success');
             cordova.compile()
-            .then(success, function(result) {
-                expect(result instanceof Error).toBe(true);
-                expect('' + result).toContain('No platforms added to this project. Please use `cordova platform add <platform>`.');
-            })
-            .fin(function() {
-                expect(success).not.toHaveBeenCalled();
-                done();
-            });
+                .then(success, function (result) {
+                    expect(result instanceof Error).toBe(true);
+                    expect('' + result).toContain('No platforms added to this project. Please use `cordova platform add <platform>`.');
+                })
+                .fin(function () {
+                    expect(success).not.toHaveBeenCalled();
+                    done();
+                });
         });
-        it('Test 002 : should not run outside of a Cordova-based project', function(done) {
+        it('Test 002 : should not run outside of a Cordova-based project', function (done) {
             is_cordova.and.returnValue(false);
             var success = jasmine.createSpy('success');
             cordova.compile()
-            .then(success, function(result) {
-                expect(result instanceof Error).toBe(true);
-            })
-            .fin(function() {
-                expect(success).not.toHaveBeenCalled();
-                done();
-            });
+                .then(success, function (result) {
+                    expect(result instanceof Error).toBe(true);
+                })
+                .fin(function () {
+                    expect(success).not.toHaveBeenCalled();
+                    done();
+                });
         });
     });
 
-    describe('success', function() {
-        it('Test 003 : should run inside a Cordova-based project with at least one added platform and call prepare and shell out to the emulate script', function(done) {
-            cordova.emulate(['android','ios']).then(function(err) {
-                expect(prepare_spy).toHaveBeenCalledWith(jasmine.objectContaining({platforms: ['android', 'ios']}));
-                expect(getPlatformApi).toHaveBeenCalledWith('android');
-                expect(getPlatformApi).toHaveBeenCalledWith('ios');
-                expect(platformApi.build).toHaveBeenCalled();
-                expect(platformApi.run).toHaveBeenCalled();
-            })
-            .fail(fail)
-            .fin(done);
+    describe('success', function () {
+        it('Test 003 : should run inside a Cordova-based project with at least one added platform and call prepare and shell out to the emulate script', function (done) {
+            cordova.emulate(['android', 'ios'])
+                .then(function (err) { // eslint-disable-line handle-callback-err
+                    expect(prepare_spy).toHaveBeenCalledWith(jasmine.objectContaining({platforms: ['android', 'ios']}));
+                    expect(getPlatformApi).toHaveBeenCalledWith('android');
+                    expect(getPlatformApi).toHaveBeenCalledWith('ios');
+                    expect(platformApi.build).toHaveBeenCalled();
+                    expect(platformApi.run).toHaveBeenCalled();
+                })
+                .fail(fail)
+                .fin(done);
         });
-        it('Test 004 : should pass down options', function(done) {
-            cordova.emulate({platforms: ['ios'], options: {optionTastic: true }}).then(function(err) {
-                expect(prepare_spy).toHaveBeenCalledWith(jasmine.objectContaining({platforms: ['ios']}));
-                expect(getPlatformApi).toHaveBeenCalledWith('ios');
-                expect(platformApi.build).toHaveBeenCalledWith({ device: false, emulator: true, optionTastic: true });
-                expect(platformApi.run).toHaveBeenCalledWith({ device: false, emulator: true, optionTastic: true, nobuild: true });
-            })
-            .fail(fail)
-            .fin(done);
+        it('Test 004 : should pass down options', function (done) {
+            cordova.emulate({platforms: ['ios'], options: { optionTastic: true }})
+                .then(function (err) { // eslint-disable-line handle-callback-err
+                    expect(prepare_spy).toHaveBeenCalledWith(jasmine.objectContaining({platforms: ['ios']}));
+                    expect(getPlatformApi).toHaveBeenCalledWith('ios');
+                    expect(platformApi.build).toHaveBeenCalledWith({ device: false, emulator: true, optionTastic: true });
+                    expect(platformApi.run).toHaveBeenCalledWith({ device: false, emulator: true, optionTastic: true, nobuild: true });
+                })
+                .fail(fail)
+                .fin(done);
         });
         it('Test 005 : should convert options from old format and warn user about this', function (done) {
-            function warnSpy(message) {
+            function warnSpy (message) {
                 expect(message).toMatch('The format of cordova.* methods "options" argument was changed');
             }
 
             cordova.on('warn', warnSpy);
-            cordova.emulate({platforms:['ios'], options:['--optionTastic']}).then(function () {
-                expect(prepare_spy).toHaveBeenCalledWith(jasmine.objectContaining({platforms: ['ios']}));
-                expect(getPlatformApi).toHaveBeenCalledWith('ios');
-                expect(platformApi.run).toHaveBeenCalledWith(jasmine.objectContaining({emulator: true, argv: ['--optionTastic']}));
-            })
-            .fail(fail)
-            .fin(function () {
-                cordova.off('warn', warnSpy);
-                done();
-            });
+            cordova.emulate({platforms: ['ios'], options: ['--optionTastic']})
+                .then(function () {
+                    expect(prepare_spy).toHaveBeenCalledWith(jasmine.objectContaining({platforms: ['ios']}));
+                    expect(getPlatformApi).toHaveBeenCalledWith('ios');
+                    expect(platformApi.run).toHaveBeenCalledWith(jasmine.objectContaining({emulator: true, argv: ['--optionTastic']}));
+                })
+                .fail(fail)
+                .fin(function () {
+                    cordova.off('warn', warnSpy);
+                    done();
+                });
         });
-        describe('run parameters should not be altered by intermediate build command', function() {
+        describe('run parameters should not be altered by intermediate build command', function () {
             var originalBuildSpy;
-            beforeEach(function() {
+            beforeEach(function () {
                 originalBuildSpy = platformApi.build;
-                platformApi.build = jasmine.createSpy('build').and.callFake(function(opts) {
+                platformApi.build = jasmine.createSpy('build').and.callFake(function (opts) {
                     opts.couldBeModified = 'insideBuild';
                     return Q();
                 });
             });
-            afterEach(function() {
+            afterEach(function () {
                 platformApi.build = originalBuildSpy;
             });
-            it('Test 006 : should leave parameters unchanged', function(done) {
-                cordova.run({platforms: ['blackberry10'], options:{password: '1q1q'}}).then(function() {
-                    expect(prepare_spy).toHaveBeenCalledWith({ platforms: [ 'blackberry10' ], options: { password: '1q1q', 'couldBeModified': 'insideBuild' }, verbose: false });
-                    expect(platformApi.build).toHaveBeenCalledWith({password: '1q1q', 'couldBeModified': 'insideBuild'});
-                    expect(platformApi.run).toHaveBeenCalledWith({password: '1q1q', nobuild: true});
-                }, function(err) {
-                    expect(err).toBeUndefined();
-                }).fin(done);
+            it('Test 006 : should leave parameters unchanged', function (done) {
+                cordova.run({platforms: ['blackberry10'], options: {password: '1q1q'}})
+                    .then(function () {
+                        expect(prepare_spy).toHaveBeenCalledWith({ platforms: [ 'blackberry10' ], options: { password: '1q1q', 'couldBeModified': 'insideBuild' }, verbose: false });
+                        expect(platformApi.build).toHaveBeenCalledWith({password: '1q1q', 'couldBeModified': 'insideBuild'});
+                        expect(platformApi.run).toHaveBeenCalledWith({password: '1q1q', nobuild: true});
+                    }, function (err) {
+                        expect(err).toBeUndefined();
+                    }).fin(done);
             });
         });
 
         it('Test 007 : should call platform\'s build method', function (done) {
             cordova.emulate({platforms: ['blackberry10']})
-            .then(function() {
-                expect(prepare_spy).toHaveBeenCalled();
-                expect(platformApi.build).toHaveBeenCalledWith({device: false, emulator: true});
-                expect(platformApi.run).toHaveBeenCalledWith(jasmine.objectContaining({nobuild: true}));
-            }, function(err) {
-                expect(err).toBeUndefined();
-            })
-            .fin(done);
+                .then(function () {
+                    expect(prepare_spy).toHaveBeenCalled();
+                    expect(platformApi.build).toHaveBeenCalledWith({device: false, emulator: true});
+                    expect(platformApi.run).toHaveBeenCalledWith(jasmine.objectContaining({nobuild: true}));
+                }, function (err) {
+                    expect(err).toBeUndefined();
+                })
+                .fin(done);
         });
 
         it('Test 008 : should not call build if --nobuild option is passed', function (done) {
             cordova.emulate({platforms: ['blackberry10'], options: { nobuild: true }})
-            .then(function() {
-                expect(prepare_spy).toHaveBeenCalled();
-                expect(platformApi.build).not.toHaveBeenCalled();
-                expect(platformApi.run).toHaveBeenCalledWith(jasmine.objectContaining({nobuild: true}));
-            }, function(err) {
-                expect(err).toBeUndefined();
-            })
-            .fin(done);
+                .then(function () {
+                    expect(prepare_spy).toHaveBeenCalled();
+                    expect(platformApi.build).not.toHaveBeenCalled();
+                    expect(platformApi.run).toHaveBeenCalledWith(jasmine.objectContaining({nobuild: true}));
+                }, function (err) {
+                    expect(err).toBeUndefined();
+                })
+                .fin(done);
         });
     });
 
-    describe('hooks', function() {
-        describe('when platforms are added', function() {
-            it('Test 009 : should fire before hooks through the hooker module', function(done) {
-                cordova.emulate(['android', 'ios']).then(function() {
-                    expect(fire).toHaveBeenCalledWith('before_emulate',
-                        jasmine.objectContaining({verbose: false, platforms:['android', 'ios'], options: jasmine.any(Object)}));
-                })
-                .fail(fail)
-                .fin(done);
+    describe('hooks', function () {
+        describe('when platforms are added', function () {
+            it('Test 009 : should fire before hooks through the hooker module', function (done) {
+                cordova.emulate(['android', 'ios'])
+                    .then(function () {
+                        expect(fire).toHaveBeenCalledWith('before_emulate',
+                            jasmine.objectContaining({verbose: false, platforms: ['android', 'ios'], options: jasmine.any(Object)}));
+                    })
+                    .fail(fail)
+                    .fin(done);
             });
-            it('Test 010 : should fire after hooks through the hooker module', function(done) {
-                cordova.emulate('android').then(function() {
-                     expect(fire).toHaveBeenCalledWith('after_emulate',
-                        jasmine.objectContaining({verbose: false, platforms:['android'], options: jasmine.any(Object)}));
-                })
-                .fail(fail)
-                .fin(done);
+            it('Test 010 : should fire after hooks through the hooker module', function (done) {
+                cordova.emulate('android')
+                    .then(function () {
+                        expect(fire).toHaveBeenCalledWith('after_emulate',
+                            jasmine.objectContaining({verbose: false, platforms: ['android'], options: jasmine.any(Object)}));
+                    })
+                    .fail(fail)
+                    .fin(done);
             });
         });
 
-        describe('with no platforms added', function() {
-            it('Test 011 : should not fire the hooker', function(done) {
+        describe('with no platforms added', function () {
+            it('Test 011 : should not fire the hooker', function (done) {
                 list_platforms.and.returnValue([]);
-                Q().then(cordova.emulate).then(function() {
+                Q().then(cordova.emulate).then(function () {
                     expect('this call').toBe('fail');
-                }, function(err) {
+                }, function (err) {
                     expect(fire).not.toHaveBeenCalled();
-                    expect(''+err).toContain('No platforms added to this project. Please use `cordova platform add <platform>`.');
+                    expect('' + err).toContain('No platforms added to this project. Please use `cordova platform add <platform>`.');
                 }).fin(done);
             });
         });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/lazy_load.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/lazy_load.spec.js b/spec/cordova/lazy_load.spec.js
index 76fbecf..a4ede0d 100644
--- a/spec/cordova/lazy_load.spec.js
+++ b/spec/cordova/lazy_load.spec.js
@@ -17,53 +17,51 @@
     under the License.
 */
 
-/* jshint sub:true */
+var lazy_load = require('../../src/cordova/lazy_load');
+var npmHelper = require('../../src/util/npm-helper');
+var config = require('../../src/cordova/config');
+var shell = require('shelljs');
+var npm = require('npm');
+var path = require('path');
+var HooksRunner = require('../../src/hooks/HooksRunner');
+var request = require('request');
+var fs = require('fs');
+var Q = require('q');
+var platforms = require('../../src/platforms/platforms');
 
-var lazy_load = require('../../src/cordova/lazy_load'),
-    npmHelper = require('../../src/util/npm-helper'),
-    config = require('../../src/cordova/config'),
-    shell = require('shelljs'),
-    npm = require('npm'),
-    path = require('path'),
-    HooksRunner = require('../../src/hooks/HooksRunner'),
-    request = require('request'),
-    fs = require('fs'),
-    Q = require('q'),
-    platforms = require('../../src/platforms/platforms');
-
-describe('lazy_load module', function() {
+describe('lazy_load module', function () {
     var custom_path, cachePackage, fakeLazyLoad;
-    beforeEach(function() {
+    beforeEach(function () {
         custom_path = spyOn(config, 'has_custom_path').and.returnValue(false);
         cachePackage = spyOn(npmHelper, 'cachePackage').and.returnValue(Q(path.join('lib', 'dir')));
         fakeLazyLoad = function (id, platform, version) {
-            if (platform == 'wp7' || platform == 'wp8') {
+            if (platform === 'wp7' || platform === 'wp8') {
                 return Q(path.join('lib', 'wp', id, version, platform));
             } else {
                 return Q(path.join('lib', platform, id, version, platforms[platform] && platforms[platform].subdirectory ? platforms[platform].subdirectory : ''));
             }
         };
     });
-    describe('cordova method (loads stock cordova libs)', function() {
-        var custom,
-            version;
-        beforeEach(function() {
-            custom = spyOn(lazy_load, 'custom').and.returnValue(Q(path.join('lib','dir')));
+    describe('cordova method (loads stock cordova libs)', function () {
+        var custom; // eslint-disable-line no-unused-vars
+        var version;
+        beforeEach(function () {
+            custom = spyOn(lazy_load, 'custom').and.returnValue(Q(path.join('lib', 'dir')));
             version = platforms.android.version;
             platforms.android.version = '3.14.15.9265';
         });
         afterEach(function () {
             platforms.android.version = version;
         });
-        it('Test 001: should throw if platform is not a stock cordova platform', function(done) {
-            lazy_load.cordova('atari').then(function() {
+        it('Test 001: should throw if platform is not a stock cordova platform', function (done) {
+            lazy_load.cordova('atari').then(function () {
                 expect('this call').toEqual('to fail');
-            }, function(err) {
+            }, function (err) {
                 expect('' + err).toContain('Cordova library "atari" not recognized.');
             }).fin(done);
         });
-        it('Test 002 : should invoke lazy_load.custom with appropriate url, platform, and version as specified in platforms manifest', function(done) {
-            lazy_load.cordova('android').then(function(dir) {
+        it('Test 002 : should invoke lazy_load.custom with appropriate url, platform, and version as specified in platforms manifest', function (done) {
+            lazy_load.cordova('android').then(function (dir) {
                 expect(cachePackage).toHaveBeenCalled();
                 expect(dir).toBeDefined();
                 done();
@@ -71,9 +69,15 @@ describe('lazy_load module', function() {
         });
     });
 
-    describe('custom method (loads custom cordova libs)', function() {
-        var exists, fire, rm, mv, readdir;
-        beforeEach(function() {
+    describe('custom method (loads custom cordova libs)', function () {
+        /* eslint-disable no-unused-vars */
+        var exists;
+        var fire;
+        var rm;
+        var mv;
+        var readdir;
+        /* eslint-enable no-unused-vars */
+        beforeEach(function () {
             spyOn(shell, 'mkdir');
             rm = spyOn(shell, 'rm');
             mv = spyOn(shell, 'mv');
@@ -82,7 +86,7 @@ describe('lazy_load module', function() {
             fire = spyOn(HooksRunner, 'fire').and.returnValue(Q());
         });
 
-        it('Test 003 : should callback with no errors and not fire event hooks if library already exists', function(done) {
+        it('Test 003 : should callback with no errors and not fire event hooks if library already exists', function (done) {
             exists.and.returnValue(true);
             var mock_platforms = {
                 'platform X': {
@@ -91,13 +95,13 @@ describe('lazy_load module', function() {
                     version: 'three point five'
                 }
             };
-            lazy_load.custom(mock_platforms, 'platform X').then(function() {
+            lazy_load.custom(mock_platforms, 'platform X').then(function () {
                 expect(fire).not.toHaveBeenCalled();
-            }, function(err) {
+            }, function (err) {
                 expect(err).not.toBeDefined();
             }).fin(done);
         });
-        it('Test 004 : should callback with no errors and fire event hooks even if library already exists if the lib url is a local dir', function(done) {
+        it('Test 004 : should callback with no errors and fire event hooks even if library already exists if the lib url is a local dir', function (done) {
             exists.and.returnValue(true);
             var mock_platforms = {
                 'platform X': {
@@ -106,39 +110,39 @@ describe('lazy_load module', function() {
                     version: 'three point six'
                 }
             };
-            lazy_load.custom(mock_platforms, 'platform X').then(function() {
+            lazy_load.custom(mock_platforms, 'platform X').then(function () {
                 expect(fire).not.toHaveBeenCalled();
-            }, function(err) {
+            }, function (err) {
                 expect(err).not.toBeDefined();
             }).fin(done);
         });
 
-        describe('remote URLs for libraries', function() {
-            var req,
-                events = {},
-                fakeRequest = {
-                    on: jasmine.createSpy().and.callFake(function(event, cb) {
-                        events[event] = cb;
-                        return fakeRequest;
-                    }),
-                    pipe: jasmine.createSpy().and.callFake(function() { return fakeRequest; })
-                };
-            beforeEach(function() {
+        describe('remote URLs for libraries', function () {
+            var req;
+            var events = {};
+            var fakeRequest = {
+                on: jasmine.createSpy().and.callFake(function (event, cb) {
+                    events[event] = cb;
+                    return fakeRequest;
+                }),
+                pipe: jasmine.createSpy().and.callFake(function () { return fakeRequest; })
+            };
+            beforeEach(function () {
                 events = {};
                 fakeRequest.on.calls.reset();
                 fakeRequest.pipe.calls.reset();
-                req = spyOn(request, 'get').and.callFake(function() {
+                req = spyOn(request, 'get').and.callFake(function () {
                     // Fire the 'end' event shortly.
-                    setTimeout(function() {
+                    setTimeout(function () {
                         events['end']();
                     }, 10);
                     return fakeRequest;
                 });
-                spyOn(npm, 'load').and.callFake(function(cb) { cb(); });
+                spyOn(npm, 'load').and.callFake(function (cb) { cb(); });
                 spyOn(npm.config, 'get').and.returnValue(null);
             });
 
-            it('Test 005 : should call request with appropriate url params', function(done) {
+            it('Test 005 : should call request with appropriate url params', function (done) {
                 var url = 'https://github.com/apache/someplugin';
                 var with_android_platform = {
                     'android': {
@@ -147,15 +151,15 @@ describe('lazy_load module', function() {
                         version: '1.0'
                     }
                 };
-                lazy_load.custom(with_android_platform, 'android').then(function() {
+                lazy_load.custom(with_android_platform, 'android').then(function () {
                     expect(req).toHaveBeenCalledWith({
-                        url:url
+                        url: url
                     }, jasmine.any(Function));
-                }, function(err) {
+                }, function (err) {
                     expect(err).not.toBeDefined();
                 }).fin(done);
             });
-            it('Test 006 : should take into account https-proxy npm configuration var if exists for https:// calls', function(done) {
+            it('Test 006 : should take into account https-proxy npm configuration var if exists for https:// calls', function (done) {
                 var proxy = 'https://somelocalproxy.com';
                 npm.config.get.and.returnValue(proxy);
                 var url = 'https://github.com/apache/someplugin';
@@ -166,16 +170,16 @@ describe('lazy_load module', function() {
                         version: '1.0'
                     }
                 };
-                lazy_load.custom(with_android_platform, 'android').then(function() {
+                lazy_load.custom(with_android_platform, 'android').then(function () {
                     expect(req).toHaveBeenCalledWith({
-                        url:url,
-                        proxy:proxy
+                        url: url,
+                        proxy: proxy
                     }, jasmine.any(Function));
-                }, function(err) {
+                }, function (err) {
                     expect(err).not.toBeDefined();
                 }).fin(done);
             });
-            it('Test 007 : should take into account proxy npm config var if exists for http:// calls', function(done) {
+            it('Test 007 : should take into account proxy npm config var if exists for http:// calls', function (done) {
                 var proxy = 'http://somelocalproxy.com';
                 npm.config.get.and.returnValue(proxy);
                 var url = 'http://github.com/apache/someplugin';
@@ -186,19 +190,19 @@ describe('lazy_load module', function() {
                         version: '1.0'
                     }
                 };
-                lazy_load.custom(with_android_platform, 'android').then(function() {
+                lazy_load.custom(with_android_platform, 'android').then(function () {
                     expect(req).toHaveBeenCalledWith({
-                        url:url,
-                        proxy:proxy
+                        url: url,
+                        proxy: proxy
                     }, jasmine.any(Function));
-                }, function(err) {
+                }, function (err) {
                     expect(err).not.toBeDefined();
                 }).fin(done);
             });
         });
 
-        describe('local paths for libraries', function() {
-            it('Test 009 : should return the local path, no symlink', function(done) {
+        describe('local paths for libraries', function () {
+            it('Test 009 : should return the local path, no symlink', function (done) {
                 var mock_platforms = {
                     'X': {
                         id: 'id',
@@ -206,13 +210,13 @@ describe('lazy_load module', function() {
                         version: 'three point eight'
                     }
                 };
-                lazy_load.custom(mock_platforms, 'X').then(function(dir) {
+                lazy_load.custom(mock_platforms, 'X').then(function (dir) {
                     expect(path.normpath(dir)).toEqual('/some/random/lib');
-                }, function(err) {
+                }, function (err) {
                     expect(err).toBeUndefined();
                 }).fin(done);
             });
-            it('Test 010 : should not file download hook', function(done) {
+            it('Test 010 : should not file download hook', function (done) {
                 var mock_platforms = {
                     'X': {
                         id: 'id',
@@ -220,28 +224,30 @@ describe('lazy_load module', function() {
                         version: 'three point nine'
                     }
                 };
-                lazy_load.custom(mock_platforms, 'X').then(function() {
-                    expect(fire).not.toHaveBeenCalledWith('after_library_download', {platform:'X',url:'/some/random/lib',id:'id',version:'three point nine',path:'/some/random/lib', symlink:false});
-                }, function(err) {
+                lazy_load.custom(mock_platforms, 'X').then(function () {
+                    expect(fire).not.toHaveBeenCalledWith('after_library_download', {platform: 'X', url: '/some/random/lib', id: 'id', version: 'three point nine', path: '/some/random/lib', symlink: false});
+                }, function (err) {
                     expect(err).toBeUndefined();
                 }).fin(done);
             });
         });
     });
 
-    describe('based_on_config method', function() {
-        var cordova, custom, read;
-        beforeEach(function() {
+    describe('based_on_config method', function () {
+        var cordova;
+        var custom;
+        var read; // eslint-disable-line no-unused-vars
+        beforeEach(function () {
             cordova = spyOn(lazy_load, 'cordova').and.returnValue(Q());
             custom = spyOn(lazy_load, 'custom').and.returnValue(Q());
         });
-        it('Test 011 : should invoke custom if a custom lib is specified', function(done) {
+        it('Test 011 : should invoke custom if a custom lib is specified', function (done) {
             read = spyOn(config, 'read').and.returnValue({
-                lib:{
-                    maybe:{
-                        url:'you or eye?',
-                        id:'eye dee',
-                        version:'four point twenty'
+                lib: {
+                    maybe: {
+                        url: 'you or eye?',
+                        id: 'eye dee',
+                        version: 'four point twenty'
                     }
                 }
             });
@@ -254,16 +260,16 @@ describe('lazy_load module', function() {
                 expect(platforms[platform].version).toEqual('four point twenty');
                 return fakeLazyLoad(platforms[platform].id, platform, platforms[platform].version);
             });
-            lazy_load.based_on_config('yup', 'maybe').then(function() {
+            lazy_load.based_on_config('yup', 'maybe').then(function () {
                 expect(custom).toHaveBeenCalled();
-            }, function(err) {
+            }, function (err) {
                 expect(err).toBeUndefined();
             }).fin(done);
         });
-        it('Test 012 : should invoke cordova if no custom lib is specified', function(done) {
-            lazy_load.based_on_config('yup', 'ios').then(function() {
+        it('Test 012 : should invoke cordova if no custom lib is specified', function (done) {
+            lazy_load.based_on_config('yup', 'ios').then(function () {
                 expect(cordova).toHaveBeenCalled();
-            }, function(err) {
+            }, function (err) {
                 expect(err).toBeUndefined();
             }).fin(done);
         });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/metadata/blackberry_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/metadata/blackberry_parser.spec.js b/spec/cordova/metadata/blackberry_parser.spec.js
index abca94a..6bb0bf9 100644
--- a/spec/cordova/metadata/blackberry_parser.spec.js
+++ b/spec/cordova/metadata/blackberry_parser.spec.js
@@ -17,16 +17,16 @@
     under the License.
 */
 
-var blackberryParser = require('../../../src/cordova/metadata/blackberry10_parser'),
-    util = require('../../../src/cordova/util'),
-    path = require('path'),
-    shell = require('shelljs'),
-    fs = require('fs'),
-    et = require('elementtree'),
-    xmlHelpers = require('cordova-common').xmlHelpers,
-    config = require('../../../src/cordova/config'),
-    Parser = require('../../../src/cordova/metadata/parser'),
-    ConfigParser = require('cordova-common').ConfigParser;
+var blackberryParser = require('../../../src/cordova/metadata/blackberry10_parser');
+var util = require('../../../src/cordova/util');
+var path = require('path');
+var shell = require('shelljs');
+var fs = require('fs');
+var et = require('elementtree');
+var xmlHelpers = require('cordova-common').xmlHelpers;
+var config = require('../../../src/cordova/config');
+var Parser = require('../../../src/cordova/metadata/parser');
+var ConfigParser = require('cordova-common').ConfigParser;
 
 var cfg = new ConfigParser(path.join(__dirname, '..', 'test-config.xml'));
 
@@ -48,59 +48,68 @@ var TEST_XML = '<?xml version="1.0" encoding="UTF-8"?>\n' +
     '    <preference name="webviewbounce" value="true" />\n' +
     '</widget>\n';
 
-describe('blackberry10 project parser', function() {
+describe('blackberry10 project parser', function () {
     var proj = '/some/path';
-    var exists, custom;
-    beforeEach(function() {
+    var exists;
+    var custom; // eslint-disable-line no-unused-vars
+    beforeEach(function () {
         exists = spyOn(fs, 'existsSync').and.returnValue(true);
         custom = spyOn(config, 'has_custom_path').and.returnValue(false);
         spyOn(ConfigParser.prototype, 'write');
-        spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function() {
+        spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function () {
             return new et.ElementTree(et.XML(TEST_XML));
         });
     });
 
-    function wrapper(p, done, post) {
-        p.then(post, function(err) {
+    function wrapper (p, done, post) {
+        p.then(post, function (err) {
             expect(err).toBeUndefined();
         }).fin(done);
     }
 
-    function errorWrapper(p, done, post) {
-        p.then(function() {
+    function errorWrapper (p, done, post) {
+        p.then(function () {
             expect('this call').toBe('fail');
         }, post).fin(done);
     }
 
-    describe('constructions', function() {
-        it('should throw an exception with a path that is not a native blackberry project', function() {
+    describe('constructions', function () {
+        it('should throw an exception with a path that is not a native blackberry project', function () {
             exists.and.returnValue(false);
-            expect(function() {
-                new blackberryParser(proj);
+            expect(function () {
+                new blackberryParser(proj); // eslint-disable-line
             }).toThrow();
         });
-        it('should accept a proper native blackberry project path as construction parameter', function() {
+        it('should accept a proper native blackberry project path as construction parameter', function () {
             var project;
-            expect(function() {
-                project = new blackberryParser(proj);
+            expect(function () {
+                project = new blackberryParser(proj); // eslint-disable-line
             }).not.toThrow();
             expect(project).toBeDefined();
         });
-        it('should be an instance of Parser', function() {
-            expect(new blackberryParser(proj) instanceof Parser).toBe(true);
+        it('should be an instance of Parser', function () {
+            expect(new blackberryParser(proj) instanceof Parser).toBe(true); // eslint-disable-line
         });
-        it('should call super with the correct arguments', function() {
+        it('should call super with the correct arguments', function () {
             var call = spyOn(Parser, 'call');
-            var p = new blackberryParser(proj);
+            var p = new blackberryParser(proj); // eslint-disable-line
             expect(call).toHaveBeenCalledWith(p, 'blackberry10', proj);
         });
     });
 
-    describe('instance', function() {
-        var p, cp, rm, mkdir, is_cordova, write, read;
+    describe('instance', function () {
+        /* eslint-disable no-unused-vars */
+        var p;
+        var cp;
+        var rm;
+        var mkdir;
+        var is_cordova;
+        var write;
+        var read;
         var bb_proj = path.join(proj, 'platforms', 'blackberry10');
-        beforeEach(function() {
-            p = new blackberryParser(bb_proj);
+        /* eslint-enable no-unused-vars */
+        beforeEach(function () {
+            p = new blackberryParser(bb_proj); // eslint-disable-line
             cp = spyOn(shell, 'cp');
             rm = spyOn(shell, 'rm');
             mkdir = spyOn(shell, 'mkdir');
@@ -109,11 +118,11 @@ describe('blackberry10 project parser', function() {
             read = spyOn(fs, 'readFileSync');
         });
 
-        describe('update_from_config method', function() {
+        describe('update_from_config method', function () {
             var xml_name, xml_pkg, xml_version, xml_access_rm, xml_update,
                 xml_append, xml_content, xml_access_add, xml_preference_remove,
                 xml_preference_add;
-            beforeEach(function() {
+            beforeEach(function () {
                 xml_content = jasmine.createSpy('xml content');
                 xml_name = jasmine.createSpy('xml name');
                 xml_pkg = jasmine.createSpy('xml pkg');
@@ -129,84 +138,90 @@ describe('blackberry10 project parser', function() {
                 p.xml.version = xml_version;
                 p.xml.content = xml_content;
                 p.xml.access = {
-                    remove:xml_access_rm,
+                    remove: xml_access_rm,
                     add: xml_access_add
                 };
                 p.xml.update = xml_update;
                 p.xml.doc = {
-                    getroot:function() { return { append:xml_append}; }
+                    getroot: function () { return { append: xml_append }; }
                 };
                 p.xml.preference = {
                     add: xml_preference_add,
                     remove: xml_preference_remove
                 };
-                cfg.name = function() { return 'testname'; };
-                cfg.packageName = function() { return 'testpkg'; };
-                cfg.version = function() { return 'one point oh'; };
+                cfg.name = function () { return 'testname'; };
+                cfg.packageName = function () { return 'testpkg'; };
+                cfg.version = function () { return 'one point oh'; };
             });
         });
-        describe('www_dir method', function() {
-            it('should return /www', function() {
+        describe('www_dir method', function () {
+            it('should return /www', function () {
                 expect(p.www_dir()).toEqual(path.join(bb_proj, 'www'));
             });
         });
-        describe('config_xml method', function() {
-            it('should return the location of the config.xml', function() {
+        describe('config_xml method', function () {
+            it('should return the location of the config.xml', function () {
                 expect(p.config_xml()).toEqual(path.join(proj, 'platforms', 'blackberry10', 'www', 'config.xml'));
             });
         });
-        describe('update_www method', function() {
+        describe('update_www method', function () {
 
-            it('should rm project-level www and cp in platform agnostic www', function() {
+            it('should rm project-level www and cp in platform agnostic www', function () {
                 p.update_www();
                 expect(rm).toHaveBeenCalled();
                 expect(cp).toHaveBeenCalled();
             });
         });
-        describe('update_overrides method', function() {
-            it('should do nothing if merges directory does not exist', function() {
+        describe('update_overrides method', function () {
+            it('should do nothing if merges directory does not exist', function () {
                 exists.and.returnValue(false);
                 p.update_overrides();
                 expect(cp).not.toHaveBeenCalled();
             });
-            it('should copy merges path into www', function() {
+            it('should copy merges path into www', function () {
                 p.update_overrides();
                 expect(cp).toHaveBeenCalledWith('-rf', path.join(proj, 'merges', 'blackberry10', '*'), path.join(proj, 'platforms', 'blackberry10', 'www'));
             });
         });
-        describe('update_project method', function() {
-            var config, www, overrides, svn, parse;
-            beforeEach(function() {
+        describe('update_project method', function () {
+            /* eslint-disable no-unused-vars */
+            var config;
+            var www;
+            var overrides;
+            var svn;
+            var parse;
+            /* eslint-enable no-unused-vars */
+            beforeEach(function () {
                 config = spyOn(p, 'update_from_config');
                 www = spyOn(p, 'update_www');
                 overrides = spyOn(p, 'update_overrides');
                 svn = spyOn(util, 'deleteSvnFolders');
-                parse = spyOn(JSON, 'parse').and.returnValue({blackberry:{qnx:{}}});
+                parse = spyOn(JSON, 'parse').and.returnValue({blackberry: {qnx: {}}});
             });
-            it('should call update_from_config', function(done) {
-                wrapper(p.update_project(), done, function() {
+            it('should call update_from_config', function (done) {
+                wrapper(p.update_project(), done, function () {
                     expect(config).toHaveBeenCalled();
                 });
             });
-            it('should throw if update_from_config throws', function(done) {
+            it('should throw if update_from_config throws', function (done) {
                 var err = new Error('uh oh!');
-                config.and.callFake(function() { throw err; });
-                errorWrapper(p.update_project({}), done, function(e) {
+                config.and.callFake(function () { throw err; });
+                errorWrapper(p.update_project({}), done, function (e) {
                     expect(e).toEqual(err);
                 });
             });
-            it('should not call update_www', function(done) {
-                wrapper(p.update_project(), done, function() {
+            it('should not call update_www', function (done) {
+                wrapper(p.update_project(), done, function () {
                     expect(www).not.toHaveBeenCalled();
                 });
             });
-            it('should call update_overrides', function(done) {
-                wrapper(p.update_project(), done, function() {
+            it('should call update_overrides', function (done) {
+                wrapper(p.update_project(), done, function () {
                     expect(overrides).toHaveBeenCalled();
                 });
             });
-            it('should call deleteSvnFolders', function(done) {
-                wrapper(p.update_project(), done, function() {
+            it('should call deleteSvnFolders', function (done) {
+                wrapper(p.update_project(), done, function () {
                     expect(svn).toHaveBeenCalled();
                 });
             });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/metadata/browser_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/metadata/browser_parser.spec.js b/spec/cordova/metadata/browser_parser.spec.js
index f743706..8f94c0e 100644
--- a/spec/cordova/metadata/browser_parser.spec.js
+++ b/spec/cordova/metadata/browser_parser.spec.js
@@ -17,79 +17,83 @@
     under the License.
 */
 
-var browserParser = require('../../../src/cordova/metadata/browser_parser'),
-    util = require('../../../src/cordova/util'),
-    path = require('path'),
-    shell = require('shelljs'),
-    fs = require('fs'),
-    Parser = require('../../../src/cordova/metadata/parser');
+var browserParser = require('../../../src/cordova/metadata/browser_parser');
+var util = require('../../../src/cordova/util');
+var path = require('path');
+var shell = require('shelljs');
+var fs = require('fs');
+var Parser = require('../../../src/cordova/metadata/parser');
 
-describe('browser project parser', function() {
+describe('browser project parser', function () {
     var proj = path.join('some', 'path');
     var exists;
 
-    beforeEach(function() {
+    beforeEach(function () {
         exists = spyOn(fs, 'existsSync').and.returnValue(true);
-        spyOn(browserParser,'dirExists').and.returnValue(true);
+        spyOn(browserParser, 'dirExists').and.returnValue(true);
     });
 
-    describe('constructions', function() {
-        it('should create an instance with a path', function() {
-            expect(function() {
-                var p = new browserParser(proj);
+    describe('constructions', function () {
+        it('should create an instance with a path', function () {
+            expect(function () {
+                var p = new browserParser(proj); // eslint-disable-line new-cap
                 expect(p.path).toEqual(proj);
             }).not.toThrow();
         });
-        it('should be an instance of Parser', function() {
-            expect(new browserParser(proj) instanceof Parser).toBe(true);
+        it('should be an instance of Parser', function () {
+            expect(new browserParser(proj) instanceof Parser).toBe(true); // eslint-disable-line new-cap
         });
-        it('should call super with the correct arguments', function() {
+        it('should call super with the correct arguments', function () {
             var call = spyOn(Parser, 'call');
-            var p = new browserParser(proj);
+            var p = new browserParser(proj); // eslint-disable-line new-cap
             expect(call).toHaveBeenCalledWith(p, 'browser', proj);
         });
     });
 
-    describe('instance', function() {
-        var p, cp, rm, mkdir, is_cordova;
+    describe('instance', function () {
+        var p;
+        var cp;
+        var rm;
+        var mkdir; // eslint-disable-line no-unused-vars
+        var is_cordova; // eslint-disable-line no-unused-vars
         var browser_proj = path.join(proj, 'platforms', 'browser');
 
-        beforeEach(function() {
-            p = new browserParser(browser_proj);
+        beforeEach(function () {
+            p = new browserParser(browser_proj); // eslint-disable-line new-cap
             cp = spyOn(shell, 'cp');
             rm = spyOn(shell, 'rm');
             mkdir = spyOn(shell, 'mkdir');
             is_cordova = spyOn(util, 'isCordova').and.returnValue(proj);
         });
 
-        describe('www_dir method', function() {
-            it('should return /www', function() {
+        describe('www_dir method', function () {
+            it('should return /www', function () {
                 expect(p.www_dir()).toEqual(path.join(browser_proj, 'www'));
             });
         });
 
-        describe('config_xml method', function() {
-            it('should return the location of config.xml', function() {
+        describe('config_xml method', function () {
+            it('should return the location of config.xml', function () {
                 expect(p.config_xml()).toEqual(path.join(proj, 'platforms', 'browser', 'config.xml'));
             });
         });
 
-        describe('update_www method', function() {
-            it('should rm project-level www and cp in platform agnostic www', function() {
+        describe('update_www method', function () {
+            it('should rm project-level www and cp in platform agnostic www', function () {
                 p.update_www();
                 expect(rm).toHaveBeenCalled();
                 expect(cp).toHaveBeenCalled();
             });
         });
 
-        describe('update_overrides method', function() {
-            it('should do nothing if merges directory does not exist', function() {
+        describe('update_overrides method', function () {
+            it('should do nothing if merges directory does not exist', function () {
                 exists.and.returnValue(false);
                 p.update_overrides();
                 expect(cp).not.toHaveBeenCalled();
             });
 
-            it('should copy merges path into www', function() {
+            it('should copy merges path into www', function () {
                 p.update_overrides();
                 expect(cp).toHaveBeenCalledWith('-rf', path.join(proj, 'merges', 'browser', '*'), path.join(proj, 'platforms', 'browser', 'www'));
             });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/metadata/parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/metadata/parser.spec.js b/spec/cordova/metadata/parser.spec.js
index 89861f6..5b2ace4 100644
--- a/spec/cordova/metadata/parser.spec.js
+++ b/spec/cordova/metadata/parser.spec.js
@@ -17,33 +17,34 @@
     under the License.
 */
 
-var fs = require('fs'),
-    Parser = require('../../../src/cordova/metadata/parser'),
-    ParserHelper = require('../../../src/cordova/metadata/parserhelper/ParserHelper');
+var fs = require('fs');
+var Parser = require('../../../src/cordova/metadata/parser');
+var ParserHelper = require('../../../src/cordova/metadata/parserhelper/ParserHelper');
 
-describe('base parser', function() {
+describe('base parser', function () {
 
-    var exists, parser;
+    var exists; // eslint-disable-line no-unused-vars
+    var parser;
 
-    beforeEach(function() {
+    beforeEach(function () {
         exists = spyOn(fs, 'existsSync');
         parser = new Parser();
     });
 
-    describe('properties', function() {
+    describe('properties', function () {
 
-        it('should have properties named path and platform', function() {
+        it('should have properties named path and platform', function () {
             expect(parser.path).not.toBeUndefined();
             expect(parser.platform).not.toBeUndefined();
         });
 
-        it('should have a property named helper that is an instace of ParserHelper', function() {
+        it('should have a property named helper that is an instace of ParserHelper', function () {
             var descriptor = Object.getOwnPropertyDescriptor(parser, 'helper');
             expect(descriptor).not.toBeUndefined();
             expect(descriptor.value instanceof ParserHelper).toBe(true);
         });
 
-        it('should have an immutable helper property', function() {
+        it('should have an immutable helper property', function () {
             var value = 'foo';
             parser.helpers = value;
             expect(parser.helper instanceof ParserHelper).toBe(true);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/metadata/parserhelper/ParserHelper.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/metadata/parserhelper/ParserHelper.spec.js b/spec/cordova/metadata/parserhelper/ParserHelper.spec.js
index f495e6f..2761539 100644
--- a/spec/cordova/metadata/parserhelper/ParserHelper.spec.js
+++ b/spec/cordova/metadata/parserhelper/ParserHelper.spec.js
@@ -17,19 +17,19 @@
     under the License.
 */
 
-var path = require('path'),
-    ParserHelper = require('../../../../src/cordova/metadata/parserhelper/ParserHelper'),
-    ConfigParser = require('cordova-common').ConfigParser;
+var path = require('path');
+var ParserHelper = require('../../../../src/cordova/metadata/parserhelper/ParserHelper');
+var ConfigParser = require('cordova-common').ConfigParser;
 
 // Create a real config object before mocking out everything.
 var xml = path.join(__dirname, '..', '..', 'test-config.xml');
 var cfg = new ConfigParser(xml);
 
-describe('ParserHelper', function() {
+describe('ParserHelper', function () {
 
-    describe('constructions', function() {
+    describe('constructions', function () {
 
-        it('should pass platform name as a constructor parameter', function() {
+        it('should pass platform name as a constructor parameter', function () {
             var ph = new ParserHelper();
             expect(ph.platform).toEqual('');
             ph = new ParserHelper('some-platform');
@@ -38,20 +38,20 @@ describe('ParserHelper', function() {
 
     });
 
-    describe('instance', function() {
+    describe('instance', function () {
 
         var parserHelper;
 
-        beforeEach(function() {
+        beforeEach(function () {
             parserHelper = new ParserHelper();
         });
 
-        describe('getOrientation method', function() {
+        describe('getOrientation method', function () {
 
-            it('should return the global orientation value', function() {
+            it('should return the global orientation value', function () {
                 expect(parserHelper.getOrientation(cfg)).toEqual('portrait');
             });
-            it('should return the platform-specific orientation value', function() {
+            it('should return the platform-specific orientation value', function () {
                 var parserHelperAndroid = new ParserHelper('android');
                 expect(parserHelperAndroid.getOrientation(cfg)).toEqual('landscape');
             });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/metadata/parserhelper/preferences.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/metadata/parserhelper/preferences.spec.js b/spec/cordova/metadata/parserhelper/preferences.spec.js
index 0fef703..73dc0b9 100644
--- a/spec/cordova/metadata/parserhelper/preferences.spec.js
+++ b/spec/cordova/metadata/parserhelper/preferences.spec.js
@@ -17,26 +17,26 @@
     under the License.
 */
 
-var path = require('path'),
-    fs = require('fs'),
-    events = require('cordova-common').events,
-    preferences = require('../../../../src/cordova/metadata/parserhelper/preferences'),
-    ConfigParser = require('cordova-common').ConfigParser;
+var path = require('path');
+var fs = require('fs');
+var events = require('cordova-common').events;
+var preferences = require('../../../../src/cordova/metadata/parserhelper/preferences');
+var ConfigParser = require('cordova-common').ConfigParser;
 
 // Create a real config object before mocking out everything.
 var xml = path.join(__dirname, '..', '..', 'test-config.xml');
 var cfg = new ConfigParser(xml);
 
-describe('preferences', function() {
+describe('preferences', function () {
 
-    describe('properties', function() {
+    describe('properties', function () {
 
-        it('should define global orientation constants', function() {
+        it('should define global orientation constants', function () {
             expect(preferences.ORIENTATION_DEFAULT).toEqual('default');
             expect(preferences.ORIENTATION_PORTRAIT).toEqual('portrait');
             expect(preferences.ORIENTATION_LANDSCAPE).toEqual('landscape');
             expect(preferences.ORIENTATION_ALL).toEqual('all');
-            
+
             expect(preferences.ORIENTATION_GLOBAL_ORIENTATIONS).toEqual([ 'default', 'portrait', 'landscape' ]);
             expect(preferences.ORIENTATION_SPECIFIC_TO_A_PLATFORM_ORIENTATIONS.ios).toEqual([ 'all' ]);
             expect(preferences.ORIENTATION_SPECIFIC_TO_A_PLATFORM_ORIENTATIONS.foobar).toBeUndefined();
@@ -44,87 +44,87 @@ describe('preferences', function() {
 
     });
 
-    describe('methods', function() {
+    describe('methods', function () {
 
         var readFile, emit;
 
-        beforeEach(function() {
+        beforeEach(function () {
             readFile = spyOn(fs, 'readFileSync');
             emit = spyOn(events, 'emit');
         });
 
-        describe('isDefaultOrientation', function() {
+        describe('isDefaultOrientation', function () {
 
-            it('should return true if an orientation is the default orientation', function() {
+            it('should return true if an orientation is the default orientation', function () {
                 expect(preferences.isDefaultOrientation('default')).toBe(true);
             });
-            it('should return false if an orientation is not the default orientation', function() {
+            it('should return false if an orientation is not the default orientation', function () {
                 expect(preferences.isDefaultOrientation('some-orientation')).toBe(false);
             });
 
         });
 
-        describe('isGlobalOrientation', function() {
+        describe('isGlobalOrientation', function () {
 
-            it('should return true if an orientation is a global orientation', function() {
+            it('should return true if an orientation is a global orientation', function () {
                 expect(preferences.isGlobalOrientation('portrait')).toBe(true);
             });
-            it('should return false if an orientation is a global orientation', function() {
+            it('should return false if an orientation is a global orientation', function () {
                 expect(preferences.isGlobalOrientation('some-orientation')).toBe(false);
             });
 
         });
-        
-        describe('isOrientationSpecificToAPlatform', function() {
 
-            it('should return true if an orientation is specific to a platform', function() {
+        describe('isOrientationSpecificToAPlatform', function () {
+
+            it('should return true if an orientation is specific to a platform', function () {
                 expect(preferences.isOrientationSpecificToAPlatform('all', 'ios')).toBe(true);
                 expect(preferences.isOrientationSpecificToAPlatform('sensorLandscape', 'android')).toBe(true);
-                
+
             });
-            it('should return false if an orientation is not a specific to a platform', function() {
+            it('should return false if an orientation is not a specific to a platform', function () {
                 expect(preferences.isOrientationSpecificToAPlatform('some-orientation', 'foobar')).toBe(false);
             });
 
         });
 
-        describe('getOrientation', function() {
+        describe('getOrientation', function () {
 
-            it('should handle no platform', function() {
+            it('should handle no platform', function () {
                 expect(preferences.getOrientation(cfg)).toEqual('portrait');
                 expect(emit).not.toHaveBeenCalled();
             });
-            it('should handle undefined platform-specific orientation', function() {
+            it('should handle undefined platform-specific orientation', function () {
                 expect(preferences.getOrientation(cfg, 'ios')).toEqual('portrait');
                 expect(emit).not.toHaveBeenCalled();
             });
-            it('should handle platform-specific orientation', function() {
+            it('should handle platform-specific orientation', function () {
                 expect(preferences.getOrientation(cfg, 'android')).toEqual('landscape');
             });
-            it('should handle orientation specific to a platform', function() {
+            it('should handle orientation specific to a platform', function () {
                 var configXml, configParser;
-                
+
                 configXml = '<?xml version="1.0" encoding="UTF-8"?><widget><preference name="orientation" value="all" /></widget>';
                 readFile.and.returnValue(configXml);
                 configParser = new ConfigParser(xml);
 
                 expect(preferences.getOrientation(configParser, 'ios')).toEqual('all');
-                
+
                 configXml = '<?xml version="1.0" encoding="UTF-8"?><widget><preference name="orientation" value="sensorLandscape" /></widget>';
                 readFile.and.returnValue(configXml);
                 configParser = new ConfigParser(xml);
-                
+
                 expect(preferences.getOrientation(configParser, 'android')).toEqual('sensorLandscape');
             });
-            
-            it('should handle no orientation', function() {
+
+            it('should handle no orientation', function () {
                 var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget></widget>';
                 readFile.and.returnValue(configXml);
                 var configParser = new ConfigParser(xml);
                 expect(preferences.getOrientation(configParser)).toEqual('');
                 expect(emit).not.toHaveBeenCalled();
             });
-            it('should handle invalid global orientation', function() {
+            it('should handle invalid global orientation', function () {
                 var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget><preference name="orientation" value="foobar" /></widget>';
                 readFile.and.returnValue(configXml);
                 var configParser = new ConfigParser(xml);
@@ -132,8 +132,8 @@ describe('preferences', function() {
                 expect(emit).toHaveBeenCalledWith('warn', 'Unsupported global orientation: foobar');
                 expect(emit).toHaveBeenCalledWith('warn', 'Defaulting to value: default');
             });
-            
-            it('should handle custom platform-specific orientation', function() {
+
+            it('should handle custom platform-specific orientation', function () {
                 var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget><platform name="some-platform"><preference name="orientation" value="foobar" /></platform></widget>';
                 readFile.and.returnValue(configXml);
                 var configParser = new ConfigParser(xml);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/metadata/webos_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/metadata/webos_parser.spec.js b/spec/cordova/metadata/webos_parser.spec.js
index 796306f..0f4091d 100755
--- a/spec/cordova/metadata/webos_parser.spec.js
+++ b/spec/cordova/metadata/webos_parser.spec.js
@@ -16,40 +16,51 @@
     specific language governing permissions and limitations
     under the License.
 */
-var webosParser = require('../../../src/cordova/metadata/webos_parser'),
-    util = require('../../../src/cordova/util'),
-    path = require('path'),
-    shell = require('shelljs'),
-    fs = require('fs'),
-    config = require('../../../src/cordova/config'),
-    ConfigParser = require('cordova-common').ConfigParser;
+var webosParser = require('../../../src/cordova/metadata/webos_parser');
+var util = require('../../../src/cordova/util');
+var path = require('path');
+var shell = require('shelljs');
+var fs = require('fs');
+var config = require('../../../src/cordova/config');
+var ConfigParser = require('cordova-common').ConfigParser;
 
 var cfg = new ConfigParser(path.join(__dirname, '..', 'test-config.xml'));
-describe('webos project parser', function() {
+describe('webos project parser', function () {
     var proj = path.join('some', 'path');
-    var exists, exec, custom;
-    beforeEach(function() {
+    /* eslint-disable no-unused-vars */
+    var exists;
+    var exec;
+    var custom;
+    /* eslint-enable no-unused-vars */
+    beforeEach(function () {
         exists = spyOn(fs, 'existsSync').and.returnValue(true);
-        exec = spyOn(shell, 'exec').and.callFake(function(cmd, opts, cb) {
-            cb(0, '');
+        exec = spyOn(shell, 'exec').and.callFake(function (cmd, opts, cb) {
+            cb(0, ''); // eslint-disable-line standard/no-callback-literal
         });
         custom = spyOn(config, 'has_custom_path').and.returnValue(false);
     });
 
-    describe('constructions', function() {
-        it('should create an instance with a path', function() {
-            expect(function() {
-                var p = new webosParser(proj);
+    describe('constructions', function () {
+        it('should create an instance with a path', function () {
+            expect(function () {
+                var p = new webosParser(proj); // eslint-disable-line new-cap
                 expect(p.path).toEqual(proj);
             }).not.toThrow();
         });
     });
 
-    describe('instance', function() {
-        var p, cp, rm, is_cordova, write, read;
+    describe('instance', function () {
+        /* eslint-disable no-unused-vars */
+        var p;
+        var cp;
+        var rm;
+        var is_cordova;
+        var write;
+        var read;
+        /* eslint-enable no-unused-vars */
         var wos_proj = path.join(proj, 'platforms', 'webos');
-        beforeEach(function() {
-            p = new webosParser(wos_proj);
+        beforeEach(function () {
+            p = new webosParser(wos_proj); // eslint-disable-line new-cap
             cp = spyOn(shell, 'cp');
             rm = spyOn(shell, 'rm');
             is_cordova = spyOn(util, 'isCordova').and.returnValue(proj);
@@ -57,17 +68,17 @@ describe('webos project parser', function() {
             read = spyOn(fs, 'readFileSync').and.returnValue('');
         });
 
-        describe('update_from_config method', function() {
-            beforeEach(function() {
-                cfg.name = function() { return 'testname'; };
-                cfg.packageName = function() { return 'testpkg'; };
-                cfg.version = function() { return '1.0'; };
+        describe('update_from_config method', function () {
+            beforeEach(function () {
+                cfg.name = function () { return 'testname'; };
+                cfg.packageName = function () { return 'testpkg'; };
+                cfg.version = function () { return '1.0'; };
             });
 
-          /*  it('should write appinfo.json', function() {
+            /*  it('should write appinfo.json', function() {
                 //p.update_from_config(cfg);
                 //expect(write.mostRecentCall.args[0]).toEqual('appinfo.json');
-            });*/
+            }); */
         });
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/platform/addHelper.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/platform/addHelper.spec.js b/spec/cordova/platform/addHelper.spec.js
index b6de9b9..fc5ef40 100644
--- a/spec/cordova/platform/addHelper.spec.js
+++ b/spec/cordova/platform/addHelper.spec.js
@@ -108,8 +108,8 @@ describe('cordova/platform/addHelper', function () {
 
         it('should log if host OS does not support the specified platform', function (done) {
             cordova_util.hostSupports.and.returnValue(false);
-            platform_addHelper('add', hooks_mock, projectRoot, ['atari']).then(function() {
-        fail('addHelper success handler unexpectedly invoked');
+            platform_addHelper('add', hooks_mock, projectRoot, ['atari']).then(function () {
+                fail('addHelper success handler unexpectedly invoked');
             }).fail(function (e) {
                 expect(cordova_util.hostSupports).toHaveBeenCalled();
                 expect(events.emit).toHaveBeenCalledWith('warning', jasmine.stringMatching(/WARNING: Applications/));
@@ -125,7 +125,7 @@ describe('cordova/platform/addHelper', function () {
             }).done(done);
         });
 
-        it('should throw if platform was not added before updating', function(done) {
+        it('should throw if platform was not added before updating', function (done) {
             platform_addHelper('update', hooks_mock, projectRoot, ['atari']).then(function () {
                 fail('addHelper success handler unexpectedly invoked');
             }).fail(function (e) {
@@ -150,7 +150,7 @@ describe('cordova/platform/addHelper', function () {
             it('should retrieve platform details from directories-specified-as-platforms using getPlatformDetailsFromDir', function (done) {
                 cordova_util.isDirectory.and.returnValue(true);
                 var directory_to_platform = '/path/to/cordova-atari';
-                platform_addHelper('add', hooks_mock, projectRoot, [directory_to_platform], {restoring:true}).then(function () {
+                platform_addHelper('add', hooks_mock, projectRoot, [directory_to_platform], {restoring: true}).then(function () {
                     expect(platform_module.getPlatformDetailsFromDir).toHaveBeenCalledWith(directory_to_platform, null);
                     expect(platform_addHelper.downloadPlatform).not.toHaveBeenCalled();
                 }).fail(function (e) {
@@ -162,7 +162,7 @@ describe('cordova/platform/addHelper', function () {
             it('should retrieve platform details from URLs-specified-as-platforms using downloadPlatform', function (done) {
                 cordova_util.isUrl.and.returnValue(true);
                 var url_to_platform = 'http://github.com/apache/cordova-atari';
-                platform_addHelper('add', hooks_mock, projectRoot, [url_to_platform], {restoring:true}).then(function () {
+                platform_addHelper('add', hooks_mock, projectRoot, [url_to_platform], {restoring: true}).then(function () {
                     expect(platform_addHelper.downloadPlatform).toHaveBeenCalledWith(projectRoot, null, url_to_platform, jasmine.any(Object));
                 }).fail(function (e) {
                     fail('fail handler unexpectedly invoked');
@@ -171,7 +171,7 @@ describe('cordova/platform/addHelper', function () {
             });
 
             it('should attempt to retrieve from config.xml if exists and package.json does not', function (done) {
-                platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {restoring:true}).then(function() {
+                platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {restoring: true}).then(function () {
                     expect(platform_addHelper.getVersionFromConfigFile).toHaveBeenCalled();
                 }).fail(function (e) {
                     fail('fail handler unexpectedly invoked');
@@ -180,7 +180,7 @@ describe('cordova/platform/addHelper', function () {
             });
 
             it('should fall back to using pinned version if both package.json and config.xml do not specify it', function (done) {
-                platform_addHelper('add', hooks_mock, projectRoot, ['ios'], {restoring:true}).then(function() {
+                platform_addHelper('add', hooks_mock, projectRoot, ['ios'], {restoring: true}).then(function () {
                     expect(events.emit).toHaveBeenCalledWith('verbose', 'Grabbing pinned version.');
                 }).fail(function (e) {
                     fail('fail handler unexpectedly invoked');
@@ -192,7 +192,7 @@ describe('cordova/platform/addHelper', function () {
                 cordova_util.isDirectory.and.returnValue(projectRoot);
                 cordova_util.fixRelativePath.and.returnValue(projectRoot);
                 spyOn(path, 'resolve').and.callThrough();
-                platform_addHelper('add', hooks_mock, projectRoot, ['ios'], {save:true, fetch: true, restoring:true}).then(function() {
+                platform_addHelper('add', hooks_mock, projectRoot, ['ios'], {save: true, fetch: true, restoring: true}).then(function () {
                     expect(fetch_mock).toHaveBeenCalled();
                 }).fail(function (e) {
                     fail('fail handler unexpectedly invoked');
@@ -204,7 +204,7 @@ describe('cordova/platform/addHelper', function () {
         describe('platform api invocation', function () {
 
             it('should invoke the createPlatform platform API method when adding a platform, providing destination location, parsed config file and platform detail options as arguments', function (done) {
-                platform_addHelper('add', hooks_mock, projectRoot, ['ios'], {save: true, fetch: true, restoring:true}).then(function(result) {
+                platform_addHelper('add', hooks_mock, projectRoot, ['ios'], {save: true, fetch: true, restoring: true}).then(function (result) {
                     expect(platform_api_mock.createPlatform).toHaveBeenCalled();
                 }).fail(function (err) {
                     fail('unexpected failure handler invoked!');
@@ -212,10 +212,10 @@ describe('cordova/platform/addHelper', function () {
                 }).done(done);
             });
 
-            it('should invoke the update platform API method when updating a platform, providing destination location and plaform detail options as arguments', function(done) {
+            it('should invoke the update platform API method when updating a platform, providing destination location and plaform detail options as arguments', function (done) {
                 cordova_util.isDirectory.and.returnValue(true);
                 fs.existsSync.and.returnValue(true);
-                platform_addHelper('update', hooks_mock, projectRoot, ['ios'], {restoring:true}).then(function(result) {
+                platform_addHelper('update', hooks_mock, projectRoot, ['ios'], {restoring: true}).then(function (result) {
                     expect(platform_api_mock.updatePlatform).toHaveBeenCalled();
                 }).fail(function (err) {
                     fail('unexpected failure handler invoked!');
@@ -229,7 +229,7 @@ describe('cordova/platform/addHelper', function () {
             describe('when the restoring option is not provided', function () {
                 // test is commented out b/c preparePlatforms can't be spied on as it is dynamically required due to circular references.
                 xit('should invoke preparePlatforms twice (?!?), once before installPluginsForNewPlatforms and once after... ?!', function (done) {
-                    platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {save: true, fetch: true}).then(function(result) {
+                    platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {save: true, fetch: true}).then(function (result) {
                         expect(prepare.preparePlatforms).toHaveBeenCalledWith([ 'atari' ], '/some/path', Object({ searchpath: undefined }));
                     }).fail(function (err) {
                         fail('unexpected failure handler invoked!');
@@ -239,7 +239,7 @@ describe('cordova/platform/addHelper', function () {
             });
 
             it('should invoke the installPluginsForNewPlatforms method in the platform-add case', function (done) {
-                platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {save: true, fetch: true, restoring:true}).then(function(result) {
+                platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {save: true, fetch: true, restoring: true}).then(function (result) {
                     expect(platform_addHelper.installPluginsForNewPlatform).toHaveBeenCalled();
                 }).fail(function (err) {
                     fail('unexpected failure handler invoked!');
@@ -248,7 +248,7 @@ describe('cordova/platform/addHelper', function () {
             });
 
             it('should save the platform metadata', function (done) {
-                platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {save: true, fetch: true, restoring:true}).then(function(result) {
+                platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {save: true, fetch: true, restoring: true}).then(function (result) {
                     expect(platform_metadata.save).toHaveBeenCalledWith('/some/path', 'atari', undefined);
                 }).fail(function (err) {
                     fail('unexpected failure handler invoked!');
@@ -257,7 +257,7 @@ describe('cordova/platform/addHelper', function () {
             });
 
             it('should write out the version of platform just added/updated to config.xml if the save option is provided', function (done) {
-                platform_addHelper('add', hooks_mock, projectRoot, ['ios'], {save: true, restoring:true}).then(function(result) {
+                platform_addHelper('add', hooks_mock, projectRoot, ['ios'], {save: true, restoring: true}).then(function (result) {
                     expect(cfg_parser_mock.prototype.removeEngine).toHaveBeenCalled();
                     expect(cfg_parser_mock.prototype.addEngine).toHaveBeenCalled();
                     expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
@@ -268,17 +268,17 @@ describe('cordova/platform/addHelper', function () {
             });
 
             describe('if the project contains a package.json', function () {
-                it('should write out the platform just added/updated to the cordova.platforms property of package.json',function (done) {
-                    fs.existsSync.and.callFake(function(filePath) {
-                        if(path.basename(filePath) === 'package.json') {
+                it('should write out the platform just added/updated to the cordova.platforms property of package.json', function (done) {
+                    fs.existsSync.and.callFake(function (filePath) {
+                        if (path.basename(filePath) === 'package.json') {
                             return true;
                         } else {
                             return false;
                         }
                     });
-                    package_json_mock.cordova = {'platforms':['ios']};
+                    package_json_mock.cordova = {'platforms': ['ios']};
                     cordova_util.requireNoCache.and.returnValue(package_json_mock);
-                    platform_addHelper('add', hooks_mock, projectRoot, ['android'], {save: true, restoring:true}).then(function(result) {
+                    platform_addHelper('add', hooks_mock, projectRoot, ['android'], {save: true, restoring: true}).then(function (result) {
                         expect(fs.writeFileSync).toHaveBeenCalled();
                     }).fail(function (err) {
                         fail('unexpected failure handler invoked!');
@@ -287,9 +287,9 @@ describe('cordova/platform/addHelper', function () {
                 });
 
                 it('should only write the package.json file if it was modified', function (done) {
-                    package_json_mock.cordova = {'platforms':['ios']};
+                    package_json_mock.cordova = {'platforms': ['ios']};
                     cordova_util.requireNoCache.and.returnValue(package_json_mock);
-                    platform_addHelper('add', hooks_mock, projectRoot, ['ios'], {save: true, restoring:true}).then(function(result) {
+                    platform_addHelper('add', hooks_mock, projectRoot, ['ios'], {save: true, restoring: true}).then(function (result) {
                         expect(fs.writeFileSync).not.toHaveBeenCalled();
                     }).fail(function (err) {
                         fail('unexpected failure handler invoked!');
@@ -297,9 +297,9 @@ describe('cordova/platform/addHelper', function () {
                     }).done(done);
                 });
 
-                it('should file the after_platform_* hook',function (done) {
-                    platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {save: true, restoring:true}).then(function(result) {
-                        expect(hooks_mock.fire).toHaveBeenCalledWith( 'before_platform_add', Object({ save: true, restoring: true, searchpath: undefined }));
+                it('should file the after_platform_* hook', function (done) {
+                    platform_addHelper('add', hooks_mock, projectRoot, ['atari'], {save: true, restoring: true}).then(function (result) {
+                        expect(hooks_mock.fire).toHaveBeenCalledWith('before_platform_add', Object({ save: true, restoring: true, searchpath: undefined }));
                     }).fail(function (err) {
                         fail('unexpected failure handler invoked!');
                         console.error(err);
@@ -334,7 +334,7 @@ describe('cordova/platform/addHelper', function () {
                     expect(Q.reject).toHaveBeenCalled();
                     expect(events.emit).toHaveBeenCalledWith('verbose', 'Cloning failed. Let\'s try handling it as a tarball');
                 }).done(done);
-            },60000);
+            }, 60000);
 
             it('should reject the promise should lazy_load.based_on_config fail', function (done) {
                 spyOn(gitclone, 'clone').and.callThrough();
@@ -347,7 +347,7 @@ describe('cordova/platform/addHelper', function () {
                     expect(Q.reject).toHaveBeenCalled();
                     expect(lazy_load.based_on_config).not.toHaveBeenCalled();
                 }).done(done);
-            },60000);
+            }, 60000);
 
             it('should reject the promise should both git_clone and based_on_config fail after the latter was fallen back on', function (done) {
                 lazy_load.git_clone.and.returnValue(Q.reject('git_clone failed'));
@@ -359,7 +359,7 @@ describe('cordova/platform/addHelper', function () {
                 }).fail(function (e) {
                     expect(Q.reject).toHaveBeenCalled();
                 }).done(done);
-            },60000);
+            }, 60000);
         });
         describe('happy path', function () {
             it('should invoke cordova-fetch if fetch was provided as an option', function (done) {
@@ -383,35 +383,35 @@ describe('cordova/platform/addHelper', function () {
                 }).fail(function (e) {
                     fail('fail handler unexpectedly invoked');
                 }).done(done);
-            },60000);
+            }, 60000);
 
             it('should attempt to lazy_load.based_on_config if lazy_load.git_clone fails', function (done) {
                 cordova_util.isUrl.and.returnValue(true);
                 platform_addHelper.downloadPlatform(projectRoot, 'android', 'https://github.com/apache/cordova-android', {save: true}).then(function () {
                     expect(events.emit).toHaveBeenCalledWith('verbose', '"git" command line tool is not installed: make sure it is accessible on your PATH.');
-                    expect(events.emit).toHaveBeenCalledWith('verbose','Cloning failed. Let\'s try handling it as a tarball');
+                    expect(events.emit).toHaveBeenCalledWith('verbose', 'Cloning failed. Let\'s try handling it as a tarball');
                     expect(lazy_load.based_on_config).toHaveBeenCalled();
                 }).fail(function (e) {
                     fail('fail handler unexpectedly invoked');
                 }).done(done);
-            },60000);
-            
+            }, 60000);
+
             it('should by default attempt to lazy_load.based_on_config', function (done) {
-                platform_addHelper.downloadPlatform(projectRoot, 'android', '6.0.0', {save:true}).then(function () {
+                platform_addHelper.downloadPlatform(projectRoot, 'android', '6.0.0', {save: true}).then(function () {
                     expect(lazy_load.based_on_config).toHaveBeenCalledWith('/some/path', 'android@6.0.0', Object({ save: true }));
                 }).fail(function (e) {
                     fail('fail handler unexpectedly invoked');
                 }).done(done);
-            },60000);
+            }, 60000);
 
             it('should pass along a libDir argument to getPlatformDetailsFromDir on a successful platform download', function (done) {
                 cordova_util.isUrl.and.returnValue(true);
-                platform_addHelper.downloadPlatform(projectRoot, 'android', 'https://github.com/apache/cordova-android', {save:true}).then(function () {
+                platform_addHelper.downloadPlatform(projectRoot, 'android', 'https://github.com/apache/cordova-android', {save: true}).then(function () {
                     expect(require('../../../src/cordova/platform/index').getPlatformDetailsFromDir).toHaveBeenCalled();
                 }).fail(function (e) {
                     fail('fail handler unexpectedly invoked');
                 }).done(done);
-            },60000);
+            }, 60000);
         });
     });
     describe('installPluginsForNewPlatform', function () {
@@ -432,7 +432,7 @@ describe('cordova/platform/addHelper', function () {
         it('should invoke plugman.install, giving correct platform, plugin and other arguments', function (done) {
             spyOn(cordova_util, 'findPlugins').and.returnValue(['cordova-plugin-whitelist']);
             fetch_metadata.get_fetch_metadata.and.returnValue({ });
-            platform_addHelper.installPluginsForNewPlatform('browser', projectRoot, {save:true , fetch:true}).then(function () {
+            platform_addHelper.installPluginsForNewPlatform('browser', projectRoot, {save: true, fetch: true}).then(function () {
                 expect(plugman.install).toHaveBeenCalled();
                 expect(events.emit).toHaveBeenCalledWith('verbose', 'Installing plugin "cordova-plugin-whitelist" following successful platform add of browser');
             }).fail(function (e) {
@@ -443,9 +443,9 @@ describe('cordova/platform/addHelper', function () {
         it('should include any plugin variables as options when invoking plugman install', function (done) {
             spyOn(cordova_util, 'findPlugins').and.returnValue(['cordova-plugin-camera']);
             fetch_metadata.get_fetch_metadata.and.returnValue({ source: {}, variables: {} });
-            platform_addHelper.installPluginsForNewPlatform('browser', projectRoot, {save:true , fetch:true}).then(function () {
+            platform_addHelper.installPluginsForNewPlatform('browser', projectRoot, {save: true, fetch: true}).then(function () {
                 expect(plugman.install).toHaveBeenCalled();
-                expect(events.emit).toHaveBeenCalledWith( 'verbose', 'Found variables for "cordova-plugin-camera". Processing as cli_variables.' );
+                expect(events.emit).toHaveBeenCalledWith('verbose', 'Found variables for "cordova-plugin-camera". Processing as cli_variables.');
             }).fail(function (e) {
                 fail('fail handler unexpectedly invoked');
             }).done(done);


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


[14/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
CB-12895 : ran eslint --fix on cordova-lib


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

Branch: refs/heads/master
Commit: 17438d2b51b6db6f09f66c04d07a2d6b36079323
Parents: 17be6c6
Author: Audrey So <au...@apache.org>
Authored: Wed Jul 19 09:54:49 2017 -0700
Committer: Audrey So <au...@apache.org>
Committed: Fri Jul 28 10:58:31 2017 -0700

----------------------------------------------------------------------
 integration-tests/.eslintrc.yml                 |    2 +
 integration-tests/HooksRunner.spec.js           |  133 +-
 integration-tests/fetch.spec.js                 |   88 +-
 integration-tests/pkgJson-restore.spec.js       | 2155 +++++++++---------
 integration-tests/pkgJson.spec.js               |  419 ++--
 integration-tests/platform.spec.js              |  178 +-
 integration-tests/plugin.spec.js                |  120 +-
 integration-tests/plugin_fetch.spec.js          |  253 +-
 integration-tests/plugman_fetch.spec.js         |  215 +-
 integration-tests/plugman_uninstall.spec.js     |  139 +-
 spec/common.js                                  |   20 +-
 spec/cordova/build.spec.js                      |   97 +-
 spec/cordova/compile.spec.js                    |  160 +-
 spec/cordova/cordova-lib.spec.js                |    4 +-
 spec/cordova/create.spec.js                     |   64 +-
 spec/cordova/emulate.spec.js                    |  226 +-
 spec/cordova/lazy_load.spec.js                  |  176 +-
 spec/cordova/metadata/blackberry_parser.spec.js |  143 +-
 spec/cordova/metadata/browser_parser.spec.js    |   64 +-
 spec/cordova/metadata/parser.spec.js            |   21 +-
 .../metadata/parserhelper/ParserHelper.spec.js  |   22 +-
 .../metadata/parserhelper/preferences.spec.js   |   70 +-
 spec/cordova/metadata/webos_parser.spec.js      |   65 +-
 spec/cordova/platform/addHelper.spec.js         |   78 +-
 spec/cordova/platform/index.spec.js             |  176 +-
 spec/cordova/platforms/PlatformApiPoly.spec.js  |  173 +-
 spec/cordova/platforms/platforms.spec.js        |    6 +-
 spec/cordova/plugin/search.spec.js              |    2 -
 spec/cordova/prepare.spec.js                    |   46 +-
 spec/cordova/project-metadata-apis.spec.js      |    8 +-
 spec/cordova/run.spec.js                        |  139 +-
 spec/cordova/serve.spec.js                      |   89 +-
 spec/cordova/util.spec.js                       |  127 +-
 spec/helpers.js                                 |   38 +-
 spec/plugman/add_platform.spec.js               |   54 +-
 spec/plugman/config.spec.js                     |   10 +-
 spec/plugman/create.spec.js                     |   82 +-
 spec/plugman/info.spec.js                       |   10 +-
 spec/plugman/install.spec.js                    |  615 ++---
 spec/plugman/owner.spec.js                      |   10 +-
 spec/plugman/platforms/blackberry10.spec.js     |   96 +-
 spec/plugman/platforms/common.spec.js           |  104 +-
 spec/plugman/platforms/tizen.spec.js            |   55 +-
 .../projects/android/platform_www/cordova.js    |    3 -
 spec/plugman/registry/registry.spec.js          |  120 +-
 spec/plugman/search.spec.js                     |   12 +-
 spec/plugman/util/csproj.spec.js                |   60 +-
 spec/plugman/util/dependencies.spec.js          |   40 +-
 src/CordovaExternalToolErrorContext.js          |    8 +-
 src/cordova/build.js                            |   24 +-
 src/cordova/clean.js                            |   36 +-
 src/cordova/compile.js                          |   43 +-
 src/cordova/config.js                           |   24 +-
 src/cordova/cordova.js                          |   24 +-
 src/cordova/create.js                           |    2 +-
 src/cordova/emulate.js                          |   57 +-
 src/cordova/info.js                             |   79 +-
 src/cordova/lazy_load.js                        |  168 +-
 src/cordova/metadata/blackberry10_parser.js     |   60 +-
 src/cordova/metadata/browser_parser.js          |   42 +-
 src/cordova/metadata/parser.js                  |    2 -
 .../metadata/parserhelper/ParserHelper.js       |    4 +-
 .../metadata/parserhelper/preferences.js        |   24 +-
 src/cordova/metadata/ubuntu_parser.js           |   90 +-
 src/cordova/metadata/webos_parser.js            |   91 +-
 src/cordova/platform/addHelper.js               |  372 +--
 src/cordova/platform/check.js                   |  176 +-
 src/cordova/platform/list.js                    |   44 +-
 src/cordova/platform/remove.js                  |  106 +-
 src/cordova/platform_metadata.js                |   40 +-
 src/cordova/plugin/add.js                       |  295 ++-
 src/cordova/plugin/list.js                      |   86 +-
 src/cordova/plugin/plugin_spec_parser.js        |    2 +-
 src/cordova/plugin/remove.js                    |  142 +-
 src/cordova/plugin/search.js                    |   26 +-
 src/cordova/prepare.js                          |  120 +-
 src/cordova/project_metadata.js                 |   13 +-
 src/cordova/remote_load.js                      |   14 +-
 src/cordova/requirements.js                     |   11 +-
 src/cordova/restore-util.js                     |  126 +-
 src/cordova/run.js                              |   61 +-
 src/cordova/serve.js                            |   82 +-
 src/cordova/targets.js                          |   24 +-
 src/cordova/util.js                             |  161 +-
 src/gitclone.js                                 |   53 +-
 src/hooks/Context.js                            |   14 +-
 src/hooks/HooksRunner.js                        |   90 +-
 src/hooks/scriptsFinder.js                      |   46 +-
 src/platforms/PlatformApiPoly.js                |  240 +-
 src/platforms/platforms.js                      |   10 +-
 src/plugman/browserify.js                       |  188 +-
 src/plugman/config.js                           |    2 +-
 src/plugman/create.js                           |   77 +-
 src/plugman/createpackagejson.js                |   38 +-
 src/plugman/fetch.js                            |  223 +-
 src/plugman/help.js                             |    6 +-
 src/plugman/info.js                             |    2 +-
 src/plugman/init-defaults.js                    |   65 +-
 src/plugman/install.js                          |  375 ++-
 src/plugman/owner.js                            |    2 +-
 src/plugman/platform.js                         |  104 +-
 src/plugman/platform_operation.js               |    4 +-
 src/plugman/platforms/blackberry10.js           |   45 +-
 src/plugman/platforms/browser.js                |   37 +-
 src/plugman/platforms/common.js                 |   78 +-
 src/plugman/platforms/tizen.js                  |   40 +-
 src/plugman/platforms/ubuntu.js                 |   77 +-
 src/plugman/platforms/webos.js                  |   40 +-
 src/plugman/plugman.js                          |   66 +-
 src/plugman/registry/manifest.js                |   66 +-
 src/plugman/registry/registry.js                |   52 +-
 src/plugman/search.js                           |    2 +-
 src/plugman/uninstall.js                        |  209 +-
 src/plugman/util/android-project.js             |   46 +-
 src/plugman/util/default-engines.js             |   46 +-
 src/plugman/util/dependencies.js                |   58 +-
 src/plugman/util/metadata.js                    |    9 +-
 src/plugman/util/plist-helpers.js               |   52 +-
 src/plugman/util/plugins.js                     |   21 +-
 src/plugman/util/search-and-replace.js          |   10 +-
 src/plugman/util/strip-license.js               |    2 +-
 src/util/alias.js                               |    4 +-
 src/util/npm-helper.js                          |   26 +-
 src/util/promise-util.js                        |   20 +-
 src/util/unpack.js                              |   47 +-
 src/util/windows/csproj.js                      |   56 +-
 src/util/windows/jsprojManager.js               |  151 +-
 templates/base.js                               |    4 +-
 128 files changed, 6199 insertions(+), 6270 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/integration-tests/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/integration-tests/.eslintrc.yml b/integration-tests/.eslintrc.yml
new file mode 100644
index 0000000..6afba65
--- /dev/null
+++ b/integration-tests/.eslintrc.yml
@@ -0,0 +1,2 @@
+env:
+    jasmine: true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/integration-tests/HooksRunner.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/HooksRunner.spec.js b/integration-tests/HooksRunner.spec.js
index f076c16..3a4c69c 100644
--- a/integration-tests/HooksRunner.spec.js
+++ b/integration-tests/HooksRunner.spec.js
@@ -21,11 +21,11 @@
 
 var cordova = require('../src/cordova/cordova'),
     HooksRunner = require('../src/hooks/HooksRunner'),
-    shell  = require('shelljs'),
-    path   = require('path'),
-    fs     = require('fs'),
-    os     = require('os'),
-    Q      = require('q'),
+    shell = require('shelljs'),
+    path = require('path'),
+    fs = require('fs'),
+    os = require('os'),
+    Q = require('q'),
     child_process = require('child_process'),
     helpers = require('../spec/helpers'),
     PluginInfo = require('cordova-common').PluginInfo,
@@ -39,7 +39,7 @@ var dotCordova = path.join(project, '.cordova');
 var hooksDir = path.join(project, 'hooks');
 var hooksDirDot = path.join(project, '.cordova', 'hooks');
 var scriptsDir = path.join(project, 'scripts');
-var ext = platform.match(/(win32|win64)/)?'bat':'sh';
+var ext = platform.match(/(win32|win64)/) ? 'bat' : 'sh';
 var fixtures = path.join(__dirname, '..', 'spec', 'cordova', 'fixtures');
 var testPluginFixturePath = path.join(fixtures, 'plugins', 'com.plugin.withhooks');
 
@@ -54,7 +54,7 @@ shell.mkdir('-p', dotCordova);
 shell.cp('-R', path.join(fixtures, 'projWithHooks', '.cordova'), project);
 
 // copy sh/bat scripts
-if(ext === 'bat') {
+if (ext === 'bat') {
     shell.cp('-R', path.join(fixtures, 'projWithHooks', '_bat', '*'), project);
     shell.cp('-R', path.join(fixtures, 'projWithHooks', '_bat', '.cordova'), project);
 } else {
@@ -68,39 +68,39 @@ shell.chmod('-R', 'ug+x', scriptsDir);
 
 // To get more verbose output to help trace program flow, uncomment the lines below
 // TODO: think about how to factor this out so that it can be invoked from the command line
-//var events = require('cordova-common').events;
-//events.on('log', function(msg) { console.log(msg); });
-//events.on('verbose', function(msg) { console.log(msg); });
-//events.on('warn', function(msg) { console.log(msg); });
+// var events = require('cordova-common').events;
+// events.on('log', function(msg) { console.log(msg); });
+// events.on('verbose', function(msg) { console.log(msg); });
+// events.on('warn', function(msg) { console.log(msg); });
 
-describe('HooksRunner', function() {
+describe('HooksRunner', function () {
     var hooksRunner;
     var hookOptions;
     var testPluginInstalledPath;
     var projectRoot;
     var fire;
 
-    beforeEach(function() {
+    beforeEach(function () {
         process.chdir(project);
     });
 
-    afterEach(function() {
+    afterEach(function () {
         process.chdir(path.join(__dirname, '..'));  // Non e2e tests assume CWD is repo root.
     });
 
-    it('Test 001 : should throw if provided directory is not a cordova project', function() {
-        expect(function() {
+    it('Test 001 : should throw if provided directory is not a cordova project', function () {
+        expect(function () {
             new HooksRunner(tmpDir);
         }).toThrow();
     });
 
-    it('Test 002 : should not throw if provided directory is a cordova project', function() {
+    it('Test 002 : should not throw if provided directory is a cordova project', function () {
         expect(function () {
             new HooksRunner(project);
         }).not.toThrow();
     });
 
-    it('Test 003 : should init test fixtures', function(done) {
+    it('Test 003 : should init test fixtures', function (done) {
         hooksRunner = new HooksRunner(project);
 
         // Now we load the config.json in the newly created project and edit the target platform's lib entry
@@ -111,11 +111,11 @@ describe('HooksRunner', function() {
 
         // The config.json in the fixture project points at fake "local" paths.
         // Since it's not a URL, the lazy-loader will just return the junk path.
-        spyOn(superspawn, 'spawn').and.callFake(function(cmd, args) {
+        spyOn(superspawn, 'spawn').and.callFake(function (cmd, args) {
             if (cmd.match(/create\b/)) {
                 // This is a call to the bin/create script, so do the copy ourselves.
                 shell.cp('-R', path.join(fixtures, 'platforms', 'android'), path.join(project, 'platforms'));
-            } else if(cmd.match(/update\b/)) {
+            } else if (cmd.match(/update\b/)) {
                 fs.writeFileSync(path.join(project, 'platforms', helpers.testPlatform, 'updated'), 'I was updated!', 'utf-8');
             } else if (cmd.match(/version/)) {
                 return '3.6.0';
@@ -123,7 +123,6 @@ describe('HooksRunner', function() {
             return Q();
         });
 
-
         // Add the testing platform.
         cordova.platform('add', [helpers.testPlatform]).fail(function (err) {
             expect(err).toBeUndefined();
@@ -154,8 +153,8 @@ describe('HooksRunner', function() {
         });
     }, 100000);
 
-    describe('fire method', function() {
-        beforeEach(function() {
+    describe('fire method', function () {
+        beforeEach(function () {
             projectRoot = cordovaUtil.isCordova();
 
             var options = {
@@ -174,12 +173,12 @@ describe('HooksRunner', function() {
         });
 
         // helper methods
-        function hooksOrderFileContents(hooksOrderFile) {
+        function hooksOrderFileContents (hooksOrderFile) {
             var order = fs.readFileSync(hooksOrderFile, 'ascii').replace(/\W/gm, ' ');
 
             var orderArrOriginal = order.split(' ').slice(0);
 
-            function splitNumbers(mixedString) {
+            function splitNumbers (mixedString) {
                 var re = /\w+/g, match, params = [];
 
                 while (match = re.exec(mixedString)) {
@@ -188,77 +187,77 @@ describe('HooksRunner', function() {
                 return params;
             }
 
-            return splitNumbers(orderArrOriginal).map(function(str) { return parseInt(str, 10); });
+            return splitNumbers(orderArrOriginal).map(function (str) { return parseInt(str, 10); });
         }
 
-        function hooksOrderFileIsOrdered(hooksOrderFile) {
+        function hooksOrderFileIsOrdered (hooksOrderFile) {
             var splitArrOriginal = hooksOrderFileContents(hooksOrderFile);
-            var splitArrSorted = splitArrOriginal.slice(0).sort(function(a, b) { return a - b; });
+            var splitArrSorted = splitArrOriginal.slice(0).sort(function (a, b) { return a - b; });
 
             return JSON.stringify(splitArrOriginal) === JSON.stringify(splitArrSorted);
         }
 
-        function backupAppConfig(projectRoot) {
+        function backupAppConfig (projectRoot) {
             shell.cp('-f', path.join(projectRoot, 'config.xml'), path.join(projectRoot, 'configOrig.xml'));
         }
 
-        function restoreAppConfig(projectRoot) {
+        function restoreAppConfig (projectRoot) {
             shell.cp('-f', path.join(projectRoot, 'configOrig.xml'), path.join(projectRoot, 'config.xml'));
             shell.rm('-rf', path.join(projectRoot, 'configOrig.xml'));
         }
 
-        function switchToOnlyNonPlatformScriptsAppConfig(projectRoot) {
+        function switchToOnlyNonPlatformScriptsAppConfig (projectRoot) {
             backupAppConfig(projectRoot);
             shell.cp('-f', path.join(projectRoot, 'configOnlyNonPlatformScripts_' + ext + '.xml'), path.join(projectRoot, 'config.xml'));
         }
 
-        function switchToOnePlatformScriptsAppConfig(projectRoot) {
+        function switchToOnePlatformScriptsAppConfig (projectRoot) {
             backupAppConfig(projectRoot);
             shell.cp('-f', path.join(projectRoot, 'configOnePlatform_' + ext + '.xml'), path.join(projectRoot, 'config.xml'));
         }
 
-        function switchToTwoPlatformsScriptsAppConfig(projectRoot) {
+        function switchToTwoPlatformsScriptsAppConfig (projectRoot) {
             backupAppConfig(projectRoot);
             shell.cp('-f', path.join(projectRoot, 'configTwoPlatforms_' + ext + '.xml'), path.join(projectRoot, 'config.xml'));
         }
 
-        function backupPluginConfig() {
+        function backupPluginConfig () {
             shell.cp('-f', path.join(testPluginInstalledPath, 'plugin.xml'), path.join(testPluginInstalledPath, 'pluginOrig.xml'));
         }
 
-        function restorePluginConfig() {
+        function restorePluginConfig () {
             shell.cp('-f', path.join(testPluginInstalledPath, 'pluginOrig.xml'), path.join(testPluginInstalledPath, 'plugin.xml'));
             shell.rm('-rf', path.join(testPluginInstalledPath, 'pluginOrig.xml'));
         }
 
-        function switchToOnlyNonPlatformScriptsPluginConfig(projectRoot) {
+        function switchToOnlyNonPlatformScriptsPluginConfig (projectRoot) {
             backupPluginConfig();
             shell.cp('-f', path.join(testPluginInstalledPath, 'pluginOnlyNonPlatformScripts_' + ext + '.xml'), path.join(testPluginInstalledPath, 'plugin.xml'));
         }
 
-        function switchToOnePlatformScriptsPluginConfig(projectRoot) {
+        function switchToOnePlatformScriptsPluginConfig (projectRoot) {
             backupPluginConfig();
             shell.cp('-f', path.join(testPluginInstalledPath, 'pluginOnePlatform_' + ext + '.xml'), path.join(testPluginInstalledPath, 'plugin.xml'));
         }
 
-        function switchToTwoPlatformsScriptsPluginConfig(projectRoot) {
+        function switchToTwoPlatformsScriptsPluginConfig (projectRoot) {
             backupPluginConfig();
             shell.cp('-f', path.join(testPluginInstalledPath, 'pluginTwoPlatforms_' + ext + '.xml'), path.join(testPluginInstalledPath, 'plugin.xml'));
         }
 
-        function removeFileIfExists(file) {
+        function removeFileIfExists (file) {
             if (fs.existsSync(file)) {
                 fs.unlinkSync(file);
             }
         }
 
-        describe('application hooks', function() {
+        describe('application hooks', function () {
             it('Test 004 : should execute hook scripts serially', function (done) {
                 var test_event = 'before_build';
                 var projectRoot = cordovaUtil.isCordova();
                 var hooksOrderFile = path.join(projectRoot, 'hooks_order.txt');
 
-                return hooksRunner.fire(test_event, hookOptions).then(function() {
+                return hooksRunner.fire(test_event, hookOptions).then(function () {
                     expect(hooksOrderFile).toExist();
 
                     expect(hooksOrderFileIsOrdered(hooksOrderFile)).toBe(true);
@@ -354,7 +353,7 @@ describe('HooksRunner', function() {
             });
         });
 
-        describe('plugin hooks', function() {
+        describe('plugin hooks', function () {
             it('Test 009 : should execute hook scripts serially from plugin.xml', function (done) {
                 var test_event = 'before_build';
                 var projectRoot = cordovaUtil.isCordova();
@@ -454,18 +453,18 @@ describe('HooksRunner', function() {
                         // Delete unique ids to allow comparing PluginInfo
                         delete androidPluginOpts.plugin.pluginInfo._et;
 
-                        fire.calls.all().forEach(function(call) {
-                            if(call.args[1] && call.args[1].plugin) {
+                        fire.calls.all().forEach(function (call) {
+                            if (call.args[1] && call.args[1].plugin) {
                                 // Delete unique ids to allow comparing PluginInfo
                                 delete call.args[1].plugin.pluginInfo._et;
                             }
 
-                            if(call.args[0] == 'before_plugin_uninstall' ||
+                            if (call.args[0] == 'before_plugin_uninstall' ||
                                 call.args[0] == 'before_plugin_install' ||
                                 call.args[0] == 'after_plugin_install') {
-                                if(call.args[1]) {
+                                if (call.args[1]) {
                                     expect(call.args[1].plugin).toBeDefined();
-                                    if(call.args[1].plugin.platform == 'android') {
+                                    if (call.args[1].plugin.platform == 'android') {
                                         expect(JSON.stringify(androidPluginOpts) ===
                                             JSON.stringify(call.args[1])).toBe(true);
                                     }
@@ -496,8 +495,8 @@ describe('HooksRunner', function() {
                 var test_events = ['before_build', 'after_plugin_add', 'before_platform_rm', 'before_prepare'];
                 hookOptions.nohooks = ['before*'];
 
-                return test_events.reduce(function(soFar, test_event) {
-                    return soFar.then(function() {
+                return test_events.reduce(function (soFar, test_event) {
+                    return soFar.then(function () {
                         return hooksRunner.fire(test_event, hookOptions).then(function (msg) {
                             if (msg) {
                                 expect(msg).toBe('hook ' + test_event + ' is disabled.');
@@ -517,8 +516,8 @@ describe('HooksRunner', function() {
                 var test_events = ['before_build', 'after_plugin_add', 'before_platform_rm', 'before_prepare'];
                 hookOptions.nohooks = ['.'];
 
-                return test_events.reduce(function(soFar, test_event) {
-                    return soFar.then(function() {
+                return test_events.reduce(function (soFar, test_event) {
+                    return soFar.then(function () {
                         return hooksRunner.fire(test_event, hookOptions).then(function (msg) {
                             expect(msg).toBeDefined();
                             expect(msg).toBe('hook ' + test_event + ' is disabled.');
@@ -532,7 +531,7 @@ describe('HooksRunner', function() {
             });
         });
 
-        describe('module-level hooks (event handlers)', function() {
+        describe('module-level hooks (event handlers)', function () {
             var handler = jasmine.createSpy().and.returnValue(Q());
             var test_event = 'before_build';
 
@@ -541,7 +540,7 @@ describe('HooksRunner', function() {
                 handler.calls.reset();
             });
 
-            it('Test 016 : should fire handlers using cordova.on', function(done) {
+            it('Test 016 : should fire handlers using cordova.on', function (done) {
                 cordova.on(test_event, handler);
                 hooksRunner.fire(test_event, hookOptions).then(function () {
                     expect(handler).toHaveBeenCalled();
@@ -560,7 +559,7 @@ describe('HooksRunner', function() {
                 }).fin(done);
             });
 
-            it('Test 018 : should be able to stop listening to events using cordova.off', function(done) {
+            it('Test 018 : should be able to stop listening to events using cordova.off', function (done) {
                 cordova.on(test_event, handler);
                 cordova.off(test_event, handler);
                 hooksRunner.fire(test_event, hookOptions).then(function () {
@@ -571,20 +570,20 @@ describe('HooksRunner', function() {
                 }).fin(done);
             });
 
-            it('Test 019 : should execute event listeners serially', function(done) {
+            it('Test 019 : should execute event listeners serially', function (done) {
                 var h1_fired = false;
                 var h2_fired;
-                var h1 = function() {
+                var h1 = function () {
                     expect(h2_fired).toBe(false);
                     // Delay 100 ms here to check that h2 is not executed until after
                     // the promise returned by h1 is resolved.
-                    var q = Q.delay(100).then(function() {
+                    var q = Q.delay(100).then(function () {
                         h1_fired = true;
                     });
                     return q;
                 };
                 h2_fired = false;
-                var h2 = function() {
+                var h2 = function () {
                     h2_fired = true;
                     expect(h1_fired).toBe(true);
                     return Q();
@@ -593,18 +592,18 @@ describe('HooksRunner', function() {
                 cordova.on(test_event, h1);
                 cordova.on(test_event, h2);
 
-                return hooksRunner.fire(test_event, hookOptions).then(function() {
+                return hooksRunner.fire(test_event, hookOptions).then(function () {
                     expect(h1_fired).toBe(true);
                     expect(h2_fired).toBe(true);
-                }).fail(function(err) {
+                }).fail(function (err) {
                     expect(err).toBeUndefined();
-                }).then(function() {
+                }).then(function () {
                     cordova.removeAllListeners(test_event);
                     done();
                 });
             });
 
-            it('Test 020 : should allow for hook to opt into asynchronous execution and block further hooks from firing using the done callback', function(done) {
+            it('Test 020 : should allow for hook to opt into asynchronous execution and block further hooks from firing using the done callback', function (done) {
                 var h1_fired = false;
                 var h2_fired;
                 var h1 = function () {
@@ -621,14 +620,14 @@ describe('HooksRunner', function() {
 
                 cordova.on(test_event, h1);
                 cordova.on(test_event, h2);
-                hooksRunner.fire(test_event, hookOptions).then(function() {
+                hooksRunner.fire(test_event, hookOptions).then(function () {
                     expect(h1_fired).toBe(true);
                     expect(h2_fired).toBe(true);
                     done();
                 });
             });
 
-            it('Test 021 : should pass data object that fire calls into async handlers', function(done) {
+            it('Test 021 : should pass data object that fire calls into async handlers', function (done) {
                 var async = function (opts) {
                     expect(opts).toEqual(hookOptions);
                     return Q();
@@ -639,7 +638,7 @@ describe('HooksRunner', function() {
                 });
             });
 
-            it('Test 022 : should pass data object that fire calls into sync handlers', function(done) {
+            it('Test 022 : should pass data object that fire calls into sync handlers', function (done) {
                 var async = function (opts) {
                     expect(opts).toEqual(hookOptions);
                 };
@@ -647,7 +646,7 @@ describe('HooksRunner', function() {
                 hooksRunner.fire(test_event, hookOptions).fin(done);
             });
 
-            it('Test 023 : should error if any script exits with non-zero code', function(done) {
+            it('Test 023 : should error if any script exits with non-zero code', function (done) {
                 hooksRunner.fire('fail', hookOptions).then(function () {
                     expect('the call').toBe('a failure');
                 }, function (err) {
@@ -656,7 +655,7 @@ describe('HooksRunner', function() {
             });
         });
 
-        it('Test 024 :should not error if the hook is unrecognized', function(done) {
+        it('Test 024 :should not error if the hook is unrecognized', function (done) {
             hooksRunner.fire('CLEAN YOUR SHORTS GODDAMNIT LIKE A BIG BOY!', hookOptions).fail(function (err) {
                 expect('Call with unrecognized hook ').toBe('successful.\n' + err);
             }).fin(done);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/integration-tests/fetch.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/fetch.spec.js b/integration-tests/fetch.spec.js
index 693f925..b3fe45c 100644
--- a/integration-tests/fetch.spec.js
+++ b/integration-tests/fetch.spec.js
@@ -26,111 +26,109 @@ var TIMEOUT = 90000,
     plugins_dir = path.join(__dirname, '..', 'spec', 'plugman', 'plugins');
 
 var plugins = {
-    'Test1' : path.join(plugins_dir, 'dependencies', 'Test1'),
-    'Test2' : path.join(plugins_dir, 'dependencies', 'Test2'),
-    'Test3' : path.join(plugins_dir, 'dependencies', 'Test3'),
-    'Test4' : path.join(plugins_dir, 'dependencies', 'Test4')
-}
+    'Test1': path.join(plugins_dir, 'dependencies', 'Test1'),
+    'Test2': path.join(plugins_dir, 'dependencies', 'Test2'),
+    'Test3': path.join(plugins_dir, 'dependencies', 'Test3'),
+    'Test4': path.join(plugins_dir, 'dependencies', 'Test4')
+};
 
-
-describe('end-to-end plugin dependency tests', function() {
+describe('end-to-end plugin dependency tests', function () {
     var tmpDir, project, pluginsDir;
 
-    beforeEach(function() {
+    beforeEach(function () {
         tmpDir = helpers.tmpDir('plugin_dependency_test');
         project = path.join(tmpDir, 'hello3');
         pluginsDir = path.join(project, 'plugins');
         process.chdir(tmpDir);
     });
 
-    afterEach(function() {
+    afterEach(function () {
         process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
-    it('Test 029 : should fail if dependency already installed is wrong version', function(done) {
+    it('Test 029 : should fail if dependency already installed is wrong version', function (done) {
         cordova.create('hello3')
-        .then(function() {
+        .then(function () {
             process.chdir(project);
             return cordova.platform('add', 'android', {'fetch': true});
-        }).then(function() {
+        }).then(function () {
             return cordova.plugin('add', 'cordova-plugin-file', {'fetch': true});
-        }).then(function() {
+        }).then(function () {
             expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
             return cordova.plugin('add', plugins['Test1'], {'fetch': true});
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err.message).toContain('does not satisfy dependency plugin requirement');
         })
         .fin(done);
     }, TIMEOUT);
 
-    it('Test 030 : should pass if dependency already installed is wrong version with --force', function(done) {
+    it('Test 030 : should pass if dependency already installed is wrong version with --force', function (done) {
         cordova.create('hello3')
-        .then(function() {
+        .then(function () {
             process.chdir(project);
             return cordova.platform('add', 'android', {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             return cordova.plugin('add', 'cordova-plugin-file', {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
-            return cordova.plugin('add', plugins['Test1'], {'fetch': true, 'force':true});
+            return cordova.plugin('add', plugins['Test1'], {'fetch': true, 'force': true});
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(pluginsDir, 'Test1')).toExist();
         })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, TIMEOUT);
 
-
-    it('Test 031 : should pass if dependency already installed is same major version (if specific version is specified)', function(done) {
-        //Test1 requires cordova-plugin-file version 2.0.0 (which should automatically turn into ^2.0.0); we'll install version 2.1.0
+    it('Test 031 : should pass if dependency already installed is same major version (if specific version is specified)', function (done) {
+        // Test1 requires cordova-plugin-file version 2.0.0 (which should automatically turn into ^2.0.0); we'll install version 2.1.0
         cordova.create('hello3')
-        .then(function() {
+        .then(function () {
             process.chdir(project);
             return cordova.platform('add', 'android', {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             return cordova.plugin('add', 'cordova-plugin-file@2.1.0', {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
             return cordova.plugin('add', plugins['Test1'], {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(pluginsDir, 'Test1')).toExist();
         })
-        .fail(function(err) {
-            //console.error(err);
+        .fail(function (err) {
+            // console.error(err);
             expect(err).toBeUndefined();
         })
         .fin(done);
     }, TIMEOUT);
 
-    it('Test 032 : should handle two plugins with same dependent plugin', function(done) {
-        //Test1 and Test2 have compatible dependencies on cordova-plugin-file
-        //Test1 and Test3 have incompatible dependencies on cordova-plugin-file
+    it('Test 032 : should handle two plugins with same dependent plugin', function (done) {
+        // Test1 and Test2 have compatible dependencies on cordova-plugin-file
+        // Test1 and Test3 have incompatible dependencies on cordova-plugin-file
         cordova.create('hello3')
-        .then(function() {
+        .then(function () {
             process.chdir(project);
             return cordova.platform('add', 'android', {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             return cordova.plugin('add', plugins['Test1'], {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
             expect(path.join(pluginsDir, 'Test1')).toExist();
             return cordova.plugin('add', plugins['Test2'], {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             return cordova.plugin('add', plugins['Test3'], {'fetch': true});
         })
-        .fail(function(err) {
+        .fail(function (err) {
             expect(path.join(pluginsDir, 'Test2')).toExist();
             expect(path.join(pluginsDir, 'Test3')).not.toExist();
             expect(err.message).toContain('does not satisfy dependency plugin requirement');
@@ -138,21 +136,21 @@ describe('end-to-end plugin dependency tests', function() {
         .fin(done);
     }, TIMEOUT);
 
-    it('Test 033 : should use a dev version of a dependent plugin if it is already installed', function(done) {
-        //Test4 has this dependency in its plugin.xml:
-        //<dependency id="cordova-plugin-file" url="https://github.com/apache/cordova-plugin-file" />
+    it('Test 033 : should use a dev version of a dependent plugin if it is already installed', function (done) {
+        // Test4 has this dependency in its plugin.xml:
+        // <dependency id="cordova-plugin-file" url="https://github.com/apache/cordova-plugin-file" />
         cordova.create('hello3')
-        .then(function() {
+        .then(function () {
             process.chdir(project);
             return cordova.platform('add', 'android', {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             return cordova.plugin('add', 'https://github.com/apache/cordova-plugin-file');
         })
-        .then(function() {
+        .then(function () {
             return cordova.plugin('add', plugins['Test4'], {'fetch': true});
         })
-        .then(function() {
+        .then(function () {
             expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
             expect(path.join(pluginsDir, 'Test4')).toExist();
         }, function (error) {


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


[15/18] cordova-lib git commit: CB-12895 : updated integration tests with eslint format and rebased

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/integration-tests/plugman_fetch.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/plugman_fetch.spec.js b/integration-tests/plugman_fetch.spec.js
index a12a072..69b46cd 100644
--- a/integration-tests/plugman_fetch.spec.js
+++ b/integration-tests/plugman_fetch.spec.js
@@ -16,28 +16,28 @@
     specific language governing permissions and limitations
     under the License.
 */
-var rewire = require('rewire'),
-    fetch = rewire('../src/plugman/fetch'),
-    fs = require('fs'),
-    os = require('os'),
-    path = require('path'),
-    shell = require('shelljs'),
-    realrm = shell.rm,
-    TIMEOUT = 60 * 1000,
-    // xml_helpers = require('../src/util/xml-helpers'),
-    metadata = require('../src/plugman/util/metadata'),
-    temp = path.join(os.tmpdir(), 'plugman', 'fetch');
-var plugins_dir = path.join(__dirname, '..', 'spec', 'plugman', 'plugins'),
-    test_plugin = path.join(plugins_dir, 'org.test.plugins.childbrowser'),
-    test_pkgjson_plugin = path.join(plugins_dir, 'pkgjson-test-plugin'),
-    test_plugin_searchpath = path.join(test_plugin, '..'),
-    // test_plugin_with_space = path.join(__dirname, 'folder with space', 'plugins', 'org.test.plugins.childbrowser'),
-    // test_plugin_xml = xml_helpers.parseElementtreeSync(path.join(test_plugin, 'plugin.xml')),
-    test_plugin_id = 'org.test.plugins.childbrowser',
-    test_plugin_version = '0.6.0',
-    plugins = require('../src/plugman/util/plugins'),
-    Q = require('q'),
-    registry = require('../src/plugman/registry/registry');
+var rewire = require('rewire');
+var fetch = rewire('../src/plugman/fetch');
+var fs = require('fs');
+var os = require('os');
+var path = require('path');
+var shell = require('shelljs');
+var realrm = shell.rm;
+var TIMEOUT = 60 * 1000;
+// xml_helpers = require('../src/util/xml-helpers'),
+var metadata = require('../src/plugman/util/metadata');
+var temp = path.join(os.tmpdir(), 'plugman', 'fetch');
+var plugins_dir = path.join(__dirname, '..', 'spec', 'plugman', 'plugins');
+var test_plugin = path.join(plugins_dir, 'org.test.plugins.childbrowser');
+var test_pkgjson_plugin = path.join(plugins_dir, 'pkgjson-test-plugin');
+var test_plugin_searchpath = path.join(test_plugin, '..');
+// test_plugin_with_space = path.join(__dirname, 'folder with space', 'plugins', 'org.test.plugins.childbrowser'),
+// test_plugin_xml = xml_helpers.parseElementtreeSync(path.join(test_plugin, 'plugin.xml')),
+var test_plugin_id = 'org.test.plugins.childbrowser';
+var test_plugin_version = '0.6.0';
+var plugins = require('../src/plugman/util/plugins');
+var Q = require('q');
+var registry = require('../src/plugman/registry/registry');
 
 describe('fetch', function () {
 
@@ -63,7 +63,15 @@ describe('fetch', function () {
     });
 */
     describe('local plugins', function () {
-        var rm, sym, cp, save_metadata, revertLocal, revertFetch, fetchCalls = 0;
+        /* eslint-disable no-unused-vars */
+        var rm;
+        var sym;
+        var cp;
+        var save_metadata;
+        var revertLocal;
+        var revertFetch;
+        var fetchCalls = 0;
+        /* eslint-enable no-unused-vars */
         beforeEach(function () {
             rm = spyOn(shell, 'rm');
             sym = spyOn(fs, 'symlinkSync');
@@ -101,11 +109,11 @@ describe('fetch', function () {
 
         it('Test 004 : should fail when the expected ID doesn\'t match', function (done) {
             fetch(test_plugin, temp, { expected_id: 'wrongID' })
-            .then(function () {
-                expect('this call').toBe('fail');
-            }, function (err) {
-                expect('' + err).toContain('Expected plugin to have ID "wrongID" but got');
-            }).fin(done);
+                .then(function () {
+                    expect('this call').toBe('fail');
+                }, function (err) {
+                    expect('' + err).toContain('Expected plugin to have ID "wrongID" but got');
+                }).fin(done);
         });
 
         it('Test 005 : should succeed when the expected ID is correct', function (done) {
@@ -115,15 +123,15 @@ describe('fetch', function () {
         });
         it('Test 006 : should fail when the expected ID with version specified doesn\'t match', function (done) {
             fetch(test_plugin, temp, { expected_id: test_plugin_id + '@wrongVersion' })
-            .then(function () {
-                expect('this call').toBe('fail');
-            }, function (err) {
-                expect('' + err).toContain('to satisfy version "wrongVersion" but got');
-            }).fin(done);
+                .then(function () {
+                    expect('this call').toBe('fail');
+                }, function (err) {
+                    expect('' + err).toContain('to satisfy version "wrongVersion" but got');
+                }).fin(done);
         });
         it('Test 007 : should succeed when the plugin version specified is correct', function (done) {
             var exp_id = test_plugin_id + '@' + test_plugin_version;
-            wrapper(fetch(test_plugin, temp, { expected_id: exp_id}), done, function () {
+            wrapper(fetch(test_plugin, temp, { expected_id: exp_id }), done, function () {
                 expect(1).toBe(1);
             });
         });
@@ -135,17 +143,19 @@ describe('fetch', function () {
         });
         it('Test 028 : should fail when locally-available plugin is missing pacakge.json', function (done) {
             fetch(test_plugin, temp, {fetch: true})
-            .then(function () {
-                expect(false).toBe(true);
-            }).fail(function (err) {
-                expect(err).toBeDefined();
-                expect(err.message).toContain('needs a valid package.json');
-                done();
-            });
+                .then(function () {
+                    expect(false).toBe(true);
+                }).fail(function (err) {
+                    expect(err).toBeDefined();
+                    expect(err.message).toContain('needs a valid package.json');
+                    done();
+                });
         });
     });
     describe('git plugins', function () {
-        var clone, save_metadata, done;
+        var clone;
+        var save_metadata;
+        var done; // eslint-disable-line no-unused-vars
 
         beforeEach(function () {
             clone = spyOn(plugins, 'clonePluginGitRepo').and.returnValue(Q(test_plugin));
@@ -214,20 +224,20 @@ describe('fetch', function () {
 
         it('Test 014 : should fail when the expected ID doesn\'t match', function (done) {
             fetch('https://github.com/bobeast/GAPlugin.git', temp, { expected_id: 'wrongID' })
-            .then(function () {
-                expect('this call').toBe('fail');
-            }, function (err) {
-                expect('' + err).toContain('Expected plugin to have ID "wrongID" but got');
-            }).fin(done);
+                .then(function () {
+                    expect('this call').toBe('fail');
+                }, function (err) {
+                    expect('' + err).toContain('Expected plugin to have ID "wrongID" but got');
+                }).fin(done);
         });
 
         it('Test 015 : should fail when the expected ID with version specified doesn\'t match', function (done) {
             fetch('https://github.com/bobeast/GAPlugin.git', temp, { expected_id: 'id@wrongVersion' })
-            .then(function () {
-                expect('this call').toBe('fail');
-            }, function (err) {
-                expect('' + err).toContain('Expected plugin to have ID "id" but got');
-            }).fin(done);
+                .then(function () {
+                    expect('this call').toBe('fail');
+                }, function (err) {
+                    expect('' + err).toContain('Expected plugin to have ID "id" but got');
+                }).fin(done);
         });
 
         it('Test 016 : should succeed when the expected ID is correct', function (done) {
@@ -293,8 +303,13 @@ describe('fetch', function () {
     });
 
     describe('registry plugins', function () {
-        var pluginId = 'dummyplugin', sFetch;
-        var rm, sym, save_metadata;
+        /* eslint-disable no-unused-vars */
+        var pluginId = 'dummyplugin';
+        var sFetch;
+        var rm;
+        var sym;
+        var save_metadata;
+        /* eslint-enable no-unused-vars */
         beforeEach(function () {
             rm = spyOn(shell, 'rm');
             sym = spyOn(fs, 'symlinkSync');
@@ -306,11 +321,11 @@ describe('fetch', function () {
         it('Test 022 : should fail when the expected ID with version specified doesn\'t match', function (done) {
             // fetch(pluginId, temp, { expected_id: test_plugin_id + '@wrongVersion' })
             fetch(pluginId, temp, { expected_id: 'wrongID' })
-            .then(function () {
-                expect('this call').toBe('fail');
-            }, function (err) {
-                expect('' + err).toContain('Expected plugin to have ID "wrongID" but got');
-            }).fin(done);
+                .then(function () {
+                    expect('this call').toBe('fail');
+                }, function (err) {
+                    expect('' + err).toContain('Expected plugin to have ID "wrongID" but got');
+                }).fin(done);
         });
 
         it('Test 023 : should succeed when the expected ID is correct', function (done) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/integration-tests/plugman_uninstall.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/plugman_uninstall.spec.js b/integration-tests/plugman_uninstall.spec.js
index 7d1b73a..babff69 100644
--- a/integration-tests/plugman_uninstall.spec.js
+++ b/integration-tests/plugman_uninstall.spec.js
@@ -17,39 +17,37 @@
     under the License.
 */
 
-/* jshint sub:true */
-
-var uninstall = require('../src/plugman/uninstall'),
-    install = require('../src/plugman/install'),
-    actions = require('cordova-common').ActionStack,
-    PluginInfo = require('cordova-common').PluginInfo,
-    events = require('cordova-common').events,
-    common = require('../spec/common'),
-    platforms = require('../src/platforms/platforms'),
-    xmlHelpers = require('cordova-common').xmlHelpers,
-    et = require('elementtree'),
-    fs = require('fs'),
-    path = require('path'),
-    shell = require('shelljs'),
-    Q = require('q'),
-    spec = path.join(__dirname, '..', 'spec', 'plugman'),
-    done = false,
-    srcProject = path.join(spec, 'projects', 'android'),
-    project = path.join(spec, 'projects', 'android_uninstall.test'),
-    project2 = path.join(spec, 'projects', 'android_uninstall.test2'),
-    project3 = path.join(spec, 'projects', 'android_uninstall.test3'),
-
-    plugins_dir = path.join(spec, 'plugins'),
-    plugins_install_dir = path.join(project, 'cordova', 'plugins'),
-    plugins_install_dir2 = path.join(project2, 'cordova', 'plugins'),
-    plugins_install_dir3 = path.join(project3, 'cordova', 'plugins'),
-
-    plugins = {
-        'org.test.plugins.dummyplugin': path.join(plugins_dir, 'org.test.plugins.dummyplugin'),
-        'A': path.join(plugins_dir, 'dependencies', 'A'),
-        'C': path.join(plugins_dir, 'dependencies', 'C')
-    },
-    dummy_id = 'org.test.plugins.dummyplugin';
+var uninstall = require('../src/plugman/uninstall');
+var install = require('../src/plugman/install');
+var actions = require('cordova-common').ActionStack;
+var PluginInfo = require('cordova-common').PluginInfo;
+var events = require('cordova-common').events;
+var common = require('../spec/common');
+var platforms = require('../src/platforms/platforms');
+var xmlHelpers = require('cordova-common').xmlHelpers;
+var et = require('elementtree');
+var fs = require('fs');
+var path = require('path');
+var shell = require('shelljs');
+var Q = require('q');
+var spec = path.join(__dirname, '..', 'spec', 'plugman');
+var done = false;
+var srcProject = path.join(spec, 'projects', 'android');
+var project = path.join(spec, 'projects', 'android_uninstall.test');
+var project2 = path.join(spec, 'projects', 'android_uninstall.test2');
+var project3 = path.join(spec, 'projects', 'android_uninstall.test3');
+
+var plugins_dir = path.join(spec, 'plugins');
+var plugins_install_dir = path.join(project, 'cordova', 'plugins');
+var plugins_install_dir2 = path.join(project2, 'cordova', 'plugins');
+var plugins_install_dir3 = path.join(project3, 'cordova', 'plugins');
+
+var plugins = {
+    'org.test.plugins.dummyplugin': path.join(plugins_dir, 'org.test.plugins.dummyplugin'),
+    'A': path.join(plugins_dir, 'dependencies', 'A'),
+    'C': path.join(plugins_dir, 'dependencies', 'C')
+};
+var dummy_id = 'org.test.plugins.dummyplugin';
 
 var dummyPluginInfo = new PluginInfo(plugins['org.test.plugins.dummyplugin']);
 
@@ -85,28 +83,31 @@ describe('plugman uninstall start', function () {
         shell.cp('-R', path.join(srcProject, '*'), project3);
 
         return install('android', project, plugins['org.test.plugins.dummyplugin'])
-        .then(function (result) {
-            return install('android', project, plugins['A']);
-        }).then(function () {
-            return install('android', project2, plugins['C']);
-        }).then(function () {
-            return install('android', project2, plugins['A']);
-        }).then(function () {
-            return install('android', project3, plugins['A']);
-        }).then(function () {
-            return install('android', project3, plugins['C']);
-        }).then(function (result) {
-            expect(result).toEqual(true);
-            done();
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        });
+            .then(function (result) {
+                return install('android', project, plugins['A']);
+            }).then(function () {
+                return install('android', project2, plugins['C']);
+            }).then(function () {
+                return install('android', project2, plugins['A']);
+            }).then(function () {
+                return install('android', project3, plugins['A']);
+            }).then(function () {
+                return install('android', project3, plugins['C']);
+            }).then(function (result) {
+                expect(result).toEqual(true);
+                done();
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            });
     }, 60000);
 });
 
 describe('uninstallPlatform', function () {
-    var proc, rm;
+    /* eslint-disable no-unused-vars */
+    var proc;
+    var rm;
     var fsWrite;
+    /* eslint-enable no-unused-vars */
 
     beforeEach(function () {
         proc = spyOn(actions.prototype, 'process').and.returnValue(Q());
@@ -122,14 +123,14 @@ describe('uninstallPlatform', function () {
             var getPlatformApi = spyOn(platforms, 'getPlatformApi').and.returnValue(platformApi);
 
             uninstall.uninstallPlatform('android', project, dummy_id)
-            .then(function () {
-                expect(getPlatformApi).toHaveBeenCalledWith('android', project);
-                expect(platformApi.removePlugin).toHaveBeenCalled();
-                done();
-            }).fail(function (err) {
-                expect(err).toBeUndefined();
-                done();
-            });
+                .then(function () {
+                    expect(getPlatformApi).toHaveBeenCalledWith('android', project);
+                    expect(platformApi.removePlugin).toHaveBeenCalled();
+                    done();
+                }).fail(function (err) {
+                    expect(err).toBeUndefined();
+                    done();
+                });
         }, 6000);
 
         it('Test 003 : should return propagate value returned by PlatformApi removePlugin method', function (done) {
@@ -148,24 +149,24 @@ describe('uninstallPlatform', function () {
             function validateReturnedResultFor (values, expectedResult) {
                 return values.reduce(function (promise, value) {
                     return promise
-                    .then(function () {
-                        platformApi.removePlugin.and.returnValue(Q(value));
-                        return uninstall.uninstallPlatform('android', project, dummy_id, null,
-                            { pluginInfoProvider: fakeProvider, platformVersion: '9.9.9' });
-                    })
-                    .then(function (result) {
-                        expect(!!result).toEqual(expectedResult);
-                    }, function (err) {
-                        expect(err).toBeUndefined();
-                    });
+                        .then(function () {
+                            platformApi.removePlugin.and.returnValue(Q(value));
+                            return uninstall.uninstallPlatform('android', project, dummy_id, null,
+                                { pluginInfoProvider: fakeProvider, platformVersion: '9.9.9' });
+                        })
+                        .then(function (result) {
+                            expect(!!result).toEqual(expectedResult);
+                        }, function (err) {
+                            expect(err).toBeUndefined();
+                        });
                 }, Q());
             }
 
             validateReturnedResultFor([ true, {}, [], 'foo', function () {} ], true)
-            .then(function () {
-                return validateReturnedResultFor([ false, null, undefined, '' ], false);
-            })
-            .fin(done);
+                .then(function () {
+                    return validateReturnedResultFor([ false, null, undefined, '' ], false);
+                })
+                .fin(done);
         });
 
         describe('with dependencies', function () {
@@ -174,40 +175,45 @@ describe('uninstallPlatform', function () {
                 emit = spyOn(events, 'emit');
             });
             uninstall.uninstallPlatform('android', project, 'A')
-            .then(function (result) {
-                expect(emit).toHaveBeenCalledWith('log', 'Uninstalling 2 dependent plugins.');
-                done();
-            });
+                .then(function (result) {
+                    expect(emit).toHaveBeenCalledWith('log', 'Uninstalling 2 dependent plugins.');
+                    done();
+                });
         });
     });
 
     describe('failure ', function () {
         it('Test 004 : should throw if platform is unrecognized', function (done) {
             uninstall.uninstallPlatform('atari', project, 'SomePlugin')
-            .then(function (result) {
-                expect(false).toBe(true);
-                done();
-            }).fail(function err (errMsg) {
-                expect(errMsg.toString()).toContain('atari not supported.');
-                done();
-            });
+                .then(function (result) {
+                    expect(false).toBe(true);
+                    done();
+                }).fail(function err (errMsg) {
+                    expect(errMsg.toString()).toContain('atari not supported.');
+                    done();
+                });
         }, 6000);
 
         it('Test 005 : should throw if plugin is missing', function (done) {
             uninstall.uninstallPlatform('android', project, 'SomePluginThatDoesntExist')
-            .then(function (result) {
-                expect(false).toBe(true);
-                done();
-            }).fail(function err (errMsg) {
-                expect(errMsg.toString()).toContain('Plugin "SomePluginThatDoesntExist" not found. Already uninstalled?');
-                done();
-            });
+                .then(function (result) {
+                    expect(false).toBe(true);
+                    done();
+                }).fail(function err (errMsg) {
+                    expect(errMsg.toString()).toContain('Plugin "SomePluginThatDoesntExist" not found. Already uninstalled?');
+                    done();
+                });
         }, 6000);
     });
 });
 
 describe('uninstallPlugin', function () {
-    var rm, fsWrite, rmstack = [], emit;
+    /* eslint-disable no-unused-vars */
+    var rm;
+    var fsWrite;
+    var rmstack = [];
+    var emit;
+    /* eslint-enable no-unused-vars */
 
     beforeEach(function () {
         fsWrite = spyOn(fs, 'writeFileSync').and.returnValue(true);
@@ -220,65 +226,68 @@ describe('uninstallPlugin', function () {
 
         it('Test 006 : should delete all dependent plugins', function (done) {
             uninstall.uninstallPlugin('A', plugins_install_dir)
-            .then(function (result) {
-                var del = common.spy.getDeleted(emit);
-                expect(del).toEqual([
-                    'Deleted "C"',
-                    'Deleted "D"',
-                    'Deleted "A"'
-                ]);
-                done();
-            });
+                .then(function (result) {
+                    var del = common.spy.getDeleted(emit);
+                    expect(del).toEqual([
+                        'Deleted "C"',
+                        'Deleted "D"',
+                        'Deleted "A"'
+                    ]);
+                    done();
+                });
         });
 
         it('Test 007 : should fail if plugin is a required dependency', function (done) {
             uninstall.uninstallPlugin('C', plugins_install_dir)
-            .then(function (result) {
-                expect(false).toBe(true);
-                done();
-            }).fail(function err (errMsg) {
-                expect(errMsg.toString()).toEqual('"C" is required by (A) and cannot be removed (hint: use -f or --force)');
-                done();
-            });
+                .then(function (result) {
+                    expect(false).toBe(true);
+                    done();
+                }).fail(function err (errMsg) {
+                    expect(errMsg.toString()).toEqual('"C" is required by (A) and cannot be removed (hint: use -f or --force)');
+                    done();
+                });
         }, 6000);
 
         it('Test 008 : allow forcefully removing a plugin', function (done) {
             uninstall.uninstallPlugin('C', plugins_install_dir, {force: true})
-            .then(function () {
-                var del = common.spy.getDeleted(emit);
-                expect(del).toEqual(['Deleted "C"']);
-                done();
-            });
+                .then(function () {
+                    var del = common.spy.getDeleted(emit);
+                    expect(del).toEqual(['Deleted "C"']);
+                    done();
+                });
         });
 
         it('Test 009 : never remove top level plugins if they are a dependency', function (done) {
             uninstall.uninstallPlugin('A', plugins_install_dir2)
-            .then(function () {
-                var del = common.spy.getDeleted(emit);
-                expect(del).toEqual([
-                    'Deleted "D"',
-                    'Deleted "A"'
-                ]);
-                done();
-            });
+                .then(function () {
+                    var del = common.spy.getDeleted(emit);
+                    expect(del).toEqual([
+                        'Deleted "D"',
+                        'Deleted "A"'
+                    ]);
+                    done();
+                });
         });
 
         it('Test 010 : should not remove dependent plugin if it was installed after as top-level', function (done) {
             uninstall.uninstallPlugin('A', plugins_install_dir3)
-            .then(function () {
-                var del = common.spy.getDeleted(emit);
-                expect(del).toEqual([
-                    'Deleted "D"',
-                    'Deleted "A"'
-                ]);
-                done();
-            });
+                .then(function () {
+                    var del = common.spy.getDeleted(emit);
+                    expect(del).toEqual([
+                        'Deleted "D"',
+                        'Deleted "A"'
+                    ]);
+                    done();
+                });
         });
     });
 });
 
 describe('uninstall', function () {
-    var fsWrite, rm;
+    /* eslint-disable no-unused-vars */
+    var fsWrite;
+    var rm;
+    /* eslint-enable no-unused-vars */
 
     beforeEach(function () {
         fsWrite = spyOn(fs, 'writeFileSync').and.returnValue(true);
@@ -289,24 +298,24 @@ describe('uninstall', function () {
     describe('failure', function () {
         it('Test 011 : should throw if platform is unrecognized', function (done) {
             return uninstall('atari', project, 'SomePlugin')
-            .then(function (result) {
-                expect(false).toBe(true);
-                done();
-            }).fail(function err (errMsg) {
-                expect(errMsg.toString()).toContain('atari not supported.');
-                done();
-            });
+                .then(function (result) {
+                    expect(false).toBe(true);
+                    done();
+                }).fail(function err (errMsg) {
+                    expect(errMsg.toString()).toContain('atari not supported.');
+                    done();
+                });
         }, 6000);
 
         it('Test 012 : should throw if plugin is missing', function (done) {
             uninstall('android', project, 'SomePluginThatDoesntExist')
-            .then(function (result) {
-                expect(false).toBe(true);
-                done();
-            }).fail(function err (errMsg) {
-                expect(errMsg.toString()).toContain('Plugin "SomePluginThatDoesntExist" not found. Already uninstalled?');
-                done();
-            });
+                .then(function (result) {
+                    expect(false).toBe(true);
+                    done();
+                }).fail(function err (errMsg) {
+                    expect(errMsg.toString()).toContain('Plugin "SomePluginThatDoesntExist" not found. Already uninstalled?');
+                    done();
+                });
         }, 6000);
     });
 });
@@ -314,18 +323,18 @@ describe('uninstall', function () {
 describe('end', function () {
     it('Test 013 : end', function (done) {
         return uninstall('android', project, plugins['org.test.plugins.dummyplugin'])
-        .then(function () {
-            // Fails... A depends on
-            return uninstall('android', project, plugins['C']);
-        }).fail(function (err) {
-            expect(err.stack).toMatch(/The plugin 'C' is required by \(A\), skipping uninstallation./);
-        }).then(function () {
-            // dependencies on C,D ... should this only work with --recursive? prompt user..?
-            return uninstall('android', project, plugins['A']);
-        }).fin(function (err) {
-            if (err) { events.emit('error', err); }
-            shell.rm('-rf', project, project2, project3);
-            done();
-        });
+            .then(function () {
+                // Fails... A depends on
+                return uninstall('android', project, plugins['C']);
+            }).fail(function (err) {
+                expect(err.stack).toMatch(/The plugin 'C' is required by \(A\), skipping uninstallation./);
+            }).then(function () {
+                // dependencies on C,D ... should this only work with --recursive? prompt user..?
+                return uninstall('android', project, plugins['A']);
+            }).fin(function (err) {
+                if (err) { events.emit('error', err); }
+                shell.rm('-rf', project, project2, project3);
+                done();
+            });
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/spec/cordova/platform/getPlatformDetailsFromDir.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/platform/getPlatformDetailsFromDir.spec.js b/spec/cordova/platform/getPlatformDetailsFromDir.spec.js
index 0a98b2b..c551f08 100644
--- a/spec/cordova/platform/getPlatformDetailsFromDir.spec.js
+++ b/spec/cordova/platform/getPlatformDetailsFromDir.spec.js
@@ -51,8 +51,8 @@ describe('cordova/platform/getPlatformDetailsFromDir', function () {
     });
 
     it('should return a promise with platform and version', function (done) {
-        fs.existsSync.and.callFake(function(filePath) {
-            if(path.basename(filePath) === 'package.json') {
+        fs.existsSync.and.callFake(function (filePath) {
+            if (path.basename(filePath) === 'package.json') {
                 return true;
             } else {
                 return false;
@@ -60,14 +60,14 @@ describe('cordova/platform/getPlatformDetailsFromDir', function () {
         });
         cordova_util.requireNoCache.and.returnValue(package_json_mock);
         platform_getPlatformDetails('dir', ['cordova-android'])
-        .then(function(result) {
-            expect(result.platform).toBe('io.cordova.hellocordova');
-            expect(result.version).toBe('1.0.0');
-            expect(Q.reject).not.toHaveBeenCalled();
-        }).fail(function (err) {
-            fail('unexpected failure handler invoked!');
-            console.error(err);
-        }).done(done);
+            .then(function (result) {
+                expect(result.platform).toBe('io.cordova.hellocordova');
+                expect(result.version).toBe('1.0.0');
+                expect(Q.reject).not.toHaveBeenCalled();
+            }).fail(function (err) {
+                fail('unexpected failure handler invoked!');
+                console.error(err);
+            }).done(done);
     });
 
     it('should remove the cordova- prefix from the platform name for known platforms', function (done) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/spec/cordova/platform/remove.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/platform/remove.spec.js b/spec/cordova/platform/remove.spec.js
index 3805dfc..5483ec0 100644
--- a/spec/cordova/platform/remove.spec.js
+++ b/spec/cordova/platform/remove.spec.js
@@ -65,96 +65,96 @@ describe('cordova/platform/remove', function () {
     });
     describe('happy path (success conditions)', function () {
         it('should fire the before_platform_* hook', function () {
-            platform_remove(hooks_mock, projectRoot, ['atari'], {save : true});
+            platform_remove(hooks_mock, projectRoot, ['atari'], {save: true});
             expect(hooks_mock.fire).toHaveBeenCalledWith('before_platform_rm', jasmine.any(Object));
         });
 
         it('should remove <platform>.json file from plugins directory', function (done) {
-            platform_remove(hooks_mock, projectRoot, ['atari'], {save : true})
-            .then(function() {
-                expect(cordova_util.removePlatformPluginsJson).toHaveBeenCalled();
-            }).fail(function (e) {
-                fail('fail handler unexpectedly invoked');
-                console.error(e);
-            }).done(done);
+            platform_remove(hooks_mock, projectRoot, ['atari'], {save: true})
+                .then(function () {
+                    expect(cordova_util.removePlatformPluginsJson).toHaveBeenCalled();
+                }).fail(function (e) {
+                    fail('fail handler unexpectedly invoked');
+                    console.error(e);
+                }).done(done);
         });
 
         it('should remove from config.xml and platforms.json', function (done) {
-            platform_remove(hooks_mock, projectRoot, ['atari'], {save : true})
-            .then(function() {
-                expect(cordova_util.removePlatformPluginsJson).toHaveBeenCalled();
-                expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
-                expect(events.emit).toHaveBeenCalledWith('log', jasmine.stringMatching(/Removing platform atari from config.xml file/));
-                expect(events.emit).toHaveBeenCalledWith('verbose', jasmine.stringMatching(/Removing platform atari from platforms.json file/));
-            }).fail(function (e) {
-                fail('fail handler unexpectedly invoked');
-                console.error(e);
-            }).done(done);
+            platform_remove(hooks_mock, projectRoot, ['atari'], {save: true})
+                .then(function () {
+                    expect(cordova_util.removePlatformPluginsJson).toHaveBeenCalled();
+                    expect(cfg_parser_mock.prototype.write).toHaveBeenCalled();
+                    expect(events.emit).toHaveBeenCalledWith('log', jasmine.stringMatching(/Removing platform atari from config.xml file/));
+                    expect(events.emit).toHaveBeenCalledWith('verbose', jasmine.stringMatching(/Removing platform atari from platforms.json file/));
+                }).fail(function (e) {
+                    fail('fail handler unexpectedly invoked');
+                    console.error(e);
+                }).done(done);
         });
 
         it('should remove from package.json', function (done) {
-            package_json_mock.cordova = {'platforms':['atari']};
+            package_json_mock.cordova = {'platforms': ['atari']};
             cordova_util.requireNoCache.and.returnValue(package_json_mock);
-            fs.existsSync.and.callFake(function(filePath) {
-                if(path.basename(filePath) === 'package.json') {
+            fs.existsSync.and.callFake(function (filePath) {
+                if (path.basename(filePath) === 'package.json') {
                     return true;
                 } else {
                     return false;
                 }
             });
-            platform_remove(hooks_mock, projectRoot, ['atari'], {save : true})
-            .then(function() {
-                expect(fs.writeFileSync).toHaveBeenCalled();
-                expect(events.emit).toHaveBeenCalledWith('log', jasmine.stringMatching(/Removing atari from cordova.platforms array in package.json/));
-            }).fail(function (e) {
-                fail('fail handler unexpectedly invoked');
-                console.error(e);
-            }).done(done);
+            platform_remove(hooks_mock, projectRoot, ['atari'], {save: true})
+                .then(function () {
+                    expect(fs.writeFileSync).toHaveBeenCalled();
+                    expect(events.emit).toHaveBeenCalledWith('log', jasmine.stringMatching(/Removing atari from cordova.platforms array in package.json/));
+                }).fail(function (e) {
+                    fail('fail handler unexpectedly invoked');
+                    console.error(e);
+                }).done(done);
         });
 
         it('should only remove from platforms.json', function (done) {
             spyOn(platform_metadata, 'remove').and.callThrough();
-            package_json_mock.cordova = {'platforms':['atari']};
+            package_json_mock.cordova = {'platforms': ['atari']};
             cordova_util.requireNoCache.and.returnValue(package_json_mock);
-            fs.existsSync.and.callFake(function(filePath) {
-                if(path.basename(filePath) === 'package.json') {
+            fs.existsSync.and.callFake(function (filePath) {
+                if (path.basename(filePath) === 'package.json') {
                     return true;
                 } else {
                     return false;
                 }
             });
-            platform_remove(hooks_mock, projectRoot, ['atari'], {save : false})
-            .then(function() {
-                expect(fs.writeFileSync).not.toHaveBeenCalled();
-                expect(cfg_parser_mock.prototype.write).not.toHaveBeenCalled();
-                expect(platform_metadata.remove).toHaveBeenCalled();
-                expect(events.emit).toHaveBeenCalledWith('verbose', jasmine.stringMatching(/Removing platform atari from platforms.json file/));
-            }).fail(function (e) {
-                fail('fail handler unexpectedly invoked');
-                console.error(e);
-            }).done(done);
+            platform_remove(hooks_mock, projectRoot, ['atari'], {save: false})
+                .then(function () {
+                    expect(fs.writeFileSync).not.toHaveBeenCalled();
+                    expect(cfg_parser_mock.prototype.write).not.toHaveBeenCalled();
+                    expect(platform_metadata.remove).toHaveBeenCalled();
+                    expect(events.emit).toHaveBeenCalledWith('verbose', jasmine.stringMatching(/Removing platform atari from platforms.json file/));
+                }).fail(function (e) {
+                    fail('fail handler unexpectedly invoked');
+                    console.error(e);
+                }).done(done);
         });
 
         it('fetch should be called', function (done) {
             spyOn(promiseutil, 'Q_chainmap').and.returnValue(true);
-            platform_remove(hooks_mock, projectRoot, ['atari'], {fetch : true})
-            .then(function() {
-                expect(promiseutil.Q_chainmap).toHaveBeenCalled();
-                expect(hooks_mock.fire).toHaveBeenCalledWith('after_platform_rm', Object({ fetch: true }));
-            }).fail(function (e) {
-                fail('fail handler unexpectedly invoked');
-                console.error(e);
-            }).done(done);
+            platform_remove(hooks_mock, projectRoot, ['atari'], {fetch: true})
+                .then(function () {
+                    expect(promiseutil.Q_chainmap).toHaveBeenCalled();
+                    expect(hooks_mock.fire).toHaveBeenCalledWith('after_platform_rm', Object({ fetch: true }));
+                }).fail(function (e) {
+                    fail('fail handler unexpectedly invoked');
+                    console.error(e);
+                }).done(done);
         });
 
-        it('should file the after_platform_* hook',function (done) {
-            platform_remove(hooks_mock, projectRoot, ['atari'], {save : true})
-            .then(function(result) {
-                expect(hooks_mock.fire).toHaveBeenCalledWith('after_platform_rm', Object({ save: true }));
-            }).fail(function (err) {
-                fail('unexpected failure handler invoked!');
-                console.error(err);
-            }).done(done);
+        it('should file the after_platform_* hook', function (done) {
+            platform_remove(hooks_mock, projectRoot, ['atari'], {save: true})
+                .then(function (result) {
+                    expect(hooks_mock.fire).toHaveBeenCalledWith('after_platform_rm', Object({ save: true }));
+                }).fail(function (err) {
+                    fail('unexpected failure handler invoked!');
+                    console.error(err);
+                }).done(done);
         });
-     });
+    });
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/src/hooks/HooksRunner.js
----------------------------------------------------------------------
diff --git a/src/hooks/HooksRunner.js b/src/hooks/HooksRunner.js
index 6e4e879..e05a541 100644
--- a/src/hooks/HooksRunner.js
+++ b/src/hooks/HooksRunner.js
@@ -6,9 +6,7 @@
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
-
  http://www.apache.org/licenses/LICENSE-2.0
-
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -16,6 +14,7 @@
  specific language governing permissions and limitations
  under the License.
  */
+
 var cordovaUtil = require('../cordova/util');
 var events = require('cordova-common').events;
 var Q = require('q');
@@ -142,7 +141,7 @@ function runScript (script, context) {
     if (typeof script.useModuleLoader === 'undefined') {
         // if it is not explicitly defined whether we should use modeule loader or not
         // we assume we should use module loader for .js files
-        script.useModuleLoader = path.extname(script.path).toLowerCase() === '.js';
+        script.useModuleLoader = path.extname(script.path).toLowerCase() == '.js'; // eslint-disable-line eqeqeq
     }
 
     var source;
@@ -226,7 +225,7 @@ function runScriptViaChildProcessSpawn (script, context) {
     return superspawn.spawn(command, args, execOpts)
         .catch(function (err) {
             // Don't treat non-executable files as errors. They could be READMEs, or Windows-only scripts.
-            if (!isWindows && err.code === 'EACCES') {
+            if (!isWindows && err.code == 'EACCES') { // eslint-disable-line eqeqeq
                 events.emit('verbose', 'Skipped non-executable file: ' + script.fullPath);
             } else {
                 throw new Error('Hook failed with error code ' + err.code + ': ' + script.fullPath);
@@ -243,7 +242,7 @@ function extractSheBangInterpreter (fullpath) {
     var hookFd = fs.openSync(fullpath, 'r');
     try {
         // this is a modern cluster size. no need to read less
-        fileData = Buffer.from(4096);
+        fileData = new Buffer(4096); // eslint-disable-line
         octetsRead = fs.readSync(hookFd, fileData, 0, 4096, 0);
         fileChunk = fileData.toString();
     } finally {
@@ -253,7 +252,7 @@ function extractSheBangInterpreter (fullpath) {
     var hookCmd, shMatch;
     // Filter out /usr/bin/env so that "/usr/bin/env node" works like "node".
     var shebangMatch = fileChunk.match(/^#!(?:\/usr\/bin\/env )?([^\r\n]+)/m);
-    if (octetsRead === 4096 && !fileChunk.match(/[\r\n]/)) { events.emit('warn', 'shebang is too long for "' + fullpath + '"'); }
+    if (octetsRead == 4096 && !fileChunk.match(/[\r\n]/)) { events.emit('warn', 'shebang is too long for "' + fullpath + '"'); } // eslint-disable-line eqeqeq
     if (shebangMatch) { hookCmd = shebangMatch[1]; }
     // Likewise, make /usr/bin/bash work like "bash".
     if (hookCmd) { shMatch = hookCmd.match(/bin\/((?:ba)?sh)$/); }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/src/plugman/init-defaults.js
----------------------------------------------------------------------
diff --git a/src/plugman/init-defaults.js b/src/plugman/init-defaults.js
index 5fe01bc..2fedc41 100644
--- a/src/plugman/init-defaults.js
+++ b/src/plugman/init-defaults.js
@@ -140,11 +140,11 @@ if (!pkg.author) {
                      config.get('init-author-name')) ?
         {
             'name': config.get('init.author.name') ||
-                            config.get('init-author-name'),
+                                    config.get('init-author-name'),
             'email': config.get('init.author.email') ||
-                            config.get('init-author-email'),
+                                    config.get('init-author-email'),
             'url': config.get('init.author.url') ||
-                            config.get('init-author-url')
+                                    config.get('init-author-url')
         }
         : prompt('author');
 }


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


[08/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/install.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/install.spec.js b/spec/plugman/install.spec.js
index b8c2664..7d9ca88 100644
--- a/spec/plugman/install.spec.js
+++ b/spec/plugman/install.spec.js
@@ -17,55 +17,51 @@
     under the License.
 */
 
-/* jshint sub:true */
-
-var path = require('path'),
-    install = require('../../src/plugman/install'),
-    actions = require('cordova-common').ActionStack,
-    xmlHelpers = require('cordova-common').xmlHelpers,
-    et      = require('elementtree'),
-    PlatformJson = require('cordova-common').PlatformJson,
-    events = require('cordova-common').events,
-    plugman = require('../../src/plugman/plugman'),
-    platforms = require('../../src/plugman/platforms/common'),
-    knownPlatforms  = require('../../src/platforms/platforms'),
-    common  = require('../common'),
-    fs      = require('fs'),
-    os      = require('os'),
-    path    = require('path'),
-    shell   = require('shelljs'),
-    child_process = require('child_process'),
-    semver  = require('semver'),
-    Q = require('q'),
-    spec    = __dirname,
-    done    = false,
-    srcProject = path.join(spec, 'projects', 'android'),
-    temp_dir = path.join(fs.realpathSync(os.tmpdir()), 'plugman-test'),
-    project = path.join(temp_dir, 'android_install'),
-    plugins_dir = path.join(spec, 'plugins'),
-    plugins_install_dir = path.join(project, 'cordova', 'plugins'),
-    plugins = {
-        'org.test.plugins.dummyplugin' : path.join(plugins_dir, 'org.test.plugins.dummyplugin'),
-        'com.cordova.engine' : path.join(plugins_dir, 'com.cordova.engine'),
-        'com.cordova.engine-android' : path.join(plugins_dir, 'com.cordova.engine-android'),
-        'org.test.plugins.childbrowser' : path.join(plugins_dir, 'org.test.plugins.childbrowser'),
-        'com.adobe.vars' : path.join(plugins_dir, 'com.adobe.vars'),
-        'org.test.defaultvariables' : path.join(plugins_dir, 'org.test.defaultvariables'),
-        'org.test.invalid.engine.script' : path.join(plugins_dir, 'org.test.invalid.engine.script'),
-        'org.test.invalid.engine.no.platform' : path.join(plugins_dir, 'org.test.invalid.engine.no.platform'),
-        'org.test.invalid.engine.no.scriptSrc' : path.join(plugins_dir, 'org.test.invalid.engine.no.scriptSrc'),
-        'A' : path.join(plugins_dir, 'dependencies', 'A'),
-        'B' : path.join(plugins_dir, 'dependencies', 'B'),
-        'C' : path.join(plugins_dir, 'dependencies', 'C'),
-        'F' : path.join(plugins_dir, 'dependencies', 'F'),
-        'G' : path.join(plugins_dir, 'dependencies', 'G'),
-        'I' : path.join(plugins_dir, 'dependencies', 'I'),
-        'C@1.0.0' : path.join(plugins_dir, 'dependencies', 'C@1.0.0')
-    },
-    results = {},
-    TIMEOUT = 90000,
-    superspawn = require('cordova-common').superspawn;
-
+var path = require('path');
+var install = require('../../src/plugman/install');
+var actions = require('cordova-common').ActionStack;
+var xmlHelpers = require('cordova-common').xmlHelpers;
+var et = require('elementtree');
+var PlatformJson = require('cordova-common').PlatformJson;
+var events = require('cordova-common').events;
+var plugman = require('../../src/plugman/plugman');
+var platforms = require('../../src/plugman/platforms/common');
+var knownPlatforms = require('../../src/platforms/platforms');
+var common = require('../common');
+var fs = require('fs');
+var os = require('os');
+var shell = require('shelljs');
+var child_process = require('child_process');
+var semver = require('semver');
+var Q = require('q');
+var spec = __dirname;
+var done = false; // eslint-disable-line no-unused-vars
+var srcProject = path.join(spec, 'projects', 'android');
+var temp_dir = path.join(fs.realpathSync(os.tmpdir()), 'plugman-test');
+var project = path.join(temp_dir, 'android_install');
+var plugins_dir = path.join(spec, 'plugins');
+var plugins_install_dir = path.join(project, 'cordova', 'plugins');
+var plugins = {
+    'org.test.plugins.dummyplugin': path.join(plugins_dir, 'org.test.plugins.dummyplugin'),
+    'com.cordova.engine': path.join(plugins_dir, 'com.cordova.engine'),
+    'com.cordova.engine-android': path.join(plugins_dir, 'com.cordova.engine-android'),
+    'org.test.plugins.childbrowser': path.join(plugins_dir, 'org.test.plugins.childbrowser'),
+    'com.adobe.vars': path.join(plugins_dir, 'com.adobe.vars'),
+    'org.test.defaultvariables': path.join(plugins_dir, 'org.test.defaultvariables'),
+    'org.test.invalid.engine.script': path.join(plugins_dir, 'org.test.invalid.engine.script'),
+    'org.test.invalid.engine.no.platform': path.join(plugins_dir, 'org.test.invalid.engine.no.platform'),
+    'org.test.invalid.engine.no.scriptSrc': path.join(plugins_dir, 'org.test.invalid.engine.no.scriptSrc'),
+    'A': path.join(plugins_dir, 'dependencies', 'A'),
+    'B': path.join(plugins_dir, 'dependencies', 'B'),
+    'C': path.join(plugins_dir, 'dependencies', 'C'),
+    'F': path.join(plugins_dir, 'dependencies', 'F'),
+    'G': path.join(plugins_dir, 'dependencies', 'G'),
+    'I': path.join(plugins_dir, 'dependencies', 'I'),
+    'C@1.0.0': path.join(plugins_dir, 'dependencies', 'C@1.0.0')
+};
+var results = {};
+var TIMEOUT = 90000;
+var superspawn = require('cordova-common').superspawn;
 
 // Pre-crete the temp dir, without it the test fails.
 shell.mkdir('-p', temp_dir);
@@ -74,21 +70,20 @@ var existsSync = fs.existsSync;
 
 // Mocked functions for tests
 var fake = {
-    'existsSync' : {
-        'noPlugins' : function(path){
+    'existsSync': {
+        'noPlugins': function (path) {
             // fake installed plugin directories as 'not found'
-            if( path.slice(-5) !== '.json' && path.indexOf(plugins_install_dir) >= 0) {
+            if (path.slice(-5) !== '.json' && path.indexOf(plugins_install_dir) >= 0) {
                 return false;
             }
 
             return existsSync(path);
         }
     },
-    'fetch' : {
-        'dependencies' : function(id, dir) {
-            if(id == plugins['A'])
-                return Q(id); // full path to plugin
-            return Q( path.join(plugins_dir, 'dependencies', id) );
+    'fetch': {
+        'dependencies': function (id, dir) {
+            if (id === plugins['A']) { return Q(id); } // full path to plugin
+            return Q(path.join(plugins_dir, 'dependencies', id));
         }
     }
 };
@@ -111,86 +106,96 @@ var TEST_XML = '<?xml version="1.0" encoding="UTF-8"?>\n' +
     '    <preference name="webviewbounce" value="true" />\n' +
     '</widget>\n';
 
-describe('plugman install start', function() {
-    var config_queue_add, proc, actions_push, ca, emit;
+describe('plugman install start', function () {
+    var config_queue_add;
+    var proc; // eslint-disable-line no-unused-vars
+    var actions_push;
+    var ca;
+    var emit;
 
-    beforeEach(function() {
+    beforeEach(function () {
         config_queue_add = spyOn(PlatformJson.prototype, 'addInstalledPluginToPrepareQueue');
-        proc = spyOn(actions.prototype, 'process').and.returnValue( Q(true) );
+        proc = spyOn(actions.prototype, 'process').and.returnValue(Q(true));
         actions_push = spyOn(actions.prototype, 'push');
         ca = spyOn(actions.prototype, 'createAction');
 
         var origParseElementtreeSync = xmlHelpers.parseElementtreeSync.bind(xmlHelpers);
-        spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function(path) {
+        spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function (path) {
             if (/config.xml$/.test(path)) return new et.ElementTree(et.XML(TEST_XML));
             return origParseElementtreeSync(path);
         });
     });
 
-    it('Test 001 : plugman install start', function(done) {
+    it('Test 001 : plugman install start', function (done) {
         shell.rm('-rf', project);
         shell.cp('-R', path.join(srcProject, '*'), project);
 
         // Every time when addPlugin is called it will return some truthy value
         var returnValueIndex = 0;
-        var returnValues = [true, {}, [], 'foo', function(){}];
+        var returnValues = [true, {}, [], 'foo', function () {}];
         var api = knownPlatforms.getPlatformApi('android', project);
         var addPluginOrig = api.addPlugin;
         spyOn(api, 'addPlugin').and.callFake(function () {
             return addPluginOrig.apply(api, arguments)
-            .thenResolve(returnValues[returnValueIndex++]);
+                .thenResolve(returnValues[returnValueIndex++]);
         });
 
         return install('android', project, plugins['org.test.plugins.dummyplugin'])
-        .then(function(result) {
-            expect(result).toBeTruthy();
-            results['actions_callCount'] = actions_push.calls.count();
-            results['actions_create'] = ca.calls.argsFor[0];
-            results['config_add'] = config_queue_add.calls.argsFor[0];
-            return result;
-        }).then(function(){
-            return install('android', project, plugins['com.cordova.engine']);
-        }).then(function(result) {
-            expect(result).toBeTruthy();
-            emit = spyOn(events, 'emit');
-            return install('android', project, plugins['org.test.plugins.childbrowser']);
-        }).then(function(result) {
-            expect(result).toBeTruthy();
-            return install('android', project, plugins['com.adobe.vars'], plugins_install_dir, { cli_variables:{API_KEY:'batman'} });
-        }).then(function(result){
-            expect(result).toBeTruthy();
-            return install('android', project, plugins['org.test.defaultvariables'], plugins_install_dir, { cli_variables:{API_KEY:'batman'} });
-        }).then(function(result){
-            expect(result).toBeTruthy();
-            results['emit_results'] = [];
-            emit.calls.all().forEach(function(val, i){
-                if(emit.calls.argsFor(i)[0] === 'results')
-                    results['emit_results'].push(emit.calls.argsFor(i)[1]);
+            .then(function (result) {
+                expect(result).toBeTruthy();
+                results['actions_callCount'] = actions_push.calls.count();
+                results['actions_create'] = ca.calls.argsFor[0];
+                results['config_add'] = config_queue_add.calls.argsFor[0];
+                return result;
+            }).then(function () {
+                return install('android', project, plugins['com.cordova.engine']);
+            }).then(function (result) {
+                expect(result).toBeTruthy();
+                emit = spyOn(events, 'emit');
+                return install('android', project, plugins['org.test.plugins.childbrowser']);
+            }).then(function (result) {
+                expect(result).toBeTruthy();
+                return install('android', project, plugins['com.adobe.vars'], plugins_install_dir, { cli_variables: {API_KEY: 'batman'} });
+            }).then(function (result) {
+                expect(result).toBeTruthy();
+                return install('android', project, plugins['org.test.defaultvariables'], plugins_install_dir, { cli_variables: {API_KEY: 'batman'} });
+            }).then(function (result) {
+                expect(result).toBeTruthy();
+                results['emit_results'] = [];
+                emit.calls.all().forEach(function (val, i) {
+                    if (emit.calls.argsFor(i)[0] === 'results') { results['emit_results'].push(emit.calls.argsFor(i)[1]); }
+                });
+                events.emit('verbose', '***** DONE START *****');
+                done();
+            }).fail(function (error) {
+                expect(error).toBeUndefined();
+                done();
             });
-            events.emit('verbose', '***** DONE START *****');
-            done();
-        }).fail(function(error) {
-            expect(error).toBeUndefined();
-            done();
-        });
     }, TIMEOUT);
 });
 
-describe('install', function() {
-    var chmod, exec, add_to_queue, cp, rm, fetchSpy;
+describe('install', function () {
+    /* eslint-disable no-unused-vars */
+    var chmod;
+    var exec;
+    var add_to_queue;
+    var cp;
+    var rm;
+    var fetchSpy;
     var spawnSpy;
+    /* eslint-enable no-unused-vars */
 
-    beforeEach(function() {
+    beforeEach(function () {
 
-        exec = spyOn(child_process, 'exec').and.callFake(function(cmd, cb) {
-            cb(false, '', '');
+        exec = spyOn(child_process, 'exec').and.callFake(function (cmd, cb) {
+            cb(false, '', ''); // eslint-disable-line standard/no-callback-literal
         });
         spawnSpy = spyOn(superspawn, 'spawn').and.returnValue(Q('3.1.0'));
         spyOn(fs, 'mkdirSync').and.returnValue(true);
         spyOn(shell, 'mkdir').and.returnValue(true);
         spyOn(platforms, 'copyFile').and.returnValue(true);
 
-        fetchSpy = spyOn(plugman, 'fetch').and.returnValue( Q( plugins['com.cordova.engine'] ) );
+        fetchSpy = spyOn(plugman, 'fetch').and.returnValue(Q(plugins['com.cordova.engine']));
         chmod = spyOn(fs, 'chmodSync').and.returnValue(true);
         spyOn(fs, 'writeFileSync').and.returnValue(true);
         cp = spyOn(shell, 'cp').and.returnValue(true);
@@ -199,32 +204,32 @@ describe('install', function() {
         done = false;
     });
 
-    describe('success', function() {
-        it('Test 002 : should emit a results event with platform-agnostic <info>', function() {
+    describe('success', function () {
+        it('Test 002 : should emit a results event with platform-agnostic <info>', function () {
             // org.test.plugins.childbrowser
             expect(results['emit_results'][0]).toBe('No matter what platform you are installing to, this notice is very important.');
         }, TIMEOUT);
-        it('Test 003 : should emit a results event with platform-specific <info>', function() {
+        it('Test 003 : should emit a results event with platform-specific <info>', function () {
             // org.test.plugins.childbrowser
             expect(results['emit_results'][1]).toBe('Please make sure you read this because it is very important to complete the installation of your plugin.');
         }, TIMEOUT);
-        it('Test 004 : should interpolate variables into <info> tags', function() {
+        it('Test 004 : should interpolate variables into <info> tags', function () {
             // VariableBrowser
             expect(results['emit_results'][2]).toBe('Remember that your api key is batman!');
         }, TIMEOUT);
-        it('Test 005 : should call fetch if provided plugin cannot be resolved locally', function(done) {
-            fetchSpy.and.returnValue( Q( plugins['org.test.plugins.dummyplugin'] ) );
-            spyOn(fs, 'existsSync').and.callFake( fake['existsSync']['noPlugins'] );
+        it('Test 005 : should call fetch if provided plugin cannot be resolved locally', function (done) {
+            fetchSpy.and.returnValue(Q(plugins['org.test.plugins.dummyplugin']));
+            spyOn(fs, 'existsSync').and.callFake(fake['existsSync']['noPlugins']);
             install('android', project, 'CLEANYOURSHORTS')
-            .fail(function(err){
-                expect(err).toBeUndefined();
-            })
-            .fin(function () {
-                expect(fetchSpy).toHaveBeenCalled();
-                done();
-            });
+                .fail(function (err) {
+                    expect(err).toBeUndefined();
+                })
+                .fin(function () {
+                    expect(fetchSpy).toHaveBeenCalled();
+                    done();
+                });
         });
-        
+
         describe('engine versions', function () {
             var fail, satisfies;
             beforeEach(function () {
@@ -233,297 +238,297 @@ describe('install', function() {
                 spyOn(PlatformJson.prototype, 'isPluginInstalled').and.returnValue(false);
             });
 
-            it('Test 007 : should check version if plugin has engine tag', function(done){
-                exec.and.callFake(function(cmd, cb) { cb(null, '2.5.0\n'); });
+            it('Test 007 : should check version if plugin has engine tag', function (done) {
+                exec.and.callFake(function (cmd, cb) { cb(null, '2.5.0\n'); });
                 install('android', project, plugins['com.cordova.engine'])
-                .fail(fail)
-                .fin(function () {
-                    expect(satisfies).toHaveBeenCalledWith('2.5.0','>=1.0.0', true);
-                    done();
-                });
+                    .fail(fail)
+                    .fin(function () {
+                        expect(satisfies).toHaveBeenCalledWith('2.5.0', '>=1.0.0', true);
+                        done();
+                    });
             }, TIMEOUT);
-            it('Test 008 : should check version and munge it a little if it has "rc" in it so it plays nice with semver (introduce a dash in it)', function(done) {
-                exec.and.callFake(function(cmd, cb) { cb(null, '3.0.0rc1\n'); });
+            it('Test 008 : should check version and munge it a little if it has "rc" in it so it plays nice with semver (introduce a dash in it)', function (done) {
+                exec.and.callFake(function (cmd, cb) { cb(null, '3.0.0rc1\n'); });
                 install('android', project, plugins['com.cordova.engine'])
-                .fail(fail)
-                .fin(function () {
-                    expect(satisfies).toHaveBeenCalledWith('3.0.0-rc1','>=1.0.0', true);
-                    done();
-                });
+                    .fail(fail)
+                    .fin(function () {
+                        expect(satisfies).toHaveBeenCalledWith('3.0.0-rc1', '>=1.0.0', true);
+                        done();
+                    });
             }, TIMEOUT);
-            it('Test 009 : should check specific platform version over cordova version if specified', function(done) {
-                exec.and.callFake(function(cmd, cb) { cb(null, '3.1.0\n'); });
+            it('Test 009 : should check specific platform version over cordova version if specified', function (done) {
+                exec.and.callFake(function (cmd, cb) { cb(null, '3.1.0\n'); });
                 install('android', project, plugins['com.cordova.engine-android'])
-                .fail(fail)
-                .fin(function() {
-                    expect(satisfies).toHaveBeenCalledWith('3.1.0','>=3.1.0', true);
-                    done();
-                });
+                    .fail(fail)
+                    .fin(function () {
+                        expect(satisfies).toHaveBeenCalledWith('3.1.0', '>=3.1.0', true);
+                        done();
+                    });
             }, TIMEOUT);
-            it('Test 010 : should check platform sdk version if specified', function(done) {
+            it('Test 010 : should check platform sdk version if specified', function (done) {
                 var cordovaVersion = require('../../package.json').version.replace(/-dev|-nightly.*$/, '');
-                exec.and.callFake(function(cmd, cb) { cb(null, '18\n'); });
+                exec.and.callFake(function (cmd, cb) { cb(null, '18\n'); });
                 install('android', project, plugins['com.cordova.engine-android'])
-                .fail(fail)
-                .fin(function() {
-                    expect(satisfies.calls.count()).toBe(3);
-                    // <engine name="cordova" VERSION=">=3.0.0"/>
-                    expect(satisfies.calls.argsFor(0)).toEqual([ cordovaVersion, '>=3.0.0', true ]);
-                    // <engine name="cordova-android" VERSION=">=3.1.0"/>
-                    expect(satisfies.calls.argsFor(1)).toEqual([ '18.0.0', '>=3.1.0', true ]);
-                    // <engine name="android-sdk" VERSION=">=18"/>
-                    expect(satisfies.calls.argsFor(2)).toEqual([ '18.0.0','>=18', true ]);
-                    done();
-                });
+                    .fail(fail)
+                    .fin(function () {
+                        expect(satisfies.calls.count()).toBe(3);
+                        // <engine name="cordova" VERSION=">=3.0.0"/>
+                        expect(satisfies.calls.argsFor(0)).toEqual([ cordovaVersion, '>=3.0.0', true ]);
+                        // <engine name="cordova-android" VERSION=">=3.1.0"/>
+                        expect(satisfies.calls.argsFor(1)).toEqual([ '18.0.0', '>=3.1.0', true ]);
+                        // <engine name="android-sdk" VERSION=">=18"/>
+                        expect(satisfies.calls.argsFor(2)).toEqual([ '18.0.0', '>=18', true ]);
+                        done();
+                    });
             }, TIMEOUT);
-            it('Test 011 : should check engine versions', function(done) {
+            it('Test 011 : should check engine versions', function (done) {
                 install('android', project, plugins['com.cordova.engine'])
-                .fail(fail)
-                .fin(function() {
-                    var plugmanVersion = require('../../package.json').version.replace(/-dev|-nightly.*$/, '');
-                    var cordovaVersion = require('../../package.json').version.replace(/-dev|-nightly.*$/, '');
-                    expect(satisfies.calls.count()).toBe(4);
-                    // <engine name="cordova" version=">=2.3.0"/>
-                    expect(satisfies.calls.argsFor(0)).toEqual([ cordovaVersion, '>=2.3.0', true ]);
-                    // <engine name="cordova-plugman" version=">=0.10.0" />
-                    expect(satisfies.calls.argsFor(1)).toEqual([ plugmanVersion, '>=0.10.0', true ]);
-                    // <engine name="mega-fun-plugin" version=">=1.0.0" scriptSrc="megaFunVersion" platform="*" />
-                    expect(satisfies.calls.argsFor(2)).toEqual([ null, '>=1.0.0', true ]);
-                    // <engine name="mega-boring-plugin" version=">=3.0.0" scriptSrc="megaBoringVersion" platform="ios|android" />
-                    expect(satisfies.calls.argsFor(3)).toEqual([ null, '>=3.0.0', true ]);
-                    done();
-                });
+                    .fail(fail)
+                    .fin(function () {
+                        var plugmanVersion = require('../../package.json').version.replace(/-dev|-nightly.*$/, '');
+                        var cordovaVersion = require('../../package.json').version.replace(/-dev|-nightly.*$/, '');
+                        expect(satisfies.calls.count()).toBe(4);
+                        // <engine name="cordova" version=">=2.3.0"/>
+                        expect(satisfies.calls.argsFor(0)).toEqual([ cordovaVersion, '>=2.3.0', true ]);
+                        // <engine name="cordova-plugman" version=">=0.10.0" />
+                        expect(satisfies.calls.argsFor(1)).toEqual([ plugmanVersion, '>=0.10.0', true ]);
+                        // <engine name="mega-fun-plugin" version=">=1.0.0" scriptSrc="megaFunVersion" platform="*" />
+                        expect(satisfies.calls.argsFor(2)).toEqual([ null, '>=1.0.0', true ]);
+                        // <engine name="mega-boring-plugin" version=">=3.0.0" scriptSrc="megaBoringVersion" platform="ios|android" />
+                        expect(satisfies.calls.argsFor(3)).toEqual([ null, '>=3.0.0', true ]);
+                        done();
+                    });
             }, TIMEOUT);
-            it('Test 012 : should not check custom engine version that is not supported for platform', function(done) {
+            it('Test 012 : should not check custom engine version that is not supported for platform', function (done) {
                 install('blackberry10', project, plugins['com.cordova.engine'])
-                .then(fail)
-                .fail(function () {
-                    expect(satisfies).not.toHaveBeenCalledWith('','>=3.0.0', true);
-                })
-                .fin(done);
+                    .then(fail)
+                    .fail(function () {
+                        expect(satisfies).not.toHaveBeenCalledWith('', '>=3.0.0', true);
+                    })
+                    .fin(done);
             }, TIMEOUT);
         });
 
-        it('Test 014 : should not check custom engine version that is not supported for platform', function(done) {
+        it('Test 014 : should not check custom engine version that is not supported for platform', function (done) {
             var spy = spyOn(semver, 'satisfies').and.returnValue(true);
             install('blackberry10', project, plugins['com.cordova.engine'])
-            .then(function() {
-                expect(spy).not.toHaveBeenCalledWith('','>=3.0.0');
-            }).fail(function(err) {
-                expect(err).toBeUndefined();
-            }).fin(done);
+                .then(function () {
+                    expect(spy).not.toHaveBeenCalledWith('', '>=3.0.0');
+                }).fail(function (err) {
+                    expect(err).toBeUndefined();
+                }).fin(done);
         }, TIMEOUT);
 
-        describe('with dependencies', function() {
+        describe('with dependencies', function () {
             var emit;
-            beforeEach(function() {
-                spyOn(fs, 'existsSync').and.callFake( fake['existsSync']['noPlugins'] );
-                fetchSpy.and.callFake( fake['fetch']['dependencies'] );
+            beforeEach(function () {
+                spyOn(fs, 'existsSync').and.callFake(fake['existsSync']['noPlugins']);
+                fetchSpy.and.callFake(fake['fetch']['dependencies']);
                 emit = spyOn(events, 'emit');
-                exec.and.callFake(function(cmd, cb) {
+                exec.and.callFake(function (cmd, cb) {
                     cb(null, '9.0.0\n');
                 });
 
-                function PlatformApiMock() {}
-                PlatformApiMock.addPlugin = function() {
+                function PlatformApiMock () {}
+                PlatformApiMock.addPlugin = function () {
                     return Q();
                 };
                 spyOn(knownPlatforms, 'getPlatformApi').and.returnValue(PlatformApiMock);
             });
 
-            it('Test 015 : should install specific version of dependency', function(done) {
+            it('Test 015 : should install specific version of dependency', function (done) {
                 // Plugin I depends on C@1.0.0
                 emit.calls.reset();
                 return install('android', project, plugins['I'])
-                .then(function() {
-                    var install = common.spy.getInstall(emit);
-                    expect(fetchSpy).toHaveBeenCalledWith('C@1.0.0', jasmine.any(String), jasmine.any(Object));
-                    expect(install).toEqual([
-                        'Install start for "C" on android.',
-                        'Install start for "I" on android.'
-                    ]);
-                    done();
-                }, TIMEOUT);
+                    .then(function () {
+                        var install = common.spy.getInstall(emit);
+                        expect(fetchSpy).toHaveBeenCalledWith('C@1.0.0', jasmine.any(String), jasmine.any(Object));
+                        expect(install).toEqual([
+                            'Install start for "C" on android.',
+                            'Install start for "I" on android.'
+                        ]);
+                        done();
+                    }, TIMEOUT);
             }, TIMEOUT);
 
-            it('Test 016 : should install any dependent plugins if missing', function(done) {
+            it('Test 016 : should install any dependent plugins if missing', function (done) {
                 emit.calls.reset();
                 return install('android', project, plugins['A'])
-                .then(function() {
-                    var install = common.spy.getInstall(emit);
-                    expect(install).toEqual([
-                        'Install start for "C" on android.',
-                        'Install start for "D" on android.',
-                        'Install start for "A" on android.'
-                    ]);
-                    done();
-                }); 
+                    .then(function () {
+                        var install = common.spy.getInstall(emit);
+                        expect(install).toEqual([
+                            'Install start for "C" on android.',
+                            'Install start for "D" on android.',
+                            'Install start for "A" on android.'
+                        ]);
+                        done();
+                    });
             }, TIMEOUT);
 
-            it('Test 017 : should install any dependent plugins from registry when url is not defined', function(done) {
+            it('Test 017 : should install any dependent plugins from registry when url is not defined', function (done) {
                 emit.calls.reset();
                 return install('android', project, plugins['A'])
-                .then(function() {
-                    var install = common.spy.getInstall(emit);
-                    expect(install).toEqual([
-                        'Install start for "C" on android.',
-                        'Install start for "D" on android.',
-                        'Install start for "A" on android.'
-                    ]);
-                    done();
-                });
+                    .then(function () {
+                        var install = common.spy.getInstall(emit);
+                        expect(install).toEqual([
+                            'Install start for "C" on android.',
+                            'Install start for "D" on android.',
+                            'Install start for "A" on android.'
+                        ]);
+                        done();
+                    });
             }, TIMEOUT);
 
-            it('Test 018 : should process all dependent plugins with alternate routes to the same plugin', function(done) {
+            it('Test 018 : should process all dependent plugins with alternate routes to the same plugin', function (done) {
                 // Plugin F depends on A, C, D and E
                 emit.calls.reset();
                 return install('android', project, plugins['F'])
-                .then(function() {
-                    var install = common.spy.getInstall(emit);
-                    expect(install).toEqual([
-                        'Install start for "C" on android.',
-                        'Install start for "D" on android.',
-                        'Install start for "A" on android.',
-                        'Install start for "D" on android.',
-                        'Install start for "F" on android.'
-                    ]);
-                    done();
-                });
+                    .then(function () {
+                        var install = common.spy.getInstall(emit);
+                        expect(install).toEqual([
+                            'Install start for "C" on android.',
+                            'Install start for "D" on android.',
+                            'Install start for "A" on android.',
+                            'Install start for "D" on android.',
+                            'Install start for "F" on android.'
+                        ]);
+                        done();
+                    });
             }, TIMEOUT);
 
-            it('Test 019 : should throw if there is a cyclic dependency', function(done) {
+            it('Test 019 : should throw if there is a cyclic dependency', function (done) {
                 return install('android', project, plugins['G'])
-                .then(function() {
-                    common.spy.getInstall(emit);
-                }).fail(function err (errMsg) {
-                    expect(errMsg.toString()).toContain('Cyclic dependency from G to H');
-                }).fin(done);
+                    .then(function () {
+                        common.spy.getInstall(emit);
+                    }).fail(function err (errMsg) {
+                        expect(errMsg.toString()).toContain('Cyclic dependency from G to H');
+                    }).fin(done);
             }, TIMEOUT);
 
-            it('Test 020 : install subdir relative to top level plugin if no fetch meta', function(done) {
+            it('Test 020 : install subdir relative to top level plugin if no fetch meta', function (done) {
                 return install('android', project, plugins['B'])
-                .then(function() {
-                    var install = common.spy.getInstall(emit);
-                    expect(install).toEqual([
-                        'Install start for "D" on android.',
-                        'Install start for "E" on android.',
-                        'Install start for "B" on android.'
-                    ]);
-                    done();
-                });
+                    .then(function () {
+                        var install = common.spy.getInstall(emit);
+                        expect(install).toEqual([
+                            'Install start for "D" on android.',
+                            'Install start for "E" on android.',
+                            'Install start for "B" on android.'
+                        ]);
+                        done();
+                    });
             }, TIMEOUT);
 
-            it('Test 021 : install uses meta data (if available) of top level plugin source', function(done) {
+            it('Test 021 : install uses meta data (if available) of top level plugin source', function (done) {
                 // Fake metadata so plugin 'B' appears from 'meta/B'
                 var meta = require('../../src/plugman/util/metadata');
-                spyOn(meta, 'get_fetch_metadata').and.callFake(function(){
+                spyOn(meta, 'get_fetch_metadata').and.callFake(function () {
                     return {
                         source: {type: 'dir', url: path.join(plugins['B'], '..', 'meta')}
                     };
                 });
 
                 return install('android', project, plugins['B'])
-                .then(function() {
-                    var install = common.spy.getInstall(emit);
-                    expect(install).toEqual([
-                        'Install start for "D" on android.',
-                        'Install start for "E" on android.',
-                        'Install start for "B" on android.'
-                    ]);
-
-                    var copy = common.spy.startsWith(emit, 'Copying from');
-                    expect(copy.length).toBe(3);
-                    expect(copy[0].indexOf(path.normalize('meta/D')) > 0).toBe(true);
-                    expect(copy[1].indexOf(path.normalize('meta/subdir/E')) > 0).toBe(true);
-                    done();
-                });
+                    .then(function () {
+                        var install = common.spy.getInstall(emit);
+                        expect(install).toEqual([
+                            'Install start for "D" on android.',
+                            'Install start for "E" on android.',
+                            'Install start for "B" on android.'
+                        ]);
+
+                        var copy = common.spy.startsWith(emit, 'Copying from');
+                        expect(copy.length).toBe(3);
+                        expect(copy[0].indexOf(path.normalize('meta/D')) > 0).toBe(true);
+                        expect(copy[1].indexOf(path.normalize('meta/subdir/E')) > 0).toBe(true);
+                        done();
+                    });
             }, TIMEOUT);
         });
     });
 
-    describe('failure', function() {
-        it('Test 023 : should throw if variables are missing', function(done) {
+    describe('failure', function () {
+        it('Test 023 : should throw if variables are missing', function (done) {
             var success = jasmine.createSpy('success');
             spyOn(PlatformJson.prototype, 'isPluginInstalled').and.returnValue(false);
             install('android', project, plugins['com.adobe.vars'])
-            .then(success)
-            .fail(function (err) {
-                expect(err.toString()).toContain('Variable(s) missing: API_KEY');
-            })
-            .fin(function () {
-                expect(success).not.toHaveBeenCalled();
-                done();
-            });
+                .then(success)
+                .fail(function (err) {
+                    expect(err.toString()).toContain('Variable(s) missing: API_KEY');
+                })
+                .fin(function () {
+                    expect(success).not.toHaveBeenCalled();
+                    done();
+                });
         }, TIMEOUT);
 
-        it('Test 024 : should throw if git is not found on the path and a remote url is requested', function(done) {
-            spyOn(fs, 'existsSync').and.callFake( fake['existsSync']['noPlugins'] );
+        it('Test 024 : should throw if git is not found on the path and a remote url is requested', function (done) {
+            spyOn(fs, 'existsSync').and.callFake(fake['existsSync']['noPlugins']);
             fetchSpy.and.callThrough();
             spyOn(shell, 'which').and.returnValue(null);
             install('android', project, 'https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git')
-            .then(function(result) {
-                expect(false).toBe(true);
-                done();
-            }).fail(function err(errMsg) {
-                expect(errMsg.toString()).toContain('"git" command line tool is not installed: make sure it is accessible on your PATH.');
-                done();
-            });
+                .then(function (result) {
+                    expect(false).toBe(true);
+                    done();
+                }).fail(function err (errMsg) {
+                    expect(errMsg.toString()).toContain('"git" command line tool is not installed: make sure it is accessible on your PATH.');
+                    done();
+                });
         }, TIMEOUT);
 
-        it('Test 025 :should not fail when trying to install plugin less than minimum version. Skip instead  ', function(done){
+        it('Test 025 :should not fail when trying to install plugin less than minimum version. Skip instead  ', function (done) {
             spyOn(semver, 'satisfies').and.returnValue(false);
-            exec.and.callFake(function(cmd, cb) {
+            exec.and.callFake(function (cmd, cb) {
                 cb(null, '0.0.1\n');
             });
             install('android', project, plugins['com.cordova.engine'])
-            .then(function(result) {
-                expect(result).toBe(true);
-                done();
-            })
-            .fail(function (error) {
-                expect(error).toBeUndefined();
-            });
+                .then(function (result) {
+                    expect(result).toBe(true);
+                    done();
+                })
+                .fail(function (error) {
+                    expect(error).toBeUndefined();
+                });
         }, TIMEOUT);
 
-        it('Test 026 : should throw if the engine scriptSrc escapes out of the plugin dir.', function(done) {
-            var success = jasmine.createSpy('success'),
-                fail = jasmine.createSpy('fail').and.callFake(function(err) {
-                    // <engine name="path-escaping-plugin" version=">=1.0.0" scriptSrc="../../../malicious/script" platform="*" />
-                    expect(err).toBeDefined();
-                    expect(err.message.indexOf('Security violation:')).toBe(0);
-                });
+        it('Test 026 : should throw if the engine scriptSrc escapes out of the plugin dir.', function (done) {
+            var success = jasmine.createSpy('success');
+            var fail = jasmine.createSpy('fail').and.callFake(function (err) {
+                // <engine name="path-escaping-plugin" version=">=1.0.0" scriptSrc="../../../malicious/script" platform="*" />
+                expect(err).toBeDefined();
+                expect(err.message.indexOf('Security violation:')).toBe(0);
+            });
 
             spyOn(PlatformJson.prototype, 'isPluginInstalled').and.returnValue(false);
             install('android', project, plugins['org.test.invalid.engine.script'])
                 .then(success)
                 .fail(fail)
-                .fin(function() {
+                .fin(function () {
                     expect(success).not.toHaveBeenCalled();
                     expect(fail).toHaveBeenCalled();
                     done();
                 });
         }, TIMEOUT);
-        it('Test 027 : should throw if a non-default cordova engine platform attribute is not defined.', function(done) {
-            var success = jasmine.createSpy('success'),
-                fail = jasmine.createSpy('fail');
+        it('Test 027 : should throw if a non-default cordova engine platform attribute is not defined.', function (done) {
+            var success = jasmine.createSpy('success');
+            var fail = jasmine.createSpy('fail');
             spyOn(PlatformJson.prototype, 'isPluginInstalled').and.returnValue(false);
             install('android', project, plugins['org.test.invalid.engine.no.platform'])
                 .then(success)
                 .fail(fail)
-                .fin(function() {
+                .fin(function () {
                     expect(success).not.toHaveBeenCalled();
                     expect(fail).toHaveBeenCalled();
                     done();
                 });
         }, TIMEOUT);
-        it('Test 028 : should throw if a non-default cordova engine scriptSrc attribute is not defined.', function(done) {
-            var success = jasmine.createSpy('success'),
-                fail = jasmine.createSpy('fail');
+        it('Test 028 : should throw if a non-default cordova engine scriptSrc attribute is not defined.', function (done) {
+            var success = jasmine.createSpy('success');
+            var fail = jasmine.createSpy('fail');
             spyOn(PlatformJson.prototype, 'isPluginInstalled').and.returnValue(false);
             install('android', project, plugins['org.test.invalid.engine.no.scriptSrc'])
                 .then(success)
                 .fail(fail)
-                .fin(function() {
+                .fin(function () {
                     expect(success).not.toHaveBeenCalled();
                     expect(fail).toHaveBeenCalled();
                     done();
@@ -532,9 +537,9 @@ describe('install', function() {
     });
 });
 
-describe('end', function() {
+describe('end', function () {
 
-    it('Test 034 : end', function() {
+    it('Test 034 : end', function () {
         shell.rm('-rf', temp_dir);
     }, TIMEOUT);
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/owner.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/owner.spec.js b/spec/plugman/owner.spec.js
index 54b4d81..0b85fc8 100644
--- a/spec/plugman/owner.spec.js
+++ b/spec/plugman/owner.spec.js
@@ -16,12 +16,12 @@
     specific language governing permissions and limitations
     under the License.
 */
-var owner = require('../../src/plugman/owner'),
-    Q = require('q'),
-    registry = require('../../src/plugman/registry/registry');
+var owner = require('../../src/plugman/owner');
+var Q = require('q');
+var registry = require('../../src/plugman/registry/registry');
 
-describe('owner', function() {
-    it('Test 001 : should run owner', function() {
+describe('owner', function () {
+    it('Test 001 : should run owner', function () {
         var sOwner = spyOn(registry, 'owner').and.returnValue(Q());
         var params = ['add', 'anis', 'org.test.plugins.dummyplugin'];
         owner(params);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/platforms/blackberry10.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/platforms/blackberry10.spec.js b/spec/plugman/platforms/blackberry10.spec.js
index 5ff0e4d..d819d8e 100644
--- a/spec/plugman/platforms/blackberry10.spec.js
+++ b/spec/plugman/platforms/blackberry10.spec.js
@@ -16,14 +16,14 @@
     specific language governing permissions and limitations
     under the License.
 */
-var blackberry10 = require('../../../src/plugman/platforms/blackberry10'),
-    common = require('../../../src/plugman/platforms/common'),
-    path = require('path'),
-    fs = require('fs'),
-    shell = require('shelljs'),
-    os = require('os'),
-    temp = path.join(os.tmpdir(), 'plugman'),
-    blackberry10_project = path.join(__dirname, '..', 'projects', 'blackberry10', '*');
+var blackberry10 = require('../../../src/plugman/platforms/blackberry10');
+var common = require('../../../src/plugman/platforms/common');
+var path = require('path');
+var fs = require('fs');
+var shell = require('shelljs');
+var os = require('os');
+var temp = path.join(os.tmpdir(), 'plugman');
+var blackberry10_project = path.join(__dirname, '..', 'projects', 'blackberry10', '*');
 var PluginInfo = require('cordova-common').PluginInfo;
 
 var plugins = {
@@ -32,67 +32,65 @@ var plugins = {
     echo: new PluginInfo(path.join(__dirname, '..', 'plugins', 'com.cordova.echo'))
 };
 
-
-function copyArray(arr) {
+function copyArray (arr) {
     return Array.prototype.slice.call(arr, 0);
 }
 
-
-describe('blackberry10 project handler', function() {
-    describe('www_dir method', function() {
-        it('Test 001 : should return cordova-blackberry10 project www location using www_dir', function() {
+describe('blackberry10 project handler', function () {
+    describe('www_dir method', function () {
+        it('Test 001 : should return cordova-blackberry10 project www location using www_dir', function () {
             expect(blackberry10.www_dir(path.sep)).toEqual(path.sep + 'www');
         });
     });
 
-    describe('package_name method', function() {
-        it('Test 002 : should return a blackberry10 project\'s proper package name', function() {
+    describe('package_name method', function () {
+        it('Test 002 : should return a blackberry10 project\'s proper package name', function () {
             expect(blackberry10.package_name(path.join(blackberry10_project, '..'))).toEqual('cordovaExample');
         });
     });
 
-    describe('installation', function() {
-        beforeEach(function() {
+    describe('installation', function () {
+        beforeEach(function () {
             shell.mkdir('-p', temp);
             shell.cp('-rf', blackberry10_project, temp);
         });
-        afterEach(function() {
+        afterEach(function () {
             shell.rm('-rf', temp);
         });
-        describe('of <lib-file> elements', function() {
+        describe('of <lib-file> elements', function () {
             it('Test 003 : should copy so files to native/target/plugins', function () {
-                var plugin = plugins.echo,
-                    libs = copyArray(plugin.getLibFiles('blackberry10')),
-                    s = spyOn(common, 'copyFile');
+                var plugin = plugins.echo;
+                var libs = copyArray(plugin.getLibFiles('blackberry10'));
+                var s = spyOn(common, 'copyFile');
 
                 blackberry10['lib-file'].install(libs[0], plugin.dir, temp);
                 expect(s).toHaveBeenCalledWith(plugin.dir, 'src/blackberry10/native/device/echoJnext.so', temp, path.join('native', 'device', 'plugins', 'jnext', 'echoJnext.so'), false);
             });
         });
-        describe('of <source-file> elements', function() {
-            it('Test 004 : should copy stuff from one location to another by calling common.copyFile', function() {
-                var plugin = plugins.echo,
-                    source = copyArray(plugin.getSourceFiles('blackberry10')),
-                    s = spyOn(common, 'copyFile');
+        describe('of <source-file> elements', function () {
+            it('Test 004 : should copy stuff from one location to another by calling common.copyFile', function () {
+                var plugin = plugins.echo;
+                var source = copyArray(plugin.getSourceFiles('blackberry10'));
+                var s = spyOn(common, 'copyFile');
 
                 blackberry10['source-file'].install(source[0], plugin.dir, temp, plugin.id);
                 expect(s).toHaveBeenCalledWith(plugin.dir, 'src/blackberry10/index.js', temp, path.join('native', 'device', 'chrome', 'plugin', 'com.cordova.echo', 'index.js'), false);
                 expect(s).toHaveBeenCalledWith(plugin.dir, 'src/blackberry10/index.js', temp, path.join('native', 'simulator', 'chrome', 'plugin', 'com.cordova.echo', 'index.js'), false);
             });
-            it('Test 005 : defaults to plugin id when dest is not present', function() {
+            it('Test 005 : defaults to plugin id when dest is not present', function () {
                 var source = copyArray(plugins.dummy.getSourceFiles('blackberry10'));
                 var s = spyOn(common, 'copyFile');
                 blackberry10['source-file'].install(source[0], plugins.dummy.dir, temp, plugins.dummy.id);
                 expect(s).toHaveBeenCalledWith(plugins.dummy.dir, 'src/blackberry10/index.js', temp, path.join('native', 'device', 'chrome', 'plugin', plugins.dummy.id, 'index.js'), false);
                 expect(s).toHaveBeenCalledWith(plugins.dummy.dir, 'src/blackberry10/index.js', temp, path.join('native', 'simulator', 'chrome', 'plugin', plugins.dummy.id, 'index.js'), false);
             });
-            it('Test 006 : should throw if source file cannot be found', function() {
+            it('Test 006 : should throw if source file cannot be found', function () {
                 var source = copyArray(plugins.faulty.getSourceFiles('blackberry10'));
-                expect(function() {
+                expect(function () {
                     blackberry10['source-file'].install(source[0], plugins.faulty.dir, temp, plugins.faulty.id);
-                }).toThrow(new Error ('"' + path.resolve(plugins.faulty.dir, 'src/blackberry10/index.js') + '" not found!'));
+                }).toThrow(new Error('"' + path.resolve(plugins.faulty.dir, 'src/blackberry10/index.js') + '" not found!'));
             });
-            it('Test 007 : should throw if target file already exists', function() {
+            it('Test 007 : should throw if target file already exists', function () {
                 // write out a file
                 var target = path.resolve(temp, 'native/device/chrome/plugin/org.test.plugins.dummyplugin');
                 shell.mkdir('-p', target);
@@ -100,34 +98,34 @@ describe('blackberry10 project handler', function() {
                 fs.writeFileSync(target, 'some bs', 'utf-8');
 
                 var source = copyArray(plugins.dummy.getSourceFiles('blackberry10'));
-                expect(function() {
+                expect(function () {
                     blackberry10['source-file'].install(source[0], plugins.dummy.dir, temp, plugins.dummy.id);
-                }).toThrow(new Error ('"' + target + '" already exists!'));
+                }).toThrow(new Error('"' + target + '" already exists!'));
             });
         });
     });
 
-    describe('uninstallation', function() {
-        beforeEach(function() {
+    describe('uninstallation', function () {
+        beforeEach(function () {
             shell.mkdir('-p', temp);
             shell.cp('-rf', blackberry10_project, temp);
         });
-        afterEach(function() {
+        afterEach(function () {
             shell.rm('-rf', temp);
         });
-        describe('of <source-file> elements', function() {
-            it('Test 008 : should remove stuff by calling common.removeFile', function() {
-                var s = spyOn(common, 'removeFile'),
-                    plugin = plugins.echo;
+        describe('of <source-file> elements', function () {
+            it('Test 008 : should remove stuff by calling common.removeFile', function () {
+                var s = spyOn(common, 'removeFile');
+                var plugin = plugins.echo;
                 var source = copyArray(plugin.getSourceFiles('blackberry10'));
                 blackberry10['source-file'].install(source[0], plugin.dir, temp, plugin.id);
                 blackberry10['source-file'].uninstall(source[0], temp, plugin.id);
                 expect(s).toHaveBeenCalledWith(temp, path.join('native', 'device', 'chrome', 'plugin', 'com.cordova.echo', 'index.js'));
                 expect(s).toHaveBeenCalledWith(temp, path.join('native', 'simulator', 'chrome', 'plugin', 'com.cordova.echo', 'index.js'));
             });
-            it('Test 009 : should remove stuff by calling common.removeFile', function() {
-                var s = spyOn(common, 'removeFile'),
-                    plugin = plugins.dummy;
+            it('Test 009 : should remove stuff by calling common.removeFile', function () {
+                var s = spyOn(common, 'removeFile');
+                var plugin = plugins.dummy;
                 var source = copyArray(plugin.getSourceFiles('blackberry10'));
                 blackberry10['source-file'].install(source[0], plugin.dir, temp, plugin.id);
                 blackberry10['source-file'].uninstall(source[0], temp, plugin.id);
@@ -135,14 +133,14 @@ describe('blackberry10 project handler', function() {
                 expect(s).toHaveBeenCalledWith(temp, path.join('native', 'simulator', 'chrome', 'plugin', plugin.id, 'index.js'));
             });
         });
-        describe('of <lib-file> elements', function() {
+        describe('of <lib-file> elements', function () {
             it('Test 010 : should remove so files from www/plugins', function () {
-                var s = spyOn(common, 'removeFile'),
-                    plugin = plugins.echo;
+                var s = spyOn(common, 'removeFile');
+                var plugin = plugins.echo;
                 var source = copyArray(plugin.getLibFiles('blackberry10'));
                 blackberry10['lib-file'].install(source[0], plugin.dir, temp, plugin.id);
                 blackberry10['lib-file'].uninstall(source[0], temp, plugin.id);
-                expect(s).toHaveBeenCalledWith(temp, path.join('native','device','plugins','jnext','echoJnext.so'));
+                expect(s).toHaveBeenCalledWith(temp, path.join('native', 'device', 'plugins', 'jnext', 'echoJnext.so'));
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/platforms/common.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/platforms/common.spec.js b/spec/plugman/platforms/common.spec.js
index cadf046..d16c2d5 100644
--- a/spec/plugman/platforms/common.spec.js
+++ b/spec/plugman/platforms/common.spec.js
@@ -16,62 +16,60 @@
  *
 */
 
-/* jshint laxcomma:true */
-
-var common = require('../../../src/plugman/platforms/common')
-  , path = require('path')
-  , fs = require('fs')
-  , osenv = require('os')
-  , shell = require('shelljs')
-  , test_dir = path.join(osenv.tmpdir(), 'test_plugman')
-  , project_dir = path.join(test_dir, 'project')
-  , src = path.join(project_dir, 'src')
-  , dest = path.join(project_dir, 'dest')
-  , java_dir = path.join(src, 'one', 'two', 'three')
-  , java_file = path.join(java_dir, 'test.java')
-  , symlink_file = path.join(java_dir, 'symlink')
-  , symlink_dir = path.join(java_dir, 'symlink_dir')
-  , symlink_dir_relative_file = path.join('one', 'two', 'file')
-  , non_plugin_file = path.join(osenv.tmpdir(), 'non_plugin_file');
-
-describe('common platform handler', function() {
-    describe('resolveSrcPath', function() {
-        it('Test 001 : should not throw if path exists', function(){
+var common = require('../../../src/plugman/platforms/common');
+var path = require('path');
+var fs = require('fs');
+var osenv = require('os');
+var shell = require('shelljs');
+var test_dir = path.join(osenv.tmpdir(), 'test_plugman');
+var project_dir = path.join(test_dir, 'project');
+var src = path.join(project_dir, 'src');
+var dest = path.join(project_dir, 'dest');
+var java_dir = path.join(src, 'one', 'two', 'three');
+var java_file = path.join(java_dir, 'test.java');
+var symlink_file = path.join(java_dir, 'symlink');
+var symlink_dir = path.join(java_dir, 'symlink_dir');
+var symlink_dir_relative_file = path.join('one', 'two', 'file');
+var non_plugin_file = path.join(osenv.tmpdir(), 'non_plugin_file');
+
+describe('common platform handler', function () {
+    describe('resolveSrcPath', function () {
+        it('Test 001 : should not throw if path exists', function () {
             shell.mkdir('-p', test_dir);
             var target = path.join(test_dir, 'somefile');
             fs.writeFileSync(target, '80085', 'utf-8');
-            expect(function(){common.resolveSrcPath(test_dir, 'somefile');}).not.toThrow();
+            expect(function () { common.resolveSrcPath(test_dir, 'somefile'); }).not.toThrow();
             shell.rm('-rf', test_dir);
         });
     });
 
-    describe('resolveTargetPath', function() {
-        it('Test 002 : should throw if path exists', function(){
+    describe('resolveTargetPath', function () {
+        it('Test 002 : should throw if path exists', function () {
             shell.mkdir('-p', test_dir);
-            expect(function(){common.resolveTargetPath(test_dir);}).toThrow();
+            expect(function () { common.resolveTargetPath(test_dir); }).toThrow();
             shell.rm('-rf', test_dir);
         });
 
-        it('Test 003 : should not throw if path cannot be resolved', function(){
-            expect(function(){common.resolveTargetPath(test_dir, 'somefile');}).not.toThrow();
+        it('Test 003 : should not throw if path cannot be resolved', function () {
+            expect(function () { common.resolveTargetPath(test_dir, 'somefile'); }).not.toThrow();
         });
     });
 
-    describe('copyFile', function() {
-        it('Test 004 : should throw if source path not found', function(){
-            expect(function(){common.copyFile(test_dir, src, project_dir, dest);}).
-                toThrow(new Error('"' + src + '" not found!'));
+    describe('copyFile', function () {
+        it('Test 004 : should throw if source path not found', function () {
+            expect(function () { common.copyFile(test_dir, src, project_dir, dest); })
+                .toThrow(new Error('"' + src + '" not found!'));
         });
 
-        it('Test 005 : should throw if src not in plugin directory', function(){
+        it('Test 005 : should throw if src not in plugin directory', function () {
             shell.mkdir('-p', project_dir);
             fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
-            expect(function(){common.copyFile(test_dir, '../non_plugin_file', project_dir, dest);}).
-                toThrow(new Error('"' + non_plugin_file + '" not located within plugin!'));
+            expect(function () { common.copyFile(test_dir, '../non_plugin_file', project_dir, dest); })
+                .toThrow(new Error('"' + non_plugin_file + '" not located within plugin!'));
             shell.rm('-rf', test_dir);
         });
 
-        it('Test 006 : should allow symlink src, if inside plugin', function(){
+        it('Test 006 : should allow symlink src, if inside plugin', function () {
             shell.mkdir('-p', java_dir);
             fs.writeFileSync(java_file, 'contents', 'utf-8');
 
@@ -84,7 +82,7 @@ describe('common platform handler', function() {
             shell.rm('-rf', project_dir);
         });
 
-        it('Test 007 : should deeply symlink directory tree when src is a directory', function(){
+        it('Test 007 : should deeply symlink directory tree when src is a directory', function () {
             var symlink_dir_relative_subdir = path.dirname(symlink_dir_relative_file);
 
             shell.mkdir('-p', path.join(symlink_dir, symlink_dir_relative_subdir));
@@ -102,7 +100,7 @@ describe('common platform handler', function() {
             shell.rm('-rf', project_dir);
         });
 
-        it('Test 008 : should throw if symlink is linked to a file outside the plugin', function(){
+        it('Test 008 : should throw if symlink is linked to a file outside the plugin', function () {
             shell.mkdir('-p', java_dir);
             fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
 
@@ -111,20 +109,20 @@ describe('common platform handler', function() {
                 return;
             }
 
-            expect(function(){common.copyFile(test_dir, symlink_file, project_dir, dest);}).
-                toThrow(new Error('"' + symlink_file + '" not located within plugin!'));
+            expect(function () { common.copyFile(test_dir, symlink_file, project_dir, dest); })
+                .toThrow(new Error('"' + symlink_file + '" not located within plugin!'));
             shell.rm('-rf', project_dir);
         });
 
-        it('Test 009 : should throw if dest is outside the project directory', function(){
+        it('Test 009 : should throw if dest is outside the project directory', function () {
             shell.mkdir('-p', java_dir);
             fs.writeFileSync(java_file, 'contents', 'utf-8');
-            expect(function(){common.copyFile(test_dir, java_file, project_dir, non_plugin_file);}).
-                toThrow(new Error('"' + non_plugin_file + '" not located within project!'));
+            expect(function () { common.copyFile(test_dir, java_file, project_dir, non_plugin_file); })
+                .toThrow(new Error('"' + non_plugin_file + '" not located within project!'));
             shell.rm('-rf', project_dir);
         });
 
-        it('Test 010 : should call mkdir -p on target path', function(){
+        it('Test 010 : should call mkdir -p on target path', function () {
             shell.mkdir('-p', java_dir);
             fs.writeFileSync(java_file, 'contents', 'utf-8');
 
@@ -138,7 +136,7 @@ describe('common platform handler', function() {
             shell.rm('-rf', project_dir);
         });
 
-        it('Test 011 : should call cp source/dest paths', function(){
+        it('Test 011 : should call cp source/dest paths', function () {
             shell.mkdir('-p', java_dir);
             fs.writeFileSync(java_file, 'contents', 'utf-8');
 
@@ -156,17 +154,17 @@ describe('common platform handler', function() {
     });
 
     describe('copyNewFile', function () {
-        it('Test 012 : should throw if target path exists', function(){
+        it('Test 012 : should throw if target path exists', function () {
             shell.mkdir('-p', dest);
-            expect(function(){common.copyNewFile(test_dir, src, project_dir, dest);}).
-                toThrow(new Error('"' + dest + '" already exists!'));
+            expect(function () { common.copyNewFile(test_dir, src, project_dir, dest); })
+                .toThrow(new Error('"' + dest + '" already exists!'));
             shell.rm('-rf', dest);
         });
 
     });
 
-    describe('deleteJava', function() {
-        it('Test 013 : should call fs.unlinkSync on the provided paths', function(){
+    describe('deleteJava', function () {
+        it('Test 013 : should call fs.unlinkSync on the provided paths', function () {
             shell.mkdir('-p', java_dir);
             fs.writeFileSync(java_file, 'contents', 'utf-8');
 
@@ -178,19 +176,19 @@ describe('common platform handler', function() {
             shell.rm('-rf', java_dir);
         });
 
-        it('Test 014 : should delete empty directories after removing source code in a java src path hierarchy', function(){
+        it('Test 014 : should delete empty directories after removing source code in a java src path hierarchy', function () {
             shell.mkdir('-p', java_dir);
             fs.writeFileSync(java_file, 'contents', 'utf-8');
 
             common.deleteJava(project_dir, java_file);
             expect(fs.existsSync(java_file)).not.toBe(true);
             expect(fs.existsSync(java_dir)).not.toBe(true);
-            expect(fs.existsSync(path.join(src,'one'))).not.toBe(true);
+            expect(fs.existsSync(path.join(src, 'one'))).not.toBe(true);
 
             shell.rm('-rf', java_dir);
         });
 
-        it('Test 015 : should never delete the top-level src directory, even if all plugins added were removed', function(){
+        it('Test 015 : should never delete the top-level src directory, even if all plugins added were removed', function () {
             shell.mkdir('-p', java_dir);
             fs.writeFileSync(java_file, 'contents', 'utf-8');
 
@@ -202,7 +200,7 @@ describe('common platform handler', function() {
     });
 });
 
-function ignoreEPERMonWin32(symlink_src, symlink_dest) {
+function ignoreEPERMonWin32 (symlink_src, symlink_dest) {
     try {
         fs.symlinkSync(symlink_src, symlink_dest);
     } catch (e) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/platforms/tizen.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/platforms/tizen.spec.js b/spec/plugman/platforms/tizen.spec.js
index 37d7f40..1631943 100644
--- a/spec/plugman/platforms/tizen.spec.js
+++ b/spec/plugman/platforms/tizen.spec.js
@@ -16,36 +16,35 @@
  *
 */
 
+var tizen = require('../../../src/plugman/platforms/tizen');
+var os = require('os');
+var path = require('path');
+var tizen_project = path.join(__dirname, '..', 'projects', 'tizen');
 
-var tizen = require('../../../src/plugman/platforms/tizen'),
-    os = require('os'),
-    path = require('path'),
-    tizen_project = path.join(__dirname, '..', 'projects', 'tizen');
+path.join(os.tmpdir(), 'plugman-' + ((function () {
+    var index, subIndex;
+    var set = 'abcdefghijklmnopqrstuvwxyz0123456789';
+    var str = '';
 
-    path.join( os.tmpdir(), 'plugman-' + ((function() {
-        var index, subIndex,
-           set = 'abcdefghijklmnopqrstuvwxyz0123456789',
-           str = '';
+    for (index = 0; index < 12; index++) {
+        subIndex = Math.round(Math.random() * (set.length - 1));
+        str += set.substring(subIndex, subIndex + 1);
+    }
 
-        for ( index = 0 ; index < 12 ; index++ ) {
-            subIndex = Math.round( Math.random() * ( set.length - 1 ) );
-            str += set.substring( subIndex, subIndex + 1 );
-        }
+    return str;
+})()));
 
-        return str;
-    })() ));
-
-describe('Tizen project handler', function() {
-	describe('www_dir method', function() {
-		it('Test 001 : should append www to the directory passed in', function() {
-			expect(tizen.www_dir(path.sep)).toEqual(path.join(path.sep, 'www'));
-		});
-	});
-	describe('Manipulating project files', function() {
-		describe('package_name method', function() {
-			it('Test 002 : should return the id of the config.xml root element', function() {
-				expect(tizen.package_name(tizen_project)).toEqual('TizenTestPackage');
-			});
-		});
-	});
+describe('Tizen project handler', function () {
+    describe('www_dir method', function () {
+        it('Test 001 : should append www to the directory passed in', function () {
+            expect(tizen.www_dir(path.sep)).toEqual(path.join(path.sep, 'www'));
+        });
+    });
+    describe('Manipulating project files', function () {
+        describe('package_name method', function () {
+            it('Test 002 : should return the id of the config.xml root element', function () {
+                expect(tizen.package_name(tizen_project)).toEqual('TizenTestPackage');
+            });
+        });
+    });
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/projects/android/platform_www/cordova.js
----------------------------------------------------------------------
diff --git a/spec/plugman/projects/android/platform_www/cordova.js b/spec/plugman/projects/android/platform_www/cordova.js
index 6d2ea62..5f626af 100644
--- a/spec/plugman/projects/android/platform_www/cordova.js
+++ b/spec/plugman/projects/android/platform_www/cordova.js
@@ -22,9 +22,6 @@
 var PLATFORM_VERSION_BUILD_LABEL = '6.2.1';
 // file: src/scripts/require.js
 
-/*jshint -W079 */
-/*jshint -W020 */
-
 var require,
     define;
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/registry/registry.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/registry/registry.spec.js b/spec/plugman/registry/registry.spec.js
index c42ec0d..d02a19d 100644
--- a/spec/plugman/registry/registry.spec.js
+++ b/spec/plugman/registry/registry.spec.js
@@ -16,86 +16,86 @@
     specific language governing permissions and limitations
     under the License.
 */
-var registry = require('../../../src/plugman/registry/registry'),
-    manifest = require('../../../src/plugman/registry/manifest'),
-    fs = require('fs'),
-    path = require('path'),
-    shell   = require('shelljs'),
-    os = require('os'),
-    npm = require('npm');
+var registry = require('../../../src/plugman/registry/registry');
+var manifest = require('../../../src/plugman/registry/manifest');
+var fs = require('fs');
+var path = require('path');
+var shell = require('shelljs');
+var os = require('os');
+var npm = require('npm');
 
-describe('registry', function() {
-    var done;
-    beforeEach(function() {
+describe('registry', function () {
+    var done; // eslint-disable-line no-unused-vars
+    beforeEach(function () {
         done = false;
     });
 
-    function registryPromise(shouldSucceed, f) {
+    function registryPromise (shouldSucceed, f) {
         return f
-        .then(function() {
-          done = true;
-          expect(shouldSucceed).toBe(true);
-        }).fail(function(err){
-          done = err;
-          expect(shouldSucceed).toBe(false);
-        });
+            .then(function () {
+                done = true;
+                expect(shouldSucceed).toBe(true);
+            }).fail(function (err) {
+                done = err;
+                expect(shouldSucceed).toBe(false);
+            });
     }
 
-    describe('manifest', function() {
+    describe('manifest', function () {
         var pluginDir, tmp_plugin, tmp_plugin_xml, tmp_package_json;
-        beforeEach(function() {
-            pluginDir = __dirname + '/../plugins/com.cordova.engine';
+        beforeEach(function () {
+            pluginDir = path.join(__dirname, '/../plugins/com.cordova.engine');
             tmp_plugin = path.join(os.tmpdir(), 'plugin');
             tmp_plugin_xml = path.join(tmp_plugin, 'plugin.xml');
             tmp_package_json = path.join(tmp_plugin, 'package.json');
-            shell.cp('-R', pluginDir+'/*', tmp_plugin);
+            shell.cp('-R', pluginDir + '/*', tmp_plugin);
         });
-        afterEach(function() {
+        afterEach(function () {
             shell.rm('-rf', tmp_plugin);
         });
-        it('Test 001 : should generate a package.json from a plugin.xml', function(done) {
+        it('Test 001 : should generate a package.json from a plugin.xml', function (done) {
             return registryPromise(true, manifest.generatePackageJsonFromPluginXml(tmp_plugin))
-            .then(function() {
-                expect(fs.existsSync(tmp_package_json));
-                var packageJson = JSON.parse(fs.readFileSync(tmp_package_json));
-                expect(packageJson.name).toEqual('com.cordova.engine');
-                expect(packageJson.version).toEqual('1.0.0');
-                expect(packageJson.engines).toEqual(
-                    [ { name : 'cordova', version : '>=2.3.0' }, { name : 'cordova-plugman', version : '>=0.10.0' }, { name : 'mega-fun-plugin', version : '>=1.0.0' }, { name : 'mega-boring-plugin', version : '>=3.0.0' } ]);
-                done();
-            });
+                .then(function () {
+                    expect(fs.existsSync(tmp_package_json));
+                    var packageJson = JSON.parse(fs.readFileSync(tmp_package_json));
+                    expect(packageJson.name).toEqual('com.cordova.engine');
+                    expect(packageJson.version).toEqual('1.0.0');
+                    expect(packageJson.engines).toEqual(
+                        [ { name: 'cordova', version: '>=2.3.0' }, { name: 'cordova-plugman', version: '>=0.10.0' }, { name: 'mega-fun-plugin', version: '>=1.0.0' }, { name: 'mega-boring-plugin', version: '>=3.0.0' } ]);
+                    done();
+                });
         }, 6000);
-        it('Test 002 : should raise an error if name does not follow com.domain.* format', function(done) {
+        it('Test 002 : should raise an error if name does not follow com.domain.* format', function (done) {
             var xmlData = fs.readFileSync(tmp_plugin_xml).toString().replace('id="com.cordova.engine"', 'id="engine"');
             fs.writeFileSync(tmp_plugin_xml, xmlData);
             return registryPromise(false, manifest.generatePackageJsonFromPluginXml(tmp_plugin))
-            .then(function(){
-                done();
-            });
+                .then(function () {
+                    done();
+                });
         });
         // Expect the package.json to NOT exist
-        it('Test 003 : should generate a package.json if name uses org.apache.cordova.* for a whitelisted plugin', function(done) {
+        it('Test 003 : should generate a package.json if name uses org.apache.cordova.* for a whitelisted plugin', function (done) {
             var xmlData = fs.readFileSync(tmp_plugin_xml).toString().replace('id="com.cordova.engine"', 'id="org.apache.cordova.camera"');
             fs.writeFileSync(tmp_plugin_xml, xmlData);
             return registryPromise(true, manifest.generatePackageJsonFromPluginXml(tmp_plugin))
-            .then(function(result) {
-                expect(fs.existsSync(tmp_package_json)).toBe(true);
-                done();
-            });
+                .then(function (result) {
+                    expect(fs.existsSync(tmp_package_json)).toBe(true);
+                    done();
+                });
         }, 6000);
-        it('Test 004 : should raise an error if name uses org.apache.cordova.* for a non-whitelisted plugin', function(done) {
+        it('Test 004 : should raise an error if name uses org.apache.cordova.* for a non-whitelisted plugin', function (done) {
             var xmlData = fs.readFileSync(tmp_plugin_xml).toString().replace('id="com.cordova.engine"', 'id="org.apache.cordova.myinvalidplugin"');
             fs.writeFileSync(tmp_plugin_xml, xmlData);
             return registryPromise(false, manifest.generatePackageJsonFromPluginXml(tmp_plugin))
-            .then(function(){
-                done();
-            });
+                .then(function () {
+                    done();
+                });
         }, 6000);
     });
-    describe('actions', function() {
+    describe('actions', function () {
         var fakeLoad, fakeNPMCommands;
 
-        beforeEach(function() {
+        beforeEach(function () {
             done = false;
             var fakeSettings = {
                 cache: '/some/cache/dir',
@@ -103,9 +103,9 @@ describe('registry', function() {
                 userconfig: '/some/config/dir'
             };
 
-            var fakeNPM = function() {
+            var fakeNPM = function () {
                 if (arguments.length > 0) {
-                    var cb = arguments[arguments.length-1];
+                    var cb = arguments[arguments.length - 1];
                     if (cb && typeof cb === 'function') cb(null, true);
                 }
             };
@@ -114,27 +114,27 @@ describe('registry', function() {
             fakeLoad = spyOn(npm, 'load').and.callFake(function () { arguments[arguments.length - 1](null, true); });
 
             fakeNPMCommands = {};
-            ['config', 'adduser', 'cache', 'publish', 'unpublish', 'search'].forEach(function(cmd) {
+            ['config', 'adduser', 'cache', 'publish', 'unpublish', 'search'].forEach(function (cmd) {
                 fakeNPMCommands[cmd] = jasmine.createSpy(cmd).and.callFake(fakeNPM);
             });
 
             npm.commands = fakeNPMCommands;
-            npm.config.set = function(){};
-            npm.config.get = function(){};
-            npm.config.del = function(){};
+            npm.config.set = function () {};
+            npm.config.get = function () {};
+            npm.config.del = function () {};
         });
-        it('Test 005 : should run config', function(done) {
+        it('Test 005 : should run config', function (done) {
             var params = ['set', 'registry', 'http://registry.cordova.io'];
-            return registryPromise(true, registry.config(params).then(function() {
-                expect(fakeLoad).toHaveBeenCalledWith(jasmine.any(Object),jasmine.any(Function));
+            return registryPromise(true, registry.config(params).then(function () {
+                expect(fakeLoad).toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Function));
                 expect(fakeNPMCommands.config).toHaveBeenCalledWith(params, jasmine.any(Function));
                 done();
             }));
         }, 6000);
-        it('Test 006 : should run search', function(done) {
+        it('Test 006 : should run search', function (done) {
             var params = ['dummyplugin', 'plugin'];
-            return registryPromise(true, registry.search(params).then(function() {
-                expect(fakeLoad).toHaveBeenCalledWith(jasmine.any(Object),jasmine.any(Function));
+            return registryPromise(true, registry.search(params).then(function () {
+                expect(fakeLoad).toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Function));
                 expect(fakeNPMCommands.search).toHaveBeenCalledWith(params, true, jasmine.any(Function));
                 done();
             }));

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/search.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/search.spec.js b/spec/plugman/search.spec.js
index 6158546..2ce2431 100644
--- a/spec/plugman/search.spec.js
+++ b/spec/plugman/search.spec.js
@@ -16,14 +16,14 @@
     specific language governing permissions and limitations
     under the License.
 */
-var search = require('../../src/plugman/search'),
-    Q = require('q'),
-    registry = require('../../src/plugman/registry/registry');
+var search = require('../../src/plugman/search');
+var Q = require('q');
+var registry = require('../../src/plugman/registry/registry');
 
-describe('search', function() {
-    it('Test 001 : should search a plugin', function() {
+describe('search', function () {
+    it('Test 001 : should search a plugin', function () {
         var sSearch = spyOn(registry, 'search').and.returnValue(Q());
-        search(new Array('myplugin', 'keyword'));
+        search(new Array('myplugin', 'keyword')); // eslint-disable-line no-array-constructor
         expect(sSearch).toHaveBeenCalledWith(['myplugin', 'keyword']);
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/util/csproj.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/util/csproj.spec.js b/spec/plugman/util/csproj.spec.js
index 72e8549..973bb98 100644
--- a/spec/plugman/util/csproj.spec.js
+++ b/spec/plugman/util/csproj.spec.js
@@ -16,80 +16,80 @@
     specific language governing permissions and limitations
     under the License.
 */
-var csproj  = require('../../../src/util/windows/csproj'),
-    path    = require('path');
+var csproj = require('../../../src/util/windows/csproj');
+var path = require('path');
 
-var wp8_project     = path.join(__dirname, '..', 'projects', 'wp8'),
-    example_csproj  = path.join(wp8_project, 'CordovaAppProj.csproj');
+var wp8_project = path.join(__dirname, '..', 'projects', 'wp8');
+var example_csproj = path.join(wp8_project, 'CordovaAppProj.csproj');
 
-describe('csproj', function() {
-    it('Test 001 : should throw if passed in an invalid xml file path ref', function() {
-        expect(function() {
-            new csproj('blahblah');
+describe('csproj', function () {
+    it('Test 001 : should throw if passed in an invalid xml file path ref', function () {
+        expect(function () {
+            new csproj('blahblah'); // eslint-disable-line
         }).toThrow();
     });
-    it('Test 002 : should successfully parse a valid csproj file into an xml document', function() {
+    it('Test 002 : should successfully parse a valid csproj file into an xml document', function () {
         var doc;
-        expect(function() {
-            doc = new csproj(example_csproj);
+        expect(function () {
+            doc = new csproj(example_csproj); // eslint-disable-line new-cap
         }).not.toThrow();
         expect(doc.xml.getroot()).toBeDefined();
     });
 
-    describe('write method', function() {
+    describe('write method', function () {
 
     });
 
-    describe('source file', function() {
+    describe('source file', function () {
 
-        var page_test   = path.join('src', 'UI', 'PageTest.xaml');
+        var page_test = path.join('src', 'UI', 'PageTest.xaml');
         var page_test_cs = path.join('src', 'UI', 'PageTest.xaml.cs');
-        var lib_test    = path.join('lib', 'LibraryTest.dll');
-        var file_test   = path.join('src', 'FileTest.cs');
-        var content_test   = path.join('src', 'Content.img');
+        var lib_test = path.join('lib', 'LibraryTest.dll');
+        var file_test = path.join('src', 'FileTest.cs');
+        var content_test = path.join('src', 'Content.img');
 
-        describe('add method', function() {
-            var test_csproj = new csproj(example_csproj);
-            it('Test 003 : should properly add .xaml files', function() {
+        describe('add method', function () {
+            var test_csproj = new csproj(example_csproj); // eslint-disable-line new-cap
+            it('Test 003 : should properly add .xaml files', function () {
                 test_csproj.addSourceFile(page_test);
                 expect(test_csproj.xml.getroot().find('.//Page[@Include="src\\UI\\PageTest.xaml"]')).toBeTruthy();
                 expect(test_csproj.xml.getroot().find('.//Page[@Include="src\\UI\\PageTest.xaml"]/Generator').text).toEqual('MSBuild:Compile');
                 expect(test_csproj.xml.getroot().find('.//Page[@Include="src\\UI\\PageTest.xaml"]/SubType').text).toEqual('Designer');
             });
-            it('Test 004 : should properly add .xaml.cs files', function() {
+            it('Test 004 : should properly add .xaml.cs files', function () {
                 test_csproj.addSourceFile(page_test_cs);
                 expect(test_csproj.xml.getroot().find('.//Compile[@Include="src\\UI\\PageTest.xaml.cs"]')).toBeTruthy();
                 expect(test_csproj.xml.getroot().find('.//Compile[@Include="src\\UI\\PageTest.xaml.cs"]/DependentUpon').text).toEqual('PageTest.xaml');
             });
-            it('Test 005 : should properly add .cs files', function() {
+            it('Test 005 : should properly add .cs files', function () {
                 test_csproj.addSourceFile(file_test);
                 expect(test_csproj.xml.getroot().find('.//Compile[@Include="src\\FileTest.cs"]')).toBeTruthy();
             });
-            it('Test 006 : should properly add content files', function() {
+            it('Test 006 : should properly add content files', function () {
                 test_csproj.addSourceFile(content_test);
                 expect(test_csproj.xml.getroot().find('.//Content[@Include="src\\Content.img"]')).toBeTruthy();
             });
         });
 
-        describe('remove method', function() {
-            var test_csproj = new csproj(example_csproj);
-            it('Test 007 : should properly remove .xaml pages', function() {
+        describe('remove method', function () {
+            var test_csproj = new csproj(example_csproj); // eslint-disable-line new-cap
+            it('Test 007 : should properly remove .xaml pages', function () {
                 test_csproj.removeSourceFile(page_test);
                 expect(test_csproj.xml.getroot().find('.//Page[@Include="src\\UI\\PageTest.xaml"]')).toBeFalsy();
             });
-            it('Test 008 : should properly remove .xaml.cs files', function() {
+            it('Test 008 : should properly remove .xaml.cs files', function () {
                 test_csproj.removeSourceFile(page_test_cs);
                 expect(test_csproj.xml.getroot().find('.//Compile[@Include="src\\UI\\PageTest.xaml.cs"]')).toBeFalsy();
             });
-            it('Test 009 : should properly remove .cs files', function() {
+            it('Test 009 : should properly remove .cs files', function () {
                 test_csproj.removeSourceFile(file_test);
                 expect(test_csproj.xml.getroot().find('.//Compile[@Include="src\\FileTest.cs"]')).toBeFalsy();
             });
-            it('Test 010 : should properly remove content files', function() {
+            it('Test 010 : should properly remove content files', function () {
                 test_csproj.removeSourceFile(content_test);
                 expect(test_csproj.xml.getroot().find('.//Content[@Include="src\\Content.img"]')).toBeFalsy();
             });
-            it('Test 011 : should remove all empty ItemGroup\'s', function() {
+            it('Test 011 : should remove all empty ItemGroup\'s', function () {
                 test_csproj.removeSourceFile(page_test);
                 test_csproj.removeSourceFile(page_test_cs);
                 test_csproj.removeSourceFile(lib_test);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/plugman/util/dependencies.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugman/util/dependencies.spec.js b/spec/plugman/util/dependencies.spec.js
index bde1263..1538554 100644
--- a/spec/plugman/util/dependencies.spec.js
+++ b/spec/plugman/util/dependencies.spec.js
@@ -16,44 +16,44 @@
     specific language governing permissions and limitations
     under the License.
 */
-var dependencies = require('../../../src/plugman/util/dependencies'),
-    xml_helpers = require('cordova-common').xmlHelpers,
-    path = require('path');
+var dependencies = require('../../../src/plugman/util/dependencies');
+var xml_helpers = require('cordova-common').xmlHelpers;
+var path = require('path');
 var PlatformJson = require('cordova-common').PlatformJson;
 var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
 
-describe('dependency module', function() {
-    describe('generateDependencyInfo method', function() {
-        it('Test 001 : should return a list of top-level plugins based on what is inside a platform.json file', function() {
+describe('dependency module', function () {
+    describe('generateDependencyInfo method', function () {
+        it('Test 001 : should return a list of top-level plugins based on what is inside a platform.json file', function () {
             var tlps = {
-                'hello':'',
-                'isitme':'',
-                'yourelookingfor':''
+                'hello': '',
+                'isitme': '',
+                'yourelookingfor': ''
             };
             var platformJson = new PlatformJson('filePath', 'platform', {
-                installed_plugins:tlps,
-                dependent_plugins:[]
+                installed_plugins: tlps,
+                dependent_plugins: []
             });
             var pluginInfoProvider = new PluginInfoProvider();
-            Object.keys(tlps).forEach(function(k) {
-                pluginInfoProvider.put({id:k, dir: path.join('plugins_dir', k), getDependencies: function() {return[];}});
+            Object.keys(tlps).forEach(function (k) {
+                pluginInfoProvider.put({id: k, dir: path.join('plugins_dir', k), getDependencies: function () { return []; }});
             });
-            spyOn(xml_helpers, 'parseElementtreeSync').and.returnValue({findall:function(){}});
+            spyOn(xml_helpers, 'parseElementtreeSync').and.returnValue({findall: function () {}});
             var obj = dependencies.generateDependencyInfo(platformJson, 'plugins_dir', pluginInfoProvider);
             expect(obj.top_level_plugins).toEqual(Object.keys(tlps));
         });
-        it('Test 002 : should return a dependency graph for the plugins', function() {
+        it('Test 002 : should return a dependency graph for the plugins', function () {
             var tlps = {
-                'A':'',
-                'B':''
+                'A': '',
+                'B': ''
             };
             var plugins_dir = path.join(__dirname, '..', 'plugins', 'dependencies');
             var platformJson = new PlatformJson(plugins_dir, 'android', {
-                installed_plugins:tlps,
-                dependent_plugins:[]
+                installed_plugins: tlps,
+                dependent_plugins: []
             });
             var obj = dependencies.generateDependencyInfo(platformJson, plugins_dir, new PluginInfoProvider());
-            expect(obj.graph.getChain('A')).toEqual(['C','D']);
+            expect(obj.graph.getChain('A')).toEqual(['C', 'D']);
             expect(obj.graph.getChain('B')).toEqual(['D', 'E']);
         });
     });


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


[16/18] cordova-lib git commit: CB-12895 : updated integration tests with eslint format and rebased

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/integration-tests/pkgJson.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/pkgJson.spec.js b/integration-tests/pkgJson.spec.js
index 0781091..e756b97 100644
--- a/integration-tests/pkgJson.spec.js
+++ b/integration-tests/pkgJson.spec.js
@@ -16,15 +16,15 @@
     specific language governing permissions and limitations
     under the License.
 */
-var helpers = require('../spec/helpers'),
-    path = require('path'),
-    shell = require('shelljs'),
-    events = require('cordova-common').events,
-    ConfigParser = require('cordova-common').ConfigParser,
-    cordova = require('../src/cordova/cordova'),
-    TIMEOUT = 30 * 1000,
-    cordova_util = require('../src/cordova/util'),
-    semver = require('semver');
+var helpers = require('../spec/helpers');
+var path = require('path');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var ConfigParser = require('cordova-common').ConfigParser;
+var cordova = require('../src/cordova/cordova');
+var TIMEOUT = 30 * 1000;
+var cordova_util = require('../src/cordova/util');
+var semver = require('semver');
 
 function includeFunc (container, value) {
     var returnValue = false;
@@ -39,7 +39,7 @@ describe('plugin end-to-end', function () {
     var pluginId = 'cordova-plugin-device';
     var tmpDir = helpers.tmpDir('plugin_test_pkgjson');
     var project = path.join(tmpDir, 'project');
-    var results;
+    var results; // eslint-disable-line no-unused-vars
     var testRunRoot = process.cwd();
 
     events.on('results', function (res) { results = res; });
@@ -58,7 +58,7 @@ describe('plugin end-to-end', function () {
     });
 
     afterEach(function () {
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', project);
     });
 
@@ -78,33 +78,33 @@ describe('plugin end-to-end', function () {
 
         // Add the plugin with --save.
         return cordova.plugin('add', pluginId + '@1.1.2', {'save': true, 'fetch': true})
-        .then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Check that the plugin and spec add was successful to pkg.json.
-            expect(pkgJson).toBeDefined();
-            expect(pkgJson.cordova.plugins).toBeDefined();
-            expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
-            expect(pkgJson.dependencies['cordova-plugin-device']).toEqual('^1.1.2');
-            // Check that the plugin and spec add was successful to config.xml.
-            var cfg2 = new ConfigParser(configXmlPath);
-            configPlugins = cfg2.getPluginIdList();
-            configPlugin = cfg2.getPlugin(configPlugins);
-            expect(configPlugins.length).toEqual(1);
-            expect(configPlugin).toEqual({ name: 'cordova-plugin-device', spec: '^1.1.2', variables: {} });
-        }).then(function () {
-            // And now remove it with --save.
-            return cordova.plugin('rm', pluginId, {'save': true, 'fetch': true});
-        }).then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Checking that the plugin removed is in not in the pkg.json.
-            expect(pkgJson.cordova.plugins[pluginId]).toBeUndefined();
-            // Spec should be removed from dependencies.
-            expect(pkgJson.dependencies['cordova-plugin-device']).toBeUndefined();
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Check that the plugin and spec add was successful to pkg.json.
+                expect(pkgJson).toBeDefined();
+                expect(pkgJson.cordova.plugins).toBeDefined();
+                expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
+                expect(pkgJson.dependencies['cordova-plugin-device']).toEqual('^1.1.2');
+                // Check that the plugin and spec add was successful to config.xml.
+                var cfg2 = new ConfigParser(configXmlPath);
+                configPlugins = cfg2.getPluginIdList();
+                configPlugin = cfg2.getPlugin(configPlugins);
+                expect(configPlugins.length).toEqual(1);
+                expect(configPlugin).toEqual({ name: 'cordova-plugin-device', spec: '^1.1.2', variables: {} });
+            }).then(function () {
+                // And now remove it with --save.
+                return cordova.plugin('rm', pluginId, {'save': true, 'fetch': true});
+            }).then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Checking that the plugin removed is in not in the pkg.json.
+                expect(pkgJson.cordova.plugins[pluginId]).toBeUndefined();
+                // Spec should be removed from dependencies.
+                expect(pkgJson.dependencies['cordova-plugin-device']).toBeUndefined();
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     }, TIMEOUT);
 
     it('Test#002 : should NOT add a plugin to package.json if --save is not used', function (done) {
@@ -114,20 +114,20 @@ describe('plugin end-to-end', function () {
 
         // Add the geolocation plugin with --save.
         return cordova.plugin('add', 'cordova-plugin-geolocation', {'save': true, 'fetch': true})
-        .then(function () {
-            // Add a second plugin without save.
-            return cordova.plugin('add', pluginId);
-        }).then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Check the plugin add was successful for the first plugin that had --save.
-            expect(pkgJson).not.toBeUndefined();
-            expect(pkgJson.cordova.plugins['cordova-plugin-geolocation']).toBeDefined();
-            // Expect that the second plugin is not added.
-            expect(pkgJson.cordova.plugins[pluginId]).toBeUndefined();
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                // Add a second plugin without save.
+                return cordova.plugin('add', pluginId);
+            }).then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Check the plugin add was successful for the first plugin that had --save.
+                expect(pkgJson).not.toBeUndefined();
+                expect(pkgJson.cordova.plugins['cordova-plugin-geolocation']).toBeDefined();
+                // Expect that the second plugin is not added.
+                expect(pkgJson.cordova.plugins[pluginId]).toBeUndefined();
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     }, TIMEOUT);
 
     it('Test#003 : should NOT remove plugin from package.json if there is no --save', function (done) {
@@ -138,24 +138,24 @@ describe('plugin end-to-end', function () {
 
         // Add the plugin with --save.
         return cordova.plugin('add', pluginId, {'save': true})
-        .then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Check the platform add was successful.
-            expect(pkgJson).not.toBeUndefined();
-            expect(pkgJson.cordova.plugins).toBeDefined();
-            expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
-        }).then(function () {
-            // And now remove it, but without --save.
-            return cordova.plugin('rm', 'cordova-plugin-device');
-        }).then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // The plugin should still be in package.json.
-            expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Check the platform add was successful.
+                expect(pkgJson).not.toBeUndefined();
+                expect(pkgJson.cordova.plugins).toBeDefined();
+                expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
+            }).then(function () {
+                // And now remove it, but without --save.
+                return cordova.plugin('rm', 'cordova-plugin-device');
+            }).then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // The plugin should still be in package.json.
+                expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     }, TIMEOUT);
 
     it('Test#004 : should successfully add and remove a plugin with variables and save to package.json', function (done) {
@@ -167,25 +167,25 @@ describe('plugin end-to-end', function () {
 
         // Add the plugin with --save.
         return cordova.plugin('add', pluginId, {'save': true, 'cli_variables': {'someKey': 'someValue'}})
-        .then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Check the plugin add was successful and that variables have been added too.
-            expect(pkgJson).not.toBeUndefined();
-            expect(pkgJson.cordova.plugins).toBeDefined();
-            expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
-            expect(pkgJson.cordova.plugins[pluginId][someKey]).toEqual('someValue');
-        }).then(function () {
-            // And now remove it with --save.
-            return cordova.plugin('rm', pluginId, {'save': true});
-        }).then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Checking that the plugin and variables were removed successfully.
-            expect(pkgJson.cordova.plugins[pluginId]).toBeUndefined();
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Check the plugin add was successful and that variables have been added too.
+                expect(pkgJson).not.toBeUndefined();
+                expect(pkgJson.cordova.plugins).toBeDefined();
+                expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
+                expect(pkgJson.cordova.plugins[pluginId][someKey]).toEqual('someValue');
+            }).then(function () {
+                // And now remove it with --save.
+                return cordova.plugin('rm', pluginId, {'save': true});
+            }).then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Checking that the plugin and variables were removed successfully.
+                expect(pkgJson.cordova.plugins[pluginId]).toBeUndefined();
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     }, TIMEOUT);
 
     // CB-12170 : Test is commented out because not promisified correctly in cordova-create script
@@ -198,30 +198,30 @@ describe('plugin end-to-end', function () {
 
         // Add the plugin with --save.
         return cordova.plugin('add', [pluginId, 'cordova-plugin-device-motion'], {'save': true, 'fetch': true})
-        .then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Check that the plugin add was successful.
-            expect(pkgJson).not.toBeUndefined();
-            expect(pkgJson.cordova.plugins).not.toBeUndefined();
-            expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
-            expect(pkgJson.cordova.plugins['cordova-plugin-device-motion']).toBeDefined();
-            expect(pkgJson.dependencies[pluginId]).toBeDefined();
-            expect(pkgJson.dependencies['cordova-plugin-device-motion']).toBeDefined();
-        }).then(function () {
-            // And now remove it with --save.
-            return cordova.plugin('rm', [pluginId, 'cordova-plugin-device-motion'], {'save': true, 'fetch': true});
-        }).then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Checking that the plugin removed is in not in the platforms.
-            expect(pkgJson.cordova.plugins[pluginId]).toBeUndefined();
-            expect(pkgJson.cordova.plugins['cordova-plugin-device-motion']).toBeUndefined();
-            expect(pkgJson.dependencies[pluginId]).toBeUndefined();
-            expect(pkgJson.dependencies['cordova-plugin-device-motion']).toBeUndefined();
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Check that the plugin add was successful.
+                expect(pkgJson).not.toBeUndefined();
+                expect(pkgJson.cordova.plugins).not.toBeUndefined();
+                expect(pkgJson.cordova.plugins[pluginId]).toBeDefined();
+                expect(pkgJson.cordova.plugins['cordova-plugin-device-motion']).toBeDefined();
+                expect(pkgJson.dependencies[pluginId]).toBeDefined();
+                expect(pkgJson.dependencies['cordova-plugin-device-motion']).toBeDefined();
+            }).then(function () {
+                // And now remove it with --save.
+                return cordova.plugin('rm', [pluginId, 'cordova-plugin-device-motion'], {'save': true, 'fetch': true});
+            }).then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Checking that the plugin removed is in not in the platforms.
+                expect(pkgJson.cordova.plugins[pluginId]).toBeUndefined();
+                expect(pkgJson.cordova.plugins['cordova-plugin-device-motion']).toBeUndefined();
+                expect(pkgJson.dependencies[pluginId]).toBeUndefined();
+                expect(pkgJson.dependencies['cordova-plugin-device-motion']).toBeUndefined();
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     }, TIMEOUT);
     // Test #023 : if pkg.json and config.xml have no platforms/plugins/spec.
     // and --save --fetch is called, use the pinned version or plugin pkg.json version.
@@ -236,8 +236,8 @@ describe('plugin end-to-end', function () {
         var pkgJson = cordova_util.requireNoCache(pkgJsonPath);
         var cfg = new ConfigParser(configXmlPath);
         var engines = cfg.getEngines();
-        var engNames;
-        var engSpec;
+        var engNames; // eslint-disable-line no-unused-vars
+        var engSpec; // eslint-disable-line no-unused-vars
         var configPlugins = cfg.getPluginIdList();
         var configPlugin = cfg.getPlugin(configPlugins);
         var pluginPkgJsonDir = path.join(cwd, 'plugins/cordova-plugin-geolocation/package.json');
@@ -250,48 +250,48 @@ describe('plugin end-to-end', function () {
         expect(engines.length).toEqual(0);
         // Add ios without version.
         return cordova.platform('add', ['ios'], {'save': true, 'fetch': true})
-        .then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Pkg.json has ios.
-            expect(pkgJson.cordova.platforms).toEqual([iosPlatform]);
-            // Config.xml and ios/cordova/version check.
-            var cfg2 = new ConfigParser(configXmlPath);
-            engines = cfg2.getEngines();
-            // ios platform has been added to config.xml.
-            expect(engines.length).toEqual(1);
-            // Config.xml has ios platform.
-            engNames = engines.map(function (elem) {
-                return elem.name;
-            });
-            expect(engNames).toEqual([ 'ios' ]);
-            // delete previous caches of iosVersion;
-            iosVersion = cordova_util.requireNoCache(iosDirectory);
-            engSpec = engines.map(function (elem) {
-                // Check that config and ios/cordova/version versions "satify" each other.
-                expect(semver.satisfies(iosVersion.version, elem.spec)).toEqual(true);
-            });
-        }).then(function () {
-            // Add geolocation plugin with --save --fetch.
-            return cordova.plugin('add', 'cordova-plugin-geolocation', {'save': true, 'fetch': true});
-        }).then(function () {
-            var iosJson = cordova_util.requireNoCache(iosJsonPath);
-            expect(iosJson.installed_plugins['cordova-plugin-geolocation']).toBeDefined();
-            var cfg3 = new ConfigParser(configXmlPath);
-            // Check config.xml for plugins and spec.
-            configPlugins = cfg3.getPluginIdList();
-            configPlugin = cfg3.getPlugin(configPlugins);
-            // Delete previous caches of pluginPkgJson.
-            pluginPkgJsonVersion = cordova_util.requireNoCache(pluginPkgJsonDir);
-            // Check that version in plugin pkg.json and config version "satisfy" each other.
-            expect(semver.satisfies(pluginPkgJsonVersion.version, configPlugin.spec)).toEqual(true);
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Check that pkg.json and plugin pkg.json versions "satisfy".
-            expect(semver.satisfies(pluginPkgJsonVersion.version, pkgJson.dependencies['cordova-ios']));
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Pkg.json has ios.
+                expect(pkgJson.cordova.platforms).toEqual([iosPlatform]);
+                // Config.xml and ios/cordova/version check.
+                var cfg2 = new ConfigParser(configXmlPath);
+                engines = cfg2.getEngines();
+                // ios platform has been added to config.xml.
+                expect(engines.length).toEqual(1);
+                // Config.xml has ios platform.
+                engNames = engines.map(function (elem) {
+                    return elem.name;
+                });
+                expect(engNames).toEqual([ 'ios' ]);
+                // delete previous caches of iosVersion;
+                iosVersion = cordova_util.requireNoCache(iosDirectory);
+                engSpec = engines.map(function (elem) {
+                    // Check that config and ios/cordova/version versions "satify" each other.
+                    expect(semver.satisfies(iosVersion.version, elem.spec)).toEqual(true);
+                });
+            }).then(function () {
+                // Add geolocation plugin with --save --fetch.
+                return cordova.plugin('add', 'cordova-plugin-geolocation', {'save': true, 'fetch': true});
+            }).then(function () {
+                var iosJson = cordova_util.requireNoCache(iosJsonPath);
+                expect(iosJson.installed_plugins['cordova-plugin-geolocation']).toBeDefined();
+                var cfg3 = new ConfigParser(configXmlPath);
+                // Check config.xml for plugins and spec.
+                configPlugins = cfg3.getPluginIdList();
+                configPlugin = cfg3.getPlugin(configPlugins);
+                // Delete previous caches of pluginPkgJson.
+                pluginPkgJsonVersion = cordova_util.requireNoCache(pluginPkgJsonDir);
+                // Check that version in plugin pkg.json and config version "satisfy" each other.
+                expect(semver.satisfies(pluginPkgJsonVersion.version, configPlugin.spec)).toEqual(true);
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Check that pkg.json and plugin pkg.json versions "satisfy".
+                expect(semver.satisfies(pluginPkgJsonVersion.version, pkgJson.dependencies['cordova-ios']));
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     // Cordova prepare needs extra wait time to complete.
     }, 60000);
 
@@ -306,60 +306,60 @@ describe('plugin end-to-end', function () {
         var configXmlPath = path.join(cwd, 'config.xml');
         var cfg = new ConfigParser(configXmlPath);
         var engines = cfg.getEngines();
-        var engNames;
-        var engSpec;
+        var engNames; // eslint-disable-line no-unused-vars
+        var engSpec; // eslint-disable-line no-unused-vars
 
         cordova_util.requireNoCache(pkgJsonPath);
         // Run cordova platform add local path --save --fetch.
         return cordova.platform('add', platformPath, {'save': true, 'fetch': true})
-        .then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Pkg.json has browser.
-            expect(pkgJson.cordova.platforms).toEqual(['browser']);
-
-            // Check that the value here exists
-            expect(pkgJson.dependencies['cordova-browser']).toBeDefined();
-
-            var cfg2 = new ConfigParser(configXmlPath);
-            engines = cfg2.getEngines();
-            // browser platform and spec have been added to config.xml.
-            engNames = engines.map(function (elem) {
-                return elem.name;
-            });
-            engSpec = engines.map(function (elem) {
-                if (elem.name === 'browser') {
-                    var result = includeFunc(elem.spec, platformPath);
-                    expect(result).toEqual(true);
-                }
-            });
-        }).then(function () {
-            // Run cordova plugin add local path --save --fetch.
-            return cordova.plugin('add', pluginPath, {'save': true, 'fetch': true});
-        }).then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Pkg.json has geolocation plugin.
-            expect(pkgJson.cordova.plugins['cordova-lib-test-plugin']).toBeDefined();
-
-            // Check that the value here EXISTS
-            expect(pkgJson.dependencies['cordova-lib-test-plugin']).toBeDefined();
-
-            var cfg3 = new ConfigParser(configXmlPath);
-            engines = cfg3.getEngines();
-            // Check that browser and spec have been added to config.xml
-            engNames = engines.map(function (elem) {
-                return elem.name;
-            });
-            engSpec = engines.map(function (elem) {
-                if (elem.name === 'browser') {
-                    var result = includeFunc(elem.spec, platformPath);
-                    expect(result).toEqual(true);
-                }
-            });
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Pkg.json has browser.
+                expect(pkgJson.cordova.platforms).toEqual(['browser']);
+
+                // Check that the value here exists
+                expect(pkgJson.dependencies['cordova-browser']).toBeDefined();
+
+                var cfg2 = new ConfigParser(configXmlPath);
+                engines = cfg2.getEngines();
+                // browser platform and spec have been added to config.xml.
+                engNames = engines.map(function (elem) {
+                    return elem.name;
+                });
+                engSpec = engines.map(function (elem) {
+                    if (elem.name === 'browser') {
+                        var result = includeFunc(elem.spec, platformPath);
+                        expect(result).toEqual(true);
+                    }
+                });
+            }).then(function () {
+                // Run cordova plugin add local path --save --fetch.
+                return cordova.plugin('add', pluginPath, {'save': true, 'fetch': true});
+            }).then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Pkg.json has geolocation plugin.
+                expect(pkgJson.cordova.plugins['cordova-lib-test-plugin']).toBeDefined();
+
+                // Check that the value here EXISTS
+                expect(pkgJson.dependencies['cordova-lib-test-plugin']).toBeDefined();
+
+                var cfg3 = new ConfigParser(configXmlPath);
+                engines = cfg3.getEngines();
+                // Check that browser and spec have been added to config.xml
+                engNames = engines.map(function (elem) {
+                    return elem.name;
+                });
+                engSpec = engines.map(function (elem) {
+                    if (elem.name === 'browser') {
+                        var result = includeFunc(elem.spec, platformPath);
+                        expect(result).toEqual(true);
+                    }
+                });
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     }, 60000);
 });
 
@@ -383,7 +383,7 @@ describe('platform end-to-end with --save', function () {
     afterEach(function () {
         // Delete any previous caches of require(package.json).
         cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
@@ -418,17 +418,17 @@ describe('platform end-to-end with --save', function () {
             expect(pkgJson.cordova.platforms).not.toBeUndefined();
             expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(0);
         }).then(fullPlatformList) // Platform should still be in platform ls.
-        .then(function () {
-            // And now remove it with --save.
-            return cordova.platform('rm', [helpers.testPlatform], {'save': true});
-        }).then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Checking that the platform removed is in not in the platforms key.
-            expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(-1);
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                // And now remove it with --save.
+                return cordova.platform('rm', [helpers.testPlatform], {'save': true});
+            }).then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Checking that the platform removed is in not in the platforms key.
+                expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(-1);
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     }, TIMEOUT);
 
     it('Test#007 : should not remove platforms from package.json when removing without --save', function (done) {
@@ -445,18 +445,18 @@ describe('platform end-to-end with --save', function () {
             expect(pkgJson.cordova.platforms).not.toBeUndefined();
             expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
         }).then(fullPlatformList) // Platform should still be in platform ls.
-        .then(function () {
-            // And now remove it without --save.
-            return cordova.platform('rm', [helpers.testPlatform]);
-        }).then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Check that the platform removed without --save is still in platforms key.
-            expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
-        }).then(emptyPlatformList)
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                // And now remove it without --save.
+                return cordova.platform('rm', [helpers.testPlatform]);
+            }).then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Check that the platform removed without --save is still in platforms key.
+                expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
+            }).then(emptyPlatformList)
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     }, TIMEOUT);
 
     it('Test#008 : should not add platform to package.json when adding without --save', function (done) {
@@ -468,16 +468,16 @@ describe('platform end-to-end with --save', function () {
         expect(pkgJson.cordova).toBeUndefined();
         // Add platform without --save.
         cordova.platform('add', [helpers.testPlatform])
-        .then(function () {
-            // Check the platform add was successful, reload, skipping cache.
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // PkgJson.cordova should not be defined and helpers.testPlatform should NOT have been added.
-            expect(pkgJson.cordova).toBeUndefined();
-        }).then(fullPlatformList)
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                // Check the platform add was successful, reload, skipping cache.
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // PkgJson.cordova should not be defined and helpers.testPlatform should NOT have been added.
+                expect(pkgJson.cordova).toBeUndefined();
+            }).then(fullPlatformList)
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, TIMEOUT);
 
     it('Test#009 : should only add the platform to package.json with --save', function (done) {
@@ -488,22 +488,22 @@ describe('platform end-to-end with --save', function () {
 
         // Add a platform without --save.
         cordova.platform('add', platformNotToAdd)
-        .then(function () {
-            // And now add another platform with --save.
-            return cordova.platform('add', [helpers.testPlatform], {'save': true});
-        }).then(function () {
-            // Check the platform add was successful, reload, skipping cache.
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Beware empty/missing cordova object.
-            var pkgJsonCordova = pkgJson.cordova || {platforms: []};
-            // Check that only the platform added with --save was added to package.json.
-            expect(pkgJsonCordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
-            expect(pkgJsonCordova.platforms.indexOf(platformNotToAdd)).toEqual(-1);
-        })
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                // And now add another platform with --save.
+                return cordova.platform('add', [helpers.testPlatform], {'save': true});
+            }).then(function () {
+                // Check the platform add was successful, reload, skipping cache.
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Beware empty/missing cordova object.
+                var pkgJsonCordova = pkgJson.cordova || {platforms: []};
+                // Check that only the platform added with --save was added to package.json.
+                expect(pkgJsonCordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
+                expect(pkgJsonCordova.platforms.indexOf(platformNotToAdd)).toEqual(-1);
+            })
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, TIMEOUT);
 
     it('Test#010 : two platforms are added and removed correctly with --save --fetch', function (done) {
@@ -552,31 +552,31 @@ describe('platform end-to-end with --save', function () {
             expect(engines).toEqual([ { name: 'android', spec: '~6.1.0' }, { name: 'browser', spec: '~4.1.0' } ]);
 
         }).then(fullPlatformList) // Platform should still be in platform ls.
-        .then(function () {
-            // And now remove it with --save.
-            return cordova.platform('rm', ['android', 'browser'], {'save': true, 'fetch': true});
-        }).then(function () {
-            // Delete any previous caches of require(package.json).
-            pkgJson = cordova_util.requireNoCache(pkgJsonPath);
-            // Checking that the platform removed is in not in the platforms key.
-            expect(pkgJson.cordova.platforms.indexOf('android')).toEqual(-1);
-            expect(pkgJson.cordova.platforms.indexOf('browser')).toEqual(-1);
-            // Dependencies are removed.
-            expect(pkgJson.dependencies['cordova-android']).toBeUndefined();
-            expect(pkgJson.dependencies['cordova-browser']).toBeUndefined();
-            // Platforms are removed from config.xml.
-            var cfg4 = new ConfigParser(configXmlPath);
-            engines = cfg4.getEngines();
-            engNames = engines.map(function (elem) {
-                return elem.name;
-            });
-            configEngArray = engNames.slice();
-            // Platforms are removed from config.xml.
-            expect(configEngArray.length === 0);
-        }).then(emptyPlatformList) // platform ls should be empty too.
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                // And now remove it with --save.
+                return cordova.platform('rm', ['android', 'browser'], {'save': true, 'fetch': true});
+            }).then(function () {
+                // Delete any previous caches of require(package.json).
+                pkgJson = cordova_util.requireNoCache(pkgJsonPath);
+                // Checking that the platform removed is in not in the platforms key.
+                expect(pkgJson.cordova.platforms.indexOf('android')).toEqual(-1);
+                expect(pkgJson.cordova.platforms.indexOf('browser')).toEqual(-1);
+                // Dependencies are removed.
+                expect(pkgJson.dependencies['cordova-android']).toBeUndefined();
+                expect(pkgJson.dependencies['cordova-browser']).toBeUndefined();
+                // Platforms are removed from config.xml.
+                var cfg4 = new ConfigParser(configXmlPath);
+                engines = cfg4.getEngines();
+                engNames = engines.map(function (elem) {
+                    return elem.name;
+                });
+                configEngArray = engNames.slice();
+                // Platforms are removed from config.xml.
+                expect(configEngArray.length === 0);
+            }).then(emptyPlatformList) // platform ls should be empty too.
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     }, TIMEOUT);
 });
 
@@ -600,7 +600,7 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
     afterEach(function () {
         // Delete any previous caches of require(package.json).
         cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
@@ -628,7 +628,7 @@ describe('During add, if pkg.json has a platform/plugin spec, use that one.', fu
         var cfg = new ConfigParser(configXmlPath);
         var engines = cfg.getEngines();
         var engNames;
-        var engSpec;
+        var engSpec; // eslint-disable-line no-unused-vars
         var platformsJson;
         var configPlugins = cfg.getPluginIdList();
         var pluginPkgJsonDir = path.join(cwd, 'plugins/cordova-plugin-splashscreen/package.json');
@@ -709,7 +709,7 @@ describe('During add, if config.xml has a platform/plugin spec and pkg.json does
 
     afterEach(function () {
         // Delete any previous caches of require(package.json).
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
@@ -736,7 +736,7 @@ describe('During add, if config.xml has a platform/plugin spec and pkg.json does
         var pkgJson;
         var engines = cfg.getEngines();
         var engNames;
-        var engSpec;
+        var engSpec; // eslint-disable-line no-unused-vars
         var configPlugins = cfg.getPluginIdList();
         var configPlugin = cfg.getPlugin(configPlugins);
         var pluginPkgJsonDir = path.join(cwd, 'plugins/cordova-plugin-splashscreen/package.json');
@@ -808,7 +808,7 @@ describe('During add, if add specifies a platform spec, use that one regardless
     afterEach(function () {
         // Delete any previous caches of require(package.json).
         cordova_util.requireNoCache(path.join(process.cwd(), 'package.json'));
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
@@ -896,7 +896,7 @@ describe('During add, if add specifies a platform spec, use that one regardless
 describe('local path is added to config.xml without pkg.json', function () {
     var tmpDir = helpers.tmpDir('platform_test_pkgjson');
     var project = path.join(tmpDir, 'project');
-    var results;
+    var results; // eslint-disable-line no-unused-vars
     var testRunRoot = process.cwd();
 
     beforeEach(function () {
@@ -911,7 +911,7 @@ describe('local path is added to config.xml without pkg.json', function () {
     });
 
     afterEach(function () {
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
@@ -921,28 +921,28 @@ describe('local path is added to config.xml without pkg.json', function () {
         var configXmlPath = path.join(cwd, 'config.xml');
         var cfg = new ConfigParser(configXmlPath);
         var engines = cfg.getEngines();
-        var engNames;
-        var engSpec;
+        var engNames; // eslint-disable-line no-unused-vars
+        var engSpec; // eslint-disable-line no-unused-vars
         var platformPath = path.join(testRunRoot, 'spec', 'cordova/fixtures/platforms/cordova-browser');
 
         // Run cordova platform add local path --save --fetch.
         return cordova.platform('add', platformPath, {'save': true, 'fetch': true})
-        .then(function () {
-            var cfg2 = new ConfigParser(configXmlPath);
-            engines = cfg2.getEngines();
-            // ios platform and spec have been added to config.xml.
-            engNames = engines.map(function (elem) {
-                return elem.name;
-            });
-            engSpec = engines.map(function (elem) {
-                if (elem.name === 'browser') {
-                    var result = includeFunc(elem.spec, platformPath);
-                    expect(result).toEqual(true);
-                }
-            });
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                var cfg2 = new ConfigParser(configXmlPath);
+                engines = cfg2.getEngines();
+                // ios platform and spec have been added to config.xml.
+                engNames = engines.map(function (elem) {
+                    return elem.name;
+                });
+                engSpec = engines.map(function (elem) {
+                    if (elem.name === 'browser') {
+                        var result = includeFunc(elem.spec, platformPath);
+                        expect(result).toEqual(true);
+                    }
+                });
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     }, 60000);
 
     // Test#027: has NO pkg.json. Checks if local path is added to config.xml and has no errors.
@@ -955,18 +955,18 @@ describe('local path is added to config.xml without pkg.json', function () {
         var configPlugin = cfg.getPlugin(configPlugins);
         // Run platform add with local path.
         return cordova.plugin('add', pluginPath, {'save': true, 'fetch': true})
-        .then(function () {
-            var cfg2 = new ConfigParser(configXmlPath);
-            // Check config.xml for plugins and spec.
-            configPlugins = cfg2.getPluginIdList();
-            configPlugin = cfg2.getPlugin(configPlugins[1]);
-            // Plugin is added.
-            expect(configPlugin.name).toEqual('cordova-lib-test-plugin');
-            // Spec for geolocation plugin is added.
-            var result = includeFunc(configPlugin.spec, pluginPath);
-            expect(result).toEqual(true);
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                var cfg2 = new ConfigParser(configXmlPath);
+                // Check config.xml for plugins and spec.
+                configPlugins = cfg2.getPluginIdList();
+                configPlugin = cfg2.getPlugin(configPlugins[1]);
+                // Plugin is added.
+                expect(configPlugin.name).toEqual('cordova-lib-test-plugin');
+                // Spec for geolocation plugin is added.
+                var result = includeFunc(configPlugin.spec, pluginPath);
+                expect(result).toEqual(true);
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     }, 60000);
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/integration-tests/platform.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/platform.spec.js b/integration-tests/platform.spec.js
index dd6d2b7..82f6711 100644
--- a/integration-tests/platform.spec.js
+++ b/integration-tests/platform.spec.js
@@ -15,22 +15,20 @@
     under the License.
 */
 
-var helpers = require('../spec/helpers'),
-    path = require('path'),
-    fs = require('fs'),
-    shell = require('shelljs'),
-    superspawn = require('cordova-common').superspawn,
-    config = require('../src/cordova/config'),
-    Q = require('q'),
-    events = require('cordova-common').events,
-    cordova = require('../src/cordova/cordova'),
-    rewire = require('rewire'),
-    prepare = require('../src/cordova/prepare'),
-    plugman = require('../src/plugman/plugman'),
-    platform = rewire('../src/cordova/platform'),
-    addHelper = rewire('../src/cordova/platform/addHelper');
-
-var projectRoot = 'C:\\Projects\\cordova-projects\\move-tracker';
+var helpers = require('../spec/helpers');
+var path = require('path');
+var fs = require('fs');
+var shell = require('shelljs');
+var superspawn = require('cordova-common').superspawn;
+var config = require('../src/cordova/config');
+var Q = require('q');
+var events = require('cordova-common').events;
+var cordova = require('../src/cordova/cordova');
+var rewire = require('rewire');
+var prepare = require('../src/cordova/prepare'); // eslint-disable-line no-unused-vars
+var plugman = require('../src/plugman/plugman');
+var platform = rewire('../src/cordova/platform');
+var addHelper = rewire('../src/cordova/platform/addHelper');
 var fixturesDir = path.join(__dirname, '..', 'spec', 'cordova', 'fixtures');
 var pluginsDir = path.join(fixturesDir, 'plugins');
 
@@ -74,7 +72,7 @@ describe('platform end-to-end', function () {
     });
 
     afterEach(function () {
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
@@ -112,60 +110,60 @@ describe('platform end-to-end', function () {
             expect(path.join(project, 'platforms', helpers.testPlatform)).toExist();
             expect(path.join(project, 'platforms', helpers.testPlatform, 'cordova')).toExist();
         }).then(fullPlatformList) // Check for it in platform ls.
-        .then(function () {
-            // Try to update the platform.
-            return cordova.platform('update', [helpers.testPlatform]);
-        }).then(function () {
-            // Our fake update script in the exec mock above creates this dummy file.
-            expect(path.join(project, 'platforms', helpers.testPlatform, 'updated')).toExist();
-        }).then(fullPlatformList) // Platform should still be in platform ls.
-        .then(function () {
-            // And now remove it.
-            return cordova.platform('rm', [helpers.testPlatform]);
-        }).then(function () {
-            // It should be gone.
-            expect(path.join(project, 'platforms', helpers.testPlatform)).not.toExist();
-        }).then(emptyPlatformList) // platform ls should be empty too.
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        }).fin(done);
+            .then(function () {
+                // Try to update the platform.
+                return cordova.platform('update', [helpers.testPlatform]);
+            }).then(function () {
+                // Our fake update script in the exec mock above creates this dummy file.
+                expect(path.join(project, 'platforms', helpers.testPlatform, 'updated')).toExist();
+            }).then(fullPlatformList) // Platform should still be in platform ls.
+            .then(function () {
+                // And now remove it.
+                return cordova.platform('rm', [helpers.testPlatform]);
+            }).then(function () {
+                // It should be gone.
+                expect(path.join(project, 'platforms', helpers.testPlatform)).not.toExist();
+            }).then(emptyPlatformList) // platform ls should be empty too.
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            }).fin(done);
     });
 
     it('Test 002 : should install plugins correctly while adding platform', function (done) {
 
         cordova.plugin('add', path.join(pluginsDir, 'test'))
-        .then(function () {
-            return cordova.platform('add', [helpers.testPlatform]);
-        })
-        .then(function () {
-            // Check the platform add was successful.
-            expect(path.join(project, 'platforms', helpers.testPlatform)).toExist();
-            // Check that plugin files exists in www dir
-            expect(path.join(project, 'platforms', helpers.testPlatform, 'assets/www/test.js')).toExist();
-        })
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                return cordova.platform('add', [helpers.testPlatform]);
+            })
+            .then(function () {
+                // Check the platform add was successful.
+                expect(path.join(project, 'platforms', helpers.testPlatform)).toExist();
+                // Check that plugin files exists in www dir
+                expect(path.join(project, 'platforms', helpers.testPlatform, 'assets/www/test.js')).toExist();
+            })
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 60000);
 
     xit('Test 003 : should call prepare after plugins were installed into platform', function (done) {
         var order = '';
-        var fail = jasmine.createSpy(fail);
+        var fail = jasmine.createSpy(fail); // eslint-disable-line no-use-before-define
         spyOn(plugman, 'install').and.callFake(function () { order += 'I'; });
         // below line won't work since prepare is inline require in addHelper, not global
-        var x = addHelper.__set__('prepare', function () { order += 'P'; });
+        var x = addHelper.__set__('prepare', function () { order += 'P'; }); // eslint-disable-line no-unused-vars
         // spyOn(prepare).and.callFake(function() { console.log('prepare'); order += 'P'; });
         cordova.plugin('add', path.join(pluginsDir, 'test'))
-        .then(function () {
-            return platform('add', [helpers.testPlatform]);
-        })
-        .fail(fail)
-        .fin(function () {
-            expect(order).toBe('IP'); // Install first, then prepare
-            expect(fail).not.toHaveBeenCalled();
-            done();
-        });
+            .then(function () {
+                return platform('add', [helpers.testPlatform]);
+            })
+            .fail(fail)
+            .fin(function () {
+                expect(order).toBe('IP'); // Install first, then prepare
+                expect(fail).not.toHaveBeenCalled();
+                done();
+            });
     });
 });
 
@@ -180,39 +178,39 @@ describe('platform add plugin rm end-to-end', function () {
     });
 
     afterEach(function () {
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
     it('Test 006 : should remove dependency when removing parent plugin', function (done) {
 
         cordova.create('hello')
-        .then(function () {
-            process.chdir(project);
-            return cordova.platform('add', 'browser@latest');
-        })
-        .then(function () {
-            return cordova.plugin('add', 'cordova-plugin-media');
-        })
-        .then(function () {
-            expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
-            expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
-            return cordova.platform('add', 'android');
-        })
-        .then(function () {
-            expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
-            expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
-            return cordova.plugin('rm', 'cordova-plugin-media');
-        })
-        .then(function () {
-            expect(path.join(pluginsDir, 'cordova-plugin-media')).not.toExist();
-            expect(path.join(pluginsDir, 'cordova-plugin-file')).not.toExist();
-        })
-        .fail(function (err) {
-            console.error(err);
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                process.chdir(project);
+                return cordova.platform('add', 'browser@latest');
+            })
+            .then(function () {
+                return cordova.plugin('add', 'cordova-plugin-media');
+            })
+            .then(function () {
+                expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
+                expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+                return cordova.platform('add', 'android');
+            })
+            .then(function () {
+                expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
+                expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+                return cordova.plugin('rm', 'cordova-plugin-media');
+            })
+            .then(function () {
+                expect(path.join(pluginsDir, 'cordova-plugin-media')).not.toExist();
+                expect(path.join(pluginsDir, 'cordova-plugin-file')).not.toExist();
+            })
+            .fail(function (err) {
+                console.error(err);
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 100000);
 });
 
@@ -228,43 +226,43 @@ describe('platform add and remove --fetch', function () {
     });
 
     afterEach(function () {
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
     it('Test 007 : should add and remove platform from node_modules directory', function (done) {
 
         cordova.create('helloFetch')
-        .then(function () {
-            process.chdir(project);
-            return cordova.platform('add', 'browser', {'fetch': true});
-        })
-        .then(function () {
-            expect(path.join(nodeModulesDir, 'cordova-browser')).toExist();
-            expect(path.join(platformsDir, 'browser')).toExist();
-            return cordova.platform('add', 'android', {'fetch': true});
-        })
-        .then(function () {
-            expect(path.join(nodeModulesDir, 'cordova-browser')).toExist();
-            expect(path.join(platformsDir, 'android')).toExist();
-            // Tests finish before this command finishes resolving
-            // return cordova.platform('rm', 'ios', {'fetch':true});
-        })
-        .then(function () {
-            // expect(path.join(nodeModulesDir, 'cordova-ios')).not.toExist();
-            // expect(path.join(platformsDir, 'ios')).not.toExist();
-            // Tests finish before this command finishes resolving
-            // return cordova.platform('rm', 'android', {'fetch':true});
-        })
-        .then(function () {
-            // expect(path.join(nodeModulesDir, 'cordova-android')).not.toExist();
-            // expect(path.join(platformsDir, 'android')).not.toExist();
-        })
-        .fail(function (err) {
-            console.error(err);
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                process.chdir(project);
+                return cordova.platform('add', 'browser', {'fetch': true});
+            })
+            .then(function () {
+                expect(path.join(nodeModulesDir, 'cordova-browser')).toExist();
+                expect(path.join(platformsDir, 'browser')).toExist();
+                return cordova.platform('add', 'android', {'fetch': true});
+            })
+            .then(function () {
+                expect(path.join(nodeModulesDir, 'cordova-browser')).toExist();
+                expect(path.join(platformsDir, 'android')).toExist();
+                // Tests finish before this command finishes resolving
+                // return cordova.platform('rm', 'ios', {'fetch':true});
+            })
+            .then(function () {
+                // expect(path.join(nodeModulesDir, 'cordova-ios')).not.toExist();
+                // expect(path.join(platformsDir, 'ios')).not.toExist();
+                // Tests finish before this command finishes resolving
+                // return cordova.platform('rm', 'android', {'fetch':true});
+            })
+            .then(function () {
+                // expect(path.join(nodeModulesDir, 'cordova-android')).not.toExist();
+                // expect(path.join(platformsDir, 'android')).not.toExist();
+            })
+            .fail(function (err) {
+                console.error(err);
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 100000);
 });
 
@@ -279,47 +277,47 @@ describe('plugin add and rm end-to-end --fetch', function () {
     });
 
     afterEach(function () {
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
     it('Test 008 : should remove dependency when removing parent plugin', function (done) {
 
         cordova.create('hello3')
-        .then(function () {
-            process.chdir(project);
-            return cordova.platform('add', 'browser', {'fetch': true});
-        })
-        .then(function () {
-            return cordova.plugin('add', 'cordova-plugin-media', {'fetch': true});
-        })
-        .then(function () {
-            expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
-            expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
-            expect(path.join(pluginsDir, 'cordova-plugin-compat')).toExist();
-            expect(path.join(project, 'node_modules', 'cordova-plugin-media')).toExist();
-            expect(path.join(project, 'node_modules', 'cordova-plugin-file')).toExist();
-            expect(path.join(project, 'node_modules', 'cordova-plugin-compat')).toExist();
-            return cordova.platform('add', 'android', {'fetch': true});
-        })
-        .then(function () {
-            expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
-            expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
-            return cordova.plugin('rm', 'cordova-plugin-media', {'fetch': true});
-        })
-        .then(function () {
-            expect(path.join(pluginsDir, 'cordova-plugin-media')).not.toExist();
-            expect(path.join(pluginsDir, 'cordova-plugin-file')).not.toExist();
-            expect(path.join(pluginsDir, 'cordova-plugin-compat')).not.toExist();
-            // These don't work yet due to the tests finishing before the promise resolves.
-            // expect(path.join(project, 'node_modules', 'cordova-plugin-media')).not.toExist();
-            // expect(path.join(project, 'node_modules', 'cordova-plugin-file')).not.toExist();
-            // expect(path.join(project, 'node_modules', 'cordova-plugin-compat')).not.toExist();
-        })
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                process.chdir(project);
+                return cordova.platform('add', 'browser', {'fetch': true});
+            })
+            .then(function () {
+                return cordova.plugin('add', 'cordova-plugin-media', {'fetch': true});
+            })
+            .then(function () {
+                expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
+                expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+                expect(path.join(pluginsDir, 'cordova-plugin-compat')).toExist();
+                expect(path.join(project, 'node_modules', 'cordova-plugin-media')).toExist();
+                expect(path.join(project, 'node_modules', 'cordova-plugin-file')).toExist();
+                expect(path.join(project, 'node_modules', 'cordova-plugin-compat')).toExist();
+                return cordova.platform('add', 'android', {'fetch': true});
+            })
+            .then(function () {
+                expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist();
+                expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+                return cordova.plugin('rm', 'cordova-plugin-media', {'fetch': true});
+            })
+            .then(function () {
+                expect(path.join(pluginsDir, 'cordova-plugin-media')).not.toExist();
+                expect(path.join(pluginsDir, 'cordova-plugin-file')).not.toExist();
+                expect(path.join(pluginsDir, 'cordova-plugin-compat')).not.toExist();
+                // These don't work yet due to the tests finishing before the promise resolves.
+                // expect(path.join(project, 'node_modules', 'cordova-plugin-media')).not.toExist();
+                // expect(path.join(project, 'node_modules', 'cordova-plugin-file')).not.toExist();
+                // expect(path.join(project, 'node_modules', 'cordova-plugin-compat')).not.toExist();
+            })
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 60000);
 });
 
@@ -335,34 +333,34 @@ describe('non-core platform add and rm end-to-end --fetch', function () {
     });
 
     afterEach(function () {
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
     it('Test 009 : should add and remove 3rd party platforms', function (done) {
         var installed;
         cordova.create('hello')
-        .then(function () {
-            process.chdir(project);
-            // add cordova-android instead of android
-            return cordova.platform('add', 'cordova-android', {'fetch': true});
-        }).then(function () {
-            // 3rd party platform from npm
-            return cordova.platform('add', 'cordova-platform-test', {'fetch': true});
-        }).then(function () {
-            expect(path.join(project, 'platforms', 'android')).toExist();
-            expect(path.join(project, 'platforms', 'cordova-platform-test')).toExist();
-            return cordova.platform('ls');
-        })
-        .then(function () {
-            // use regex to grab installed platforms
-            installed = results.match(/Installed platforms:\n {2}(.*)\n {2}(.*)/);
-            expect(installed).toBeDefined();
-            expect(installed[1].indexOf('android')).toBeGreaterThan(-1);
-            expect(installed[2].indexOf('cordova-platform-test')).toBeGreaterThan(-1);
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                process.chdir(project);
+                // add cordova-android instead of android
+                return cordova.platform('add', 'cordova-android', {'fetch': true});
+            }).then(function () {
+                // 3rd party platform from npm
+                return cordova.platform('add', 'cordova-platform-test', {'fetch': true});
+            }).then(function () {
+                expect(path.join(project, 'platforms', 'android')).toExist();
+                expect(path.join(project, 'platforms', 'cordova-platform-test')).toExist();
+                return cordova.platform('ls');
+            })
+            .then(function () {
+                // use regex to grab installed platforms
+                installed = results.match(/Installed platforms:\n {2}(.*)\n {2}(.*)/);
+                expect(installed).toBeDefined();
+                expect(installed[1].indexOf('android')).toBeGreaterThan(-1);
+                expect(installed[2].indexOf('cordova-platform-test')).toBeGreaterThan(-1);
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 90000);
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/integration-tests/plugin.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/plugin.spec.js b/integration-tests/plugin.spec.js
index 499ab6c..a19f8c7 100644
--- a/integration-tests/plugin.spec.js
+++ b/integration-tests/plugin.spec.js
@@ -17,16 +17,16 @@
     under the License.
 */
 
-var helpers = require('../spec/helpers'),
-    path = require('path'),
-    Q = require('q'),
-    shell = require('shelljs'),
-    events = require('cordova-common').events,
-    cordova = require('../src/cordova/cordova'),
-    platforms = require('../src/platforms/platforms'),
-    plugman = require('../src/plugman/plugman'),
-    install = require('../src/plugman/install'),
-    registry = require('../src/plugman/registry/registry');
+var helpers = require('../spec/helpers');
+var path = require('path');
+var Q = require('q');
+var shell = require('shelljs');
+var events = require('cordova-common').events;
+var cordova = require('../src/cordova/cordova');
+var platforms = require('../src/platforms/platforms');
+var plugman = require('../src/plugman/plugman');
+var install = require('../src/plugman/install');
+var registry = require('../src/plugman/registry/registry');
 
 var util = require('../src/cordova/util');
 
@@ -71,14 +71,14 @@ function addPlugin (target, id, options) {
 // Runs: remove, list
 function removePlugin (id) {
     return cordova.plugin('rm', id)
-    .then(function () {
-        // The whole dir should be gone.
-        expect(path.join(project, 'plugins', id)).not.toExist();
-    }).then(function () {
-        return cordova.plugin('ls');
-    }).then(function () {
-        expect(results).toMatch(/No plugins added/gi);
-    });
+        .then(function () {
+            // The whole dir should be gone.
+            expect(path.join(project, 'plugins', id)).not.toExist();
+        }).then(function () {
+            return cordova.plugin('ls');
+        }).then(function () {
+            expect(results).toMatch(/No plugins added/gi);
+        });
 }
 
 var errorHandler = {
@@ -126,23 +126,23 @@ describe('plugin end-to-end', function () {
     });
 
     afterEach(function () {
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
         expect(errorHandler.errorCallback).not.toHaveBeenCalled();
     });
 
     it('Test 001 : should successfully add and remove a plugin with no options', function (done) {
         addPlugin(path.join(pluginsDir, 'fake1'), pluginId, {}, done)
-        .then(function () {
-            expect(install.runInstall).toHaveBeenCalled();
-            expect(platforms.getPlatformApi.calls.count()).toEqual(1);
-            return removePlugin(pluginId);
-        }).then(function () {
-            expect(platforms.getPlatformApi.calls.count()).toEqual(2);
-        }).fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                expect(install.runInstall).toHaveBeenCalled();
+                expect(platforms.getPlatformApi.calls.count()).toEqual(1);
+                return removePlugin(pluginId);
+            }).then(function () {
+                expect(platforms.getPlatformApi.calls.count()).toEqual(2);
+            }).fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 30000);
 
     it('Test 004 : should successfully add a plugin using relative path when running from subdir inside of project', function (done) {
@@ -159,55 +159,55 @@ describe('plugin end-to-end', function () {
 
         // Add plugin using relative path
         addPlugin(path.relative(subdir, plugindir), pluginId, {}, done)
-        .then(function () {
-            return removePlugin(pluginId);
-        })
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                return removePlugin(pluginId);
+            })
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 30000);
 
     it('Test 005 : should respect preference default values', function (done) {
-        addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED: 'NO', REQUIRED_ANDROID: 'NO'}}, done)
-       .then(function () {
-           var platformJsonPath = path.join(project, 'plugins', helpers.testPlatform + '.json');
-           var installed_plugins = require(platformJsonPath).installed_plugins;
-           var defaultPluginPreferences = installed_plugins[org_test_defaultvariables];
-           expect(defaultPluginPreferences).toBeDefined();
-           expect(defaultPluginPreferences.DEFAULT).toBe('yes');
-           expect(defaultPluginPreferences.DEFAULT_ANDROID).toBe('yes');
-           expect(defaultPluginPreferences.REQUIRED_ANDROID).toBe('NO');
-           expect(defaultPluginPreferences.REQUIRED).toBe('NO');
-           return removePlugin(org_test_defaultvariables);
-       })
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+        addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED: 'NO', REQUIRED_ANDROID: 'NO' }}, done)
+            .then(function () {
+                var platformJsonPath = path.join(project, 'plugins', helpers.testPlatform + '.json');
+                var installed_plugins = require(platformJsonPath).installed_plugins;
+                var defaultPluginPreferences = installed_plugins[org_test_defaultvariables];
+                expect(defaultPluginPreferences).toBeDefined();
+                expect(defaultPluginPreferences.DEFAULT).toBe('yes');
+                expect(defaultPluginPreferences.DEFAULT_ANDROID).toBe('yes');
+                expect(defaultPluginPreferences.REQUIRED_ANDROID).toBe('NO');
+                expect(defaultPluginPreferences.REQUIRED).toBe('NO');
+                return removePlugin(org_test_defaultvariables);
+            })
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 30000);
 
     it('Test 006 : should successfully add a plugin when specifying CLI variables', function (done) {
-        addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED: 'yes', REQUIRED_ANDROID: 'yes'}}, done)
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+        addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED: 'yes', REQUIRED_ANDROID: 'yes' }}, done)
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 30000);
 
     it('Test 007 : should not check npm info when using the searchpath flag', function (done) {
         mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
         spyOn(registry, 'info');
         return addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {searchpath: pluginsDir}, done)
-        .then(function () {
-            expect(registry.info).not.toHaveBeenCalled();
-            var fetchOptions = plugman.fetch.calls.mostRecent().args[2];
-            expect(fetchOptions.searchpath[0]).toExist();
-        })
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                expect(registry.info).not.toHaveBeenCalled();
+                var fetchOptions = plugman.fetch.calls.mostRecent().args[2];
+                expect(fetchOptions.searchpath[0]).toExist();
+            })
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 30000);
 
     it('Test 008 : should not check npm info when using the noregistry flag', function (done) {
@@ -215,28 +215,28 @@ describe('plugin end-to-end', function () {
 
         spyOn(registry, 'info');
         addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {noregistry: true}, done)
-        .then(function () {
-            expect(registry.info).not.toHaveBeenCalled();
-
-            var fetchOptions = plugman.fetch.calls.mostRecent().args[2];
-            expect(fetchOptions.noregistry).toBeTruthy();
-        })
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                expect(registry.info).not.toHaveBeenCalled();
+
+                var fetchOptions = plugman.fetch.calls.mostRecent().args[2];
+                expect(fetchOptions.noregistry).toBeTruthy();
+            })
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 30000);
 
     it('Test 009 : should not check npm info when fetching from a Git repository', function (done) {
         spyOn(registry, 'info');
         addPlugin(testGitPluginRepository, testGitPluginId, {}, done)
-        .then(function () {
-            expect(registry.info).not.toHaveBeenCalled();
-        })
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                expect(registry.info).not.toHaveBeenCalled();
+            })
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 30000);
 
     it('Test 010 : should select the plugin version based on npm info when fetching from npm', function (done) {
@@ -244,16 +244,16 @@ describe('plugin end-to-end', function () {
 
         spyOn(registry, 'info').and.callThrough();
         addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {'fetch': true}, done)
-        .then(function () {
-            expect(registry.info).toHaveBeenCalled();
-
-            var fetchTarget = plugman.fetch.calls.mostRecent().args[0];
-            expect(fetchTarget).toEqual(npmInfoTestPlugin + '@' + npmInfoTestPluginVersion);
-        })
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                expect(registry.info).toHaveBeenCalled();
+
+                var fetchTarget = plugman.fetch.calls.mostRecent().args[0];
+                expect(fetchTarget).toEqual(npmInfoTestPlugin + '@' + npmInfoTestPluginVersion);
+            })
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 30000);
 
     it('Test 011 : should handle scoped npm packages', function (done) {
@@ -262,19 +262,19 @@ describe('plugin end-to-end', function () {
 
         spyOn(registry, 'info').and.returnValue(Q({}));
         addPlugin(scopedPackage, npmInfoTestPlugin, {}, done)
-        .then(function () {
-            // Check to make sure that we are at least trying to get the correct package.
-            // This package is not published to npm, so we can't truly do end-to-end tests
-
-            expect(registry.info).toHaveBeenCalledWith([scopedPackage]);
-
-            var fetchTarget = plugman.fetch.calls.mostRecent().args[0];
-            expect(fetchTarget).toEqual(scopedPackage);
-        })
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                // Check to make sure that we are at least trying to get the correct package.
+                // This package is not published to npm, so we can't truly do end-to-end tests
+
+                expect(registry.info).toHaveBeenCalledWith([scopedPackage]);
+
+                var fetchTarget = plugman.fetch.calls.mostRecent().args[0];
+                expect(fetchTarget).toEqual(scopedPackage);
+            })
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 30000);
 
     it('Test 012 : should handle scoped npm packages with given version tags', function (done) {
@@ -283,15 +283,15 @@ describe('plugin end-to-end', function () {
 
         spyOn(registry, 'info');
         addPlugin(scopedPackage, npmInfoTestPlugin, {}, done)
-        .then(function () {
-            expect(registry.info).not.toHaveBeenCalled();
-
-            var fetchTarget = plugman.fetch.calls.mostRecent().args[0];
-            expect(fetchTarget).toEqual(scopedPackage);
-        })
-        .fail(function (err) {
-            expect(err).toBeUndefined();
-        })
-        .fin(done);
+            .then(function () {
+                expect(registry.info).not.toHaveBeenCalled();
+
+                var fetchTarget = plugman.fetch.calls.mostRecent().args[0];
+                expect(fetchTarget).toEqual(scopedPackage);
+            })
+            .fail(function (err) {
+                expect(err).toBeUndefined();
+            })
+            .fin(done);
     }, 30000);
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d19951b3/integration-tests/plugin_fetch.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/plugin_fetch.spec.js b/integration-tests/plugin_fetch.spec.js
index ec0f14e..5e5297b 100644
--- a/integration-tests/plugin_fetch.spec.js
+++ b/integration-tests/plugin_fetch.spec.js
@@ -19,11 +19,11 @@
 
 // TODO: all of these tests should go as unit tests to src/cordova/plugin/add
 
-var plugin = require('../src/cordova/plugin/add'),
-    helpers = require('../spec/helpers'),
-    path = require('path'),
-    events = require('cordova-common').events,
-    shell = require('shelljs');
+var plugin = require('../src/cordova/plugin/add');
+var helpers = require('../spec/helpers');
+var path = require('path');
+var events = require('cordova-common').events;
+var shell = require('shelljs');
 
 var testPluginVersions = [
     '0.0.2',
@@ -68,11 +68,11 @@ function testEngineWithProject (done, testEngine, testResult) {
             'engines': { 'cordovaDependencies': testEngine },
             'versions': testPluginVersions
         }, cordovaVersion)
-    .then(function (toFetch) {
-        expect(toFetch).toBe(testResult);
-    })
-    .fail(getVersionErrorCallback)
-    .fin(done);
+        .then(function (toFetch) {
+            expect(toFetch).toBe(testResult);
+        })
+        .fail(getVersionErrorCallback)
+        .fin(done);
 }
 
 // Checks the warnings that were printed by the CLI to ensure that the code is
@@ -378,10 +378,10 @@ describe('plugin fetching version selection', function () {
             name: 'test-plugin',
             versions: testPluginVersions
         }, cordovaVersion)
-        .then(function (toFetch) {
-            expect(toFetch).toBe(null);
-        })
-        .fail(getVersionErrorCallback).fin(done);
+            .then(function (toFetch) {
+                expect(toFetch).toBe(null);
+            })
+            .fail(getVersionErrorCallback).fin(done);
     });
 
     it('Test 016 : should not fail if there is no cordovaDependencies in the engines', function (done) {
@@ -396,10 +396,10 @@ describe('plugin fetching version selection', function () {
                 'npm': '~2.0.0'
             }
         }, cordovaVersion)
-        .then(function (toFetch) {
-            expect(toFetch).toBe(null);
-        })
-        .fail(getVersionErrorCallback).fin(after);
+            .then(function (toFetch) {
+                expect(toFetch).toBe(null);
+            })
+            .fail(getVersionErrorCallback).fin(after);
 
     });
 
@@ -434,9 +434,9 @@ describe('plugin fetching version selection', function () {
     it('Test 019 : should ignore badly typed constraint entries', function (done) {
         var testEngine = {
             '0.0.2': { 'cordova': 1 },
-            '0.7.0': { 'cordova': {}},
-            '1.0.0': { 'cordova': undefined},
-            '1.1.3': { 8: '5.0.0'},
+            '0.7.0': { 'cordova': {} },
+            '1.0.0': { 'cordova': undefined },
+            '1.1.3': { 8: '5.0.0' },
             '1.3.0': { 'cordova': [] },
             '1.7.1': { 'cordova': null }
         };
@@ -469,8 +469,8 @@ describe('plugin fetching version selection', function () {
             'notAVersion': { 'cordova-android': '3.1.0' },
             '^1.1.2': { 'cordova-android': '3.1.0' },
             '<=1.3.0': { 'cordova-android': '3.1.0' },
-            '1.0.0': { 'cordova-android': '~3' },   // Good semver
-            '2.0.0': { 'cordova-android': '5.1.0' },   // Good semver
+            '1.0.0': { 'cordova-android': '~3' }, // Good semver
+            '2.0.0': { 'cordova-android': '5.1.0' }, // Good semver
             '1.0': { 'cordova-android': '3.1.0' },
             '2': { 'cordova-android': '3.1.0' }
         };


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


[11/18] cordova-lib git commit: CB-12895 : ran eslint --fix on cordova-lib

Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/integration-tests/plugin_fetch.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/plugin_fetch.spec.js b/integration-tests/plugin_fetch.spec.js
index 55b1a0e..ec0f14e 100644
--- a/integration-tests/plugin_fetch.spec.js
+++ b/integration-tests/plugin_fetch.spec.js
@@ -19,11 +19,11 @@
 
 // TODO: all of these tests should go as unit tests to src/cordova/plugin/add
 
-var plugin  = require('../src/cordova/plugin/add'),
+var plugin = require('../src/cordova/plugin/add'),
     helpers = require('../spec/helpers'),
-    path    = require('path'),
+    path = require('path'),
     events = require('cordova-common').events,
-    shell   = require('shelljs');
+    shell = require('shelljs');
 
 var testPluginVersions = [
     '0.0.2',
@@ -54,13 +54,13 @@ var UNMET_REQ_REGEX = /\s+([^\s]+)[^\d]+(\d+\.\d+\.\d+) in project, (.+) require
 
 // We generate warnings when we don't fetch latest. Collect them to make sure we
 // are making the correct warnings
-events.on('warn', function(warning) {
+events.on('warn', function (warning) {
     warnings.push(warning);
 });
 
 // Tests a sample engine against the installed platforms/plugins in our test
 // project
-function testEngineWithProject(done, testEngine, testResult) {
+function testEngineWithProject (done, testEngine, testResult) {
     plugin.getFetchVersion(project,
         {
             'version': '2.3.0',
@@ -68,7 +68,7 @@ function testEngineWithProject(done, testEngine, testResult) {
             'engines': { 'cordovaDependencies': testEngine },
             'versions': testPluginVersions
         }, cordovaVersion)
-    .then(function(toFetch) {
+    .then(function (toFetch) {
         expect(toFetch).toBe(testResult);
     })
     .fail(getVersionErrorCallback)
@@ -78,10 +78,10 @@ function testEngineWithProject(done, testEngine, testResult) {
 // Checks the warnings that were printed by the CLI to ensure that the code is
 // listing the correct reasons for failure. Checks against the global warnings
 // object which is reset before each test
-function checkUnmetRequirements(requirements) {
+function checkUnmetRequirements (requirements) {
     var reqWarnings = [];
 
-    warnings.forEach(function(warning) {
+    warnings.forEach(function (warning) {
         var extracted = UNMET_REQ_REGEX.exec(warning);
         if (extracted) {
             reqWarnings.push({
@@ -93,19 +93,18 @@ function checkUnmetRequirements(requirements) {
     });
     expect(reqWarnings.length).toEqual(requirements.length);
 
-
-    requirements.forEach(function(requirement) {
-        expect(reqWarnings).toContainArray(function(extractedWarning) {
-            return  extractedWarning.dependency === requirement.dependency.trim() &&
-                    extractedWarning.installed  === requirement.installed.trim() &&
-                    extractedWarning.required   === requirement.required.trim();
+    requirements.forEach(function (requirement) {
+        expect(reqWarnings).toContainArray(function (extractedWarning) {
+            return extractedWarning.dependency === requirement.dependency.trim() &&
+                    extractedWarning.installed === requirement.installed.trim() &&
+                    extractedWarning.required === requirement.required.trim();
         }, requirement);
     });
 }
 
 // Helper functions for creating the requirements objects taken by
 // checkUnmetRequirements()
-function getPlatformRequirement(requirement) {
+function getPlatformRequirement (requirement) {
     return {
         dependency: 'cordova-android',
         installed: '3.1.0',
@@ -113,7 +112,7 @@ function getPlatformRequirement(requirement) {
     };
 }
 
-function getCordovaRequirement(requirement) {
+function getCordovaRequirement (requirement) {
     return {
         dependency: 'cordova',
         installed: cordovaVersion,
@@ -121,7 +120,7 @@ function getCordovaRequirement(requirement) {
     };
 }
 
-function getPluginRequirement(requirement) {
+function getPluginRequirement (requirement) {
     return {
         dependency: 'ca.filmaj.AndroidPlugin',
         installed: '4.2.0',
@@ -130,8 +129,8 @@ function getPluginRequirement(requirement) {
 }
 
 // Generates a callback that checks warning messages after the test is complete
-function getWarningCheckCallback(done, requirements) {
-    return function() {
+function getWarningCheckCallback (done, requirements) {
+    return function () {
         checkUnmetRequirements(requirements);
         expect(getVersionErrorCallback).not.toHaveBeenCalled();
         done();
@@ -139,7 +138,7 @@ function getWarningCheckCallback(done, requirements) {
 }
 var fixtures = path.join(__dirname, '..', 'spec', 'cordova', 'fixtures');
 
-function createTestProject() {
+function createTestProject () {
     // Get the base project
     shell.cp('-R', path.join(fixtures, 'base'), tempDir);
     shell.mv(path.join(tempDir, 'base'), project);
@@ -153,20 +152,20 @@ function createTestProject() {
         path.join(project, 'plugins'));
 }
 
-function removeTestProject() {
+function removeTestProject () {
     shell.rm('-rf', tempDir);
 }
 
-describe('plugin fetching version selection', function() {
+describe('plugin fetching version selection', function () {
     createTestProject();
-    beforeEach(function() {
+    beforeEach(function () {
         jasmine.addMatchers({
-            'toContainArray': function() {
+            'toContainArray': function () {
                 return {
-                    compare: function(actual, expected) {
+                    compare: function (actual, expected) {
                         var result = {};
                         result.pass = false;
-                        for(var i = 0; i < actual.length; i++) {
+                        for (var i = 0; i < actual.length; i++) {
                             if (expected(actual[i])) {
                                 result.pass = true;
                                 break;
@@ -182,15 +181,15 @@ describe('plugin fetching version selection', function() {
         getVersionErrorCallback = jasmine.createSpy('unexpectedPluginFetchErrorCallback');
     });
 
-    it('Test 001 : should handle a mix of upper bounds and single versions', function(done) {
+    it('Test 001 : should handle a mix of upper bounds and single versions', function (done) {
         var testEngine = {
-            '0.0.0' : { 'cordova-android': '1.0.0' },
-            '0.0.2' : { 'cordova-android': '>1.0.0' },
+            '0.0.0': { 'cordova-android': '1.0.0' },
+            '0.0.2': { 'cordova-android': '>1.0.0' },
             '<1.0.0': { 'cordova-android': '<2.0.0' },
-            '1.0.0' : { 'cordova-android': '>2.0.0' },
-            '1.7.0' : { 'cordova-android': '>4.0.0' },
+            '1.0.0': { 'cordova-android': '>2.0.0' },
+            '1.7.0': { 'cordova-android': '>4.0.0' },
             '<2.3.0': { 'cordova-android': '<6.1.1' },
-            '2.3.0' : { 'cordova-android': '6.1.1' }
+            '2.3.0': { 'cordova-android': '6.1.1' }
         };
 
         var after = getWarningCheckCallback(done, [
@@ -199,15 +198,15 @@ describe('plugin fetching version selection', function() {
         testEngineWithProject(after, testEngine, '1.3.0');
     }, 6000);
 
-    it('Test 002 : should apply upper bound engine constraints when there are no unspecified constraints above the upper bound', function(done) {
+    it('Test 002 : should apply upper bound engine constraints when there are no unspecified constraints above the upper bound', function (done) {
         var testEngine = {
-            '1.0.0' : { 'cordova-android': '>2.0.0' },
-            '1.7.0' : { 'cordova-android': '>4.0.0' },
+            '1.0.0': { 'cordova-android': '>2.0.0' },
+            '1.7.0': { 'cordova-android': '>4.0.0' },
             '<2.3.0': {
                 'cordova-android': '<6.1.1',
                 'ca.filmaj.AndroidPlugin': '<1.0.0'
             },
-            '2.3.0' : { 'cordova-android': '6.1.1' }
+            '2.3.0': { 'cordova-android': '6.1.1' }
         };
 
         var after = getWarningCheckCallback(done, [
@@ -216,10 +215,10 @@ describe('plugin fetching version selection', function() {
         testEngineWithProject(after, testEngine, null);
     });
 
-    it('Test 003 : should apply upper bound engine constraints when there are unspecified constraints above the upper bound', function(done) {
+    it('Test 003 : should apply upper bound engine constraints when there are unspecified constraints above the upper bound', function (done) {
         var testEngine = {
-            '0.0.0' : {},
-            '2.0.0' : { 'cordova-android': '~5.0.0' },
+            '0.0.0': {},
+            '2.0.0': { 'cordova-android': '~5.0.0' },
             '<1.0.0': { 'cordova-android': '>5.0.0' }
         };
 
@@ -230,9 +229,9 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 004 : should handle the case where there are no constraints for earliest releases', function(done) {
+    it('Test 004 : should handle the case where there are no constraints for earliest releases', function (done) {
         var testEngine = {
-            '1.0.0' : { 'cordova-android': '~5.0.0' }
+            '1.0.0': { 'cordova-android': '~5.0.0' }
         };
 
         var after = getWarningCheckCallback(done, [
@@ -242,9 +241,9 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 005 : should handle the case where the lowest version is unsatisfied', function(done) {
+    it('Test 005 : should handle the case where the lowest version is unsatisfied', function (done) {
         var testEngine = {
-            '0.0.2' : { 'cordova-android': '~5.0.0' }
+            '0.0.2': { 'cordova-android': '~5.0.0' }
         };
 
         var after = getWarningCheckCallback(done, [
@@ -254,7 +253,7 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 006 : should handle upperbounds if no single version constraints are given', function(done) {
+    it('Test 006 : should handle upperbounds if no single version constraints are given', function (done) {
         var testEngine = {
             '<1.0.0': { 'cordova-android': '<2.0.0' }
         };
@@ -265,9 +264,9 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 007 : should apply upper bounds greater than highest version', function(done) {
+    it('Test 007 : should apply upper bounds greater than highest version', function (done) {
         var testEngine = {
-            '0.0.0' : {},
+            '0.0.0': {},
             '<5.0.0': { 'cordova-android': '<2.0.0' }
         };
 
@@ -279,10 +278,10 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 008 : should treat empty constraints as satisfied', function(done) {
+    it('Test 008 : should treat empty constraints as satisfied', function (done) {
         var testEngine = {
-            '1.0.0' : {},
-            '1.1.0' : { 'cordova-android': '>5.0.0' }
+            '1.0.0': {},
+            '1.1.0': { 'cordova-android': '>5.0.0' }
         };
 
         var after = getWarningCheckCallback(done, [
@@ -293,7 +292,7 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 009 : should ignore an empty cordovaDependencies entry', function(done) {
+    it('Test 009 : should ignore an empty cordovaDependencies entry', function (done) {
         var testEngine = {};
 
         var after = getWarningCheckCallback(done, []);
@@ -302,9 +301,9 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 010 : should ignore a badly formatted semver range', function(done) {
+    it('Test 010 : should ignore a badly formatted semver range', function (done) {
         var testEngine = {
-            '1.1.3' : { 'cordova-android': 'badSemverRange' }
+            '1.1.3': { 'cordova-android': 'badSemverRange' }
         };
 
         var after = getWarningCheckCallback(done, []);
@@ -313,11 +312,11 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 011 : should respect unreleased versions in constraints', function(done) {
+    it('Test 011 : should respect unreleased versions in constraints', function (done) {
         var testEngine = {
-            '1.0.0' : { 'cordova-android': '3.1.0' },
-            '1.1.2' : { 'cordova-android': '6.1.1' },
-            '1.3.0' : { 'cordova-android': '6.1.1' }
+            '1.0.0': { 'cordova-android': '3.1.0' },
+            '1.1.2': { 'cordova-android': '6.1.1' },
+            '1.3.0': { 'cordova-android': '6.1.1' }
         };
 
         var after = getWarningCheckCallback(done, [
@@ -328,11 +327,11 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 012 : should respect plugin constraints', function(done) {
+    it('Test 012 : should respect plugin constraints', function (done) {
         var testEngine = {
-            '0.0.0' : { 'ca.filmaj.AndroidPlugin': '1.2.0' },
-            '1.1.3' : { 'ca.filmaj.AndroidPlugin': '<5.0.0 || >2.3.0' },
-            '2.3.0' : { 'ca.filmaj.AndroidPlugin': '6.1.1' }
+            '0.0.0': { 'ca.filmaj.AndroidPlugin': '1.2.0' },
+            '1.1.3': { 'ca.filmaj.AndroidPlugin': '<5.0.0 || >2.3.0' },
+            '2.3.0': { 'ca.filmaj.AndroidPlugin': '6.1.1' }
         };
 
         var after = getWarningCheckCallback(done, [
@@ -343,11 +342,11 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 013 : should respect cordova constraints', function(done) {
+    it('Test 013 : should respect cordova constraints', function (done) {
         var testEngine = {
-            '0.0.0' : { 'cordova': '>1.0.0' },
-            '1.1.3' : { 'cordova': '<3.0.0 || >4.0.0' },
-            '2.3.0' : { 'cordova': '6.1.1' }
+            '0.0.0': { 'cordova': '>1.0.0' },
+            '1.1.3': { 'cordova': '<3.0.0 || >4.0.0' },
+            '2.3.0': { 'cordova': '6.1.1' }
         };
 
         var after = getWarningCheckCallback(done, [
@@ -358,10 +357,10 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 014 : should not include pre-release versions', function(done) {
+    it('Test 014 : should not include pre-release versions', function (done) {
         var testEngine = {
-            '0.0.0' : {},
-            '2.0.0' : { 'cordova-android': '>5.0.0' }
+            '0.0.0': {},
+            '2.0.0': { 'cordova-android': '>5.0.0' }
         };
 
         var after = getWarningCheckCallback(done, [
@@ -373,42 +372,42 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 015 : should not fail if there is no engine in the npm info', function(done) {
+    it('Test 015 : should not fail if there is no engine in the npm info', function (done) {
         plugin.getFetchVersion(project, {
-                version: '2.3.0',
-                name: 'test-plugin',
-                versions: testPluginVersions
-            }, cordovaVersion)
-        .then(function(toFetch) {
+            version: '2.3.0',
+            name: 'test-plugin',
+            versions: testPluginVersions
+        }, cordovaVersion)
+        .then(function (toFetch) {
             expect(toFetch).toBe(null);
         })
         .fail(getVersionErrorCallback).fin(done);
     });
 
-    it('Test 016 : should not fail if there is no cordovaDependencies in the engines', function(done) {
+    it('Test 016 : should not fail if there is no cordovaDependencies in the engines', function (done) {
         var after = getWarningCheckCallback(done, []);
 
         plugin.getFetchVersion(project, {
-                version: '2.3.0',
-                name: 'test-plugin',
-                versions: testPluginVersions,
-                engines: {
-                    'node': '>7.0.0',
-                    'npm': '~2.0.0'
-                }
-            }, cordovaVersion)
-        .then(function(toFetch) {
+            version: '2.3.0',
+            name: 'test-plugin',
+            versions: testPluginVersions,
+            engines: {
+                'node': '>7.0.0',
+                'npm': '~2.0.0'
+            }
+        }, cordovaVersion)
+        .then(function (toFetch) {
             expect(toFetch).toBe(null);
         })
         .fail(getVersionErrorCallback).fin(after);
 
     });
 
-    it('Test 017 : should handle extra whitespace', function(done) {
+    it('Test 017 : should handle extra whitespace', function (done) {
         var testEngine = {
-            '  1.0.0    '   : {},
-            '2.0.0   '      : { ' cordova-android': '~5.0.0   ' },
-            ' <  1.0.0\t'   : { ' cordova-android  ': ' > 5.0.0' }
+            '  1.0.0    ': {},
+            '2.0.0   ': { ' cordova-android': '~5.0.0   ' },
+            ' <  1.0.0\t': { ' cordova-android  ': ' > 5.0.0' }
         };
 
         var after = getWarningCheckCallback(done, [
@@ -419,11 +418,11 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 018 : should ignore badly typed version requirement entries', function(done) {
+    it('Test 018 : should ignore badly typed version requirement entries', function (done) {
         var testEngine = {
-            '1.1.0' : ['cordova', '5.0.0'],
-            '1.3.0' : undefined,
-            '1.7.0' : null
+            '1.1.0': ['cordova', '5.0.0'],
+            '1.3.0': undefined,
+            '1.7.0': null
         };
 
         var after = getWarningCheckCallback(done, []);
@@ -432,14 +431,14 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 019 : should ignore badly typed constraint entries', function(done) {
+    it('Test 019 : should ignore badly typed constraint entries', function (done) {
         var testEngine = {
-            '0.0.2' : { 'cordova': 1 },
-            '0.7.0' : { 'cordova': {}},
-            '1.0.0' : { 'cordova': undefined},
-            '1.1.3' : { 8        : '5.0.0'},
-            '1.3.0' : { 'cordova': [] },
-            '1.7.1' : { 'cordova': null }
+            '0.0.2': { 'cordova': 1 },
+            '0.7.0': { 'cordova': {}},
+            '1.0.0': { 'cordova': undefined},
+            '1.1.3': { 8: '5.0.0'},
+            '1.3.0': { 'cordova': [] },
+            '1.7.1': { 'cordova': null }
         };
 
         var after = getWarningCheckCallback(done, []);
@@ -448,14 +447,14 @@ describe('plugin fetching version selection', function() {
 
     });
 
-    it('Test 020 : should ignore bad semver versions', function(done) {
+    it('Test 020 : should ignore bad semver versions', function (done) {
         var testEngine = {
-            '0.0.0'         : { 'cordova-android': '5.0.0' },
-            'notAVersion'   : { 'cordova-android': '3.1.0' },
-            '^1.1.2'        : { 'cordova-android': '3.1.0' },
-            '<=1.3.0'       : { 'cordova-android': '3.1.0' },
-            '1.0'           : { 'cordova-android': '3.1.0' },
-            '2'               : { 'cordova-android': '3.1.0' }
+            '0.0.0': { 'cordova-android': '5.0.0' },
+            'notAVersion': { 'cordova-android': '3.1.0' },
+            '^1.1.2': { 'cordova-android': '3.1.0' },
+            '<=1.3.0': { 'cordova-android': '3.1.0' },
+            '1.0': { 'cordova-android': '3.1.0' },
+            '2': { 'cordova-android': '3.1.0' }
         };
 
         var after = getWarningCheckCallback(done, [
@@ -465,15 +464,15 @@ describe('plugin fetching version selection', function() {
         testEngineWithProject(after, testEngine, null);
     });
 
-    it('Test 021 : should not fail if there are bad semver versions', function(done) {
+    it('Test 021 : should not fail if there are bad semver versions', function (done) {
         var testEngine = {
-            'notAVersion'   : { 'cordova-android': '3.1.0' },
-            '^1.1.2'        : { 'cordova-android': '3.1.0' },
-            '<=1.3.0'       : { 'cordova-android': '3.1.0' },
-            '1.0.0'         : { 'cordova-android': '~3'    },   // Good semver
-            '2.0.0'         : { 'cordova-android': '5.1.0' },   // Good semver
-            '1.0'           : { 'cordova-android': '3.1.0' },
-            '2'               : { 'cordova-android': '3.1.0' }
+            'notAVersion': { 'cordova-android': '3.1.0' },
+            '^1.1.2': { 'cordova-android': '3.1.0' },
+            '<=1.3.0': { 'cordova-android': '3.1.0' },
+            '1.0.0': { 'cordova-android': '~3' },   // Good semver
+            '2.0.0': { 'cordova-android': '5.1.0' },   // Good semver
+            '1.0': { 'cordova-android': '3.1.0' },
+            '2': { 'cordova-android': '3.1.0' }
         };
 
         var after = getWarningCheckCallback(done, [
@@ -483,12 +482,12 @@ describe('plugin fetching version selection', function() {
         testEngineWithProject(after, testEngine, '1.7.1');
     });
 
-    it('Test 022 : should properly warn about multiple unmet requirements', function(done) {
+    it('Test 022 : should properly warn about multiple unmet requirements', function (done) {
         var testEngine = {
-            '1.7.0' : {
-                'cordova-android'           : '>5.1.0',
-                'ca.filmaj.AndroidPlugin'   : '3.1.0',
-                'cordova'                   : '3.4.2'
+            '1.7.0': {
+                'cordova-android': '>5.1.0',
+                'ca.filmaj.AndroidPlugin': '3.1.0',
+                'cordova': '3.4.2'
             }
         };
 
@@ -500,12 +499,12 @@ describe('plugin fetching version selection', function() {
         testEngineWithProject(after, testEngine, '1.3.0');
     });
 
-    it('Test 023 : should properly warn about both unmet latest and upper bound requirements', function(done) {
+    it('Test 023 : should properly warn about both unmet latest and upper bound requirements', function (done) {
         var testEngine = {
-            '1.7.0' : { 'cordova-android': '>5.1.0' },
+            '1.7.0': { 'cordova-android': '>5.1.0' },
             '<5.0.0': {
-                'cordova-android'           : '>7.1.0',
-                'ca.filmaj.AndroidPlugin'   : '3.1.0'
+                'cordova-android': '>7.1.0',
+                'ca.filmaj.AndroidPlugin': '3.1.0'
             }
         };
 
@@ -517,12 +516,12 @@ describe('plugin fetching version selection', function() {
         testEngineWithProject(after, testEngine, null);
     });
 
-    it('Test 024 : should not warn about versions past latest', function(done) {
+    it('Test 024 : should not warn about versions past latest', function (done) {
         var testEngine = {
-            '1.7.0' : { 'cordova-android': '>5.1.0' },
+            '1.7.0': { 'cordova-android': '>5.1.0' },
             '7.0.0': {
-                'cordova-android'           : '>7.1.0',
-                'ca.filmaj.AndroidPlugin'   : '3.1.0'
+                'cordova-android': '>7.1.0',
+                'ca.filmaj.AndroidPlugin': '3.1.0'
             }
         };
 
@@ -533,7 +532,7 @@ describe('plugin fetching version selection', function() {
         testEngineWithProject(after, testEngine, '1.3.0');
     });
 
-    it('Test 025 : clean up after plugin fetch spec', function() {
+    it('Test 025 : clean up after plugin fetch spec', function () {
         removeTestProject();
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/integration-tests/plugman_fetch.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/plugman_fetch.spec.js b/integration-tests/plugman_fetch.spec.js
index 3896db1..a12a072 100644
--- a/integration-tests/plugman_fetch.spec.js
+++ b/integration-tests/plugman_fetch.spec.js
@@ -16,33 +16,33 @@
     specific language governing permissions and limitations
     under the License.
 */
-var rewire  = require('rewire'),
-    fetch   = rewire('../src/plugman/fetch'),
-    fs      = require('fs'),
-    os      = require('os'),
-    path    = require('path'),
-    shell   = require('shelljs'),
-    realrm  = shell.rm,
+var rewire = require('rewire'),
+    fetch = rewire('../src/plugman/fetch'),
+    fs = require('fs'),
+    os = require('os'),
+    path = require('path'),
+    shell = require('shelljs'),
+    realrm = shell.rm,
     TIMEOUT = 60 * 1000,
-    //xml_helpers = require('../src/util/xml-helpers'),
+    // xml_helpers = require('../src/util/xml-helpers'),
     metadata = require('../src/plugman/util/metadata'),
-    temp    = path.join(os.tmpdir(), 'plugman', 'fetch');
+    temp = path.join(os.tmpdir(), 'plugman', 'fetch');
 var plugins_dir = path.join(__dirname, '..', 'spec', 'plugman', 'plugins'),
     test_plugin = path.join(plugins_dir, 'org.test.plugins.childbrowser'),
     test_pkgjson_plugin = path.join(plugins_dir, 'pkgjson-test-plugin'),
     test_plugin_searchpath = path.join(test_plugin, '..'),
-    //test_plugin_with_space = path.join(__dirname, 'folder with space', 'plugins', 'org.test.plugins.childbrowser'),
-    //test_plugin_xml = xml_helpers.parseElementtreeSync(path.join(test_plugin, 'plugin.xml')),
+    // test_plugin_with_space = path.join(__dirname, 'folder with space', 'plugins', 'org.test.plugins.childbrowser'),
+    // test_plugin_xml = xml_helpers.parseElementtreeSync(path.join(test_plugin, 'plugin.xml')),
     test_plugin_id = 'org.test.plugins.childbrowser',
-    test_plugin_version ='0.6.0',
+    test_plugin_version = '0.6.0',
     plugins = require('../src/plugman/util/plugins'),
     Q = require('q'),
     registry = require('../src/plugman/registry/registry');
 
-describe('fetch', function() {
+describe('fetch', function () {
 
-    function wrapper(p, done, post) {
-        p.then(post, function(err) {
+    function wrapper (p, done, post) {
+        p.then(post, function (err) {
             expect(err).toBeUndefined('Unexpected exception' + err.stack);
         }).fin(done);
     }
@@ -62,230 +62,229 @@ describe('fetch', function() {
         });
     });
 */
-    describe('local plugins', function() {
+    describe('local plugins', function () {
         var rm, sym, cp, save_metadata, revertLocal, revertFetch, fetchCalls = 0;
-        beforeEach(function() {
+        beforeEach(function () {
             rm = spyOn(shell, 'rm');
             sym = spyOn(fs, 'symlinkSync');
             cp = spyOn(shell, 'cp').and.callThrough();
             save_metadata = spyOn(metadata, 'save_fetch_metadata');
             realrm('-rf', temp);
             revertLocal = fetch.__set__('localPlugins', null);
-            revertFetch = fetch.__set__('fetch', function(pluginDir) {
-                fetchCalls ++;
+            revertFetch = fetch.__set__('fetch', function (pluginDir) {
+                fetchCalls++;
                 return Q(pluginDir);
             });
         });
 
-        afterEach(function(){
+        afterEach(function () {
             revertLocal();
             revertFetch();
             fetchCalls = 0;
         });
 
-        it('Test 001 : should copy locally-available plugin to plugins directory', function(done) {
-            wrapper(fetch(test_plugin, temp), done, function() {
+        it('Test 001 : should copy locally-available plugin to plugins directory', function (done) {
+            wrapper(fetch(test_plugin, temp), done, function () {
                 expect(cp).toHaveBeenCalledWith('-R', path.join(test_plugin, '*'), path.join(temp, test_plugin_id));
             });
         });
-        it('Test 002 : should copy locally-available plugin to plugins directory when adding a plugin with searchpath argument', function(done) {
-            wrapper(fetch(test_plugin_id, temp, { searchpath: test_plugin_searchpath }), done, function() {
+        it('Test 002 : should copy locally-available plugin to plugins directory when adding a plugin with searchpath argument', function (done) {
+            wrapper(fetch(test_plugin_id, temp, { searchpath: test_plugin_searchpath }), done, function () {
                 expect(cp).toHaveBeenCalledWith('-R', path.join(test_plugin, '*'), path.join(temp, test_plugin_id));
             });
         });
-        it('Test 003 : should create a symlink if used with `link` param', function(done) {
-            wrapper(fetch(test_plugin, temp, { link: true }), done, function() {
+        it('Test 003 : should create a symlink if used with `link` param', function (done) {
+            wrapper(fetch(test_plugin, temp, { link: true }), done, function () {
                 expect(sym).toHaveBeenCalledWith(test_plugin, path.join(temp, test_plugin_id), 'dir');
             });
         });
 
-        it('Test 004 : should fail when the expected ID doesn\'t match', function(done) {
+        it('Test 004 : should fail when the expected ID doesn\'t match', function (done) {
             fetch(test_plugin, temp, { expected_id: 'wrongID' })
-            .then(function() {
+            .then(function () {
                 expect('this call').toBe('fail');
-            }, function(err) {
-                expect(''+err).toContain('Expected plugin to have ID "wrongID" but got');
+            }, function (err) {
+                expect('' + err).toContain('Expected plugin to have ID "wrongID" but got');
             }).fin(done);
         });
 
-        it('Test 005 : should succeed when the expected ID is correct', function(done) {
-            wrapper(fetch(test_plugin, temp, { expected_id: test_plugin_id }), done, function() {
+        it('Test 005 : should succeed when the expected ID is correct', function (done) {
+            wrapper(fetch(test_plugin, temp, { expected_id: test_plugin_id }), done, function () {
                 expect(1).toBe(1);
             });
         });
-        it('Test 006 : should fail when the expected ID with version specified doesn\'t match', function(done) {
+        it('Test 006 : should fail when the expected ID with version specified doesn\'t match', function (done) {
             fetch(test_plugin, temp, { expected_id: test_plugin_id + '@wrongVersion' })
-            .then(function() {
+            .then(function () {
                 expect('this call').toBe('fail');
-            }, function(err) {
-                expect(''+err).toContain('to satisfy version "wrongVersion" but got');
+            }, function (err) {
+                expect('' + err).toContain('to satisfy version "wrongVersion" but got');
             }).fin(done);
         });
-        it('Test 007 : should succeed when the plugin version specified is correct', function(done) {
+        it('Test 007 : should succeed when the plugin version specified is correct', function (done) {
             var exp_id = test_plugin_id + '@' + test_plugin_version;
-            wrapper(fetch(test_plugin, temp, { expected_id: exp_id}), done, function() {
+            wrapper(fetch(test_plugin, temp, { expected_id: exp_id}), done, function () {
                 expect(1).toBe(1);
             });
         });
-        it('Test 027 : should copy locally-available plugin to plugins directory', function(done) {
-            wrapper(fetch(test_pkgjson_plugin, temp, {fetch:true}), done, function() {
+        it('Test 027 : should copy locally-available plugin to plugins directory', function (done) {
+            wrapper(fetch(test_pkgjson_plugin, temp, {fetch: true}), done, function () {
                 expect(cp).toHaveBeenCalledWith('-R', path.join(test_pkgjson_plugin, '*'), path.join(temp, 'pkgjson-test-plugin'));
                 expect(fetchCalls).toBe(1);
             });
         });
-        it('Test 028 : should fail when locally-available plugin is missing pacakge.json', function(done) {
-            fetch(test_plugin, temp, {fetch:true})
-            .then(function() {
+        it('Test 028 : should fail when locally-available plugin is missing pacakge.json', function (done) {
+            fetch(test_plugin, temp, {fetch: true})
+            .then(function () {
                 expect(false).toBe(true);
-            }).fail(function(err) { 
+            }).fail(function (err) {
                 expect(err).toBeDefined();
                 expect(err.message).toContain('needs a valid package.json');
                 done();
             });
         });
     });
-    describe('git plugins', function() {
+    describe('git plugins', function () {
         var clone, save_metadata, done;
 
-        beforeEach(function() {
+        beforeEach(function () {
             clone = spyOn(plugins, 'clonePluginGitRepo').and.returnValue(Q(test_plugin));
             save_metadata = spyOn(metadata, 'save_fetch_metadata');
             done = false;
         });
-        it('Test 008 : should call clonePluginGitRepo for https:// and git:// based urls', function(done) {
+        it('Test 008 : should call clonePluginGitRepo for https:// and git:// based urls', function (done) {
             var url = 'https://github.com/bobeast/GAPlugin.git';
-                fetch(url, temp).then(function(){
-                    expect(save_metadata).toHaveBeenCalled();
-                    expect(clone).toHaveBeenCalledWith(url, temp, '.', undefined, undefined);
-                    done();
+            fetch(url, temp).then(function () {
+                expect(save_metadata).toHaveBeenCalled();
+                expect(clone).toHaveBeenCalledWith(url, temp, '.', undefined, undefined);
+                done();
             });
         }, 6000);
-        
-        it('Test 009 : should call clonePluginGitRepo with subdir if applicable', function(done) {
+
+        it('Test 009 : should call clonePluginGitRepo with subdir if applicable', function (done) {
             var url = 'https://github.com/bobeast/GAPlugin.git';
             var dir = 'fakeSubDir';
-            fetch(url, temp, { subdir: dir }).then(function(){
+            fetch(url, temp, { subdir: dir }).then(function () {
                 expect(clone).toHaveBeenCalledWith(url, temp, dir, undefined, undefined);
                 expect(save_metadata).toHaveBeenCalled();
                 done();
             });
         }, 6000);
 
-        it('Test 010 : should call clonePluginGitRepo with subdir and git ref if applicable', function(done) {
+        it('Test 010 : should call clonePluginGitRepo with subdir and git ref if applicable', function (done) {
             var url = 'https://github.com/bobeast/GAPlugin.git';
             var dir = 'fakeSubDir';
             var ref = 'fakeGitRef';
-            fetch(url, temp, { subdir: dir, git_ref: ref }).then(function(){
+            fetch(url, temp, { subdir: dir, git_ref: ref }).then(function () {
                 expect(clone).toHaveBeenCalledWith(url, temp, dir, ref, undefined);
                 expect(save_metadata).toHaveBeenCalled();
                 done();
             });
         }, 6000);
 
-        it('Test 011 : should extract the git ref from the URL hash, if provided', function(done) {
+        it('Test 011 : should extract the git ref from the URL hash, if provided', function (done) {
             var url = 'https://github.com/bobeast/GAPlugin.git#fakeGitRef';
             var baseURL = 'https://github.com/bobeast/GAPlugin.git';
-            fetch(url, temp, {}).then(function(){
+            fetch(url, temp, {}).then(function () {
                 expect(clone).toHaveBeenCalledWith(baseURL, temp, '.', 'fakeGitRef', undefined);
                 expect(save_metadata).toHaveBeenCalled();
                 done();
             });
         }, 6000);
 
-        it('Test 012 : should extract the subdir from the URL hash, if provided', function(done) {
+        it('Test 012 : should extract the subdir from the URL hash, if provided', function (done) {
             var url = 'https://github.com/bobeast/GAPlugin.git#:fakeSubDir';
             var baseURL = 'https://github.com/bobeast/GAPlugin.git';
-            fetch(url, temp, {}).then(function(result){
+            fetch(url, temp, {}).then(function (result) {
                 expect(clone).toHaveBeenCalledWith(baseURL, temp, 'fakeSubDir', undefined, undefined);
                 expect(save_metadata).toHaveBeenCalled();
                 done();
             });
         }, 6000);
 
-        it('Test 013 : should extract the git ref and subdir from the URL hash, if provided', function(done) {
+        it('Test 013 : should extract the git ref and subdir from the URL hash, if provided', function (done) {
             var url = 'https://github.com/bobeast/GAPlugin.git#fakeGitRef:/fake/Sub/Dir/';
             var baseURL = 'https://github.com/bobeast/GAPlugin.git';
-            fetch(url, temp, {}).then(function(result){
+            fetch(url, temp, {}).then(function (result) {
                 expect(clone).toHaveBeenCalledWith(baseURL, temp, 'fake/Sub/Dir', 'fakeGitRef', undefined);
                 expect(save_metadata).toHaveBeenCalled();
                 done();
             });
         }, 6000);
 
-        it('Test 014 : should fail when the expected ID doesn\'t match', function(done) {
+        it('Test 014 : should fail when the expected ID doesn\'t match', function (done) {
             fetch('https://github.com/bobeast/GAPlugin.git', temp, { expected_id: 'wrongID' })
-            .then(function() {
+            .then(function () {
                 expect('this call').toBe('fail');
-            }, function(err) {
-                expect(''+err).toContain('Expected plugin to have ID "wrongID" but got');
+            }, function (err) {
+                expect('' + err).toContain('Expected plugin to have ID "wrongID" but got');
             }).fin(done);
         });
 
-        it('Test 015 : should fail when the expected ID with version specified doesn\'t match', function(done) {
+        it('Test 015 : should fail when the expected ID with version specified doesn\'t match', function (done) {
             fetch('https://github.com/bobeast/GAPlugin.git', temp, { expected_id: 'id@wrongVersion' })
-            .then(function() {
+            .then(function () {
                 expect('this call').toBe('fail');
-            }, function(err) {
-                expect(''+err).toContain('Expected plugin to have ID "id" but got');
+            }, function (err) {
+                expect('' + err).toContain('Expected plugin to have ID "id" but got');
             }).fin(done);
         });
 
-        it('Test 016 : should succeed when the expected ID is correct', function(done) {
-            wrapper(fetch('https://github.com/bobeast/GAPlugin.git', temp, { expected_id: test_plugin_id }), done, function() {
+        it('Test 016 : should succeed when the expected ID is correct', function (done) {
+            wrapper(fetch('https://github.com/bobeast/GAPlugin.git', temp, { expected_id: test_plugin_id }), done, function () {
                 expect(1).toBe(1);
             });
         });
     });
 
-    describe('github plugins', function() {
+    describe('github plugins', function () {
         // these tests actually pull a plugin from github
-        beforeEach(function(){
-            realrm('-rf',temp);
+        beforeEach(function () {
+            realrm('-rf', temp);
         });
 
         // this commit uses the new id
-        it('Test 017 : should fetch from a commit-sha', function(done) {
-            wrapper(fetch('http://github.com/apache/cordova-plugin-device.git#ad5f1e7bfd05ef98c01df549a0fa98036a5625db', temp, { expected_id: 'cordova-plugin-device' }), done, function() {
+        it('Test 017 : should fetch from a commit-sha', function (done) {
+            wrapper(fetch('http://github.com/apache/cordova-plugin-device.git#ad5f1e7bfd05ef98c01df549a0fa98036a5625db', temp, { expected_id: 'cordova-plugin-device' }), done, function () {
                 expect(1).toBe(1);
                 done();
             });
         }, TIMEOUT);
         // this branch uses the old id
-        it('Test 018 : should fetch from a branch', function(done) {
-            wrapper(fetch('http://github.com/apache/cordova-plugin-device.git#cdvtest', temp, { expected_id: 'org.apache.cordova.device' }), done, function() {
+        it('Test 018 : should fetch from a branch', function (done) {
+            wrapper(fetch('http://github.com/apache/cordova-plugin-device.git#cdvtest', temp, { expected_id: 'org.apache.cordova.device' }), done, function () {
                 expect(1).toBe(1);
                 done();
             });
         }, TIMEOUT);
         // this tag uses the new id
-        it('Test 019 : should fetch from a tag', function(done) {
-            wrapper(fetch('http://github.com/apache/cordova-plugin-device.git#r1.0.0', temp, { expected_id: 'cordova-plugin-device' }), done, function() {
+        it('Test 019 : should fetch from a tag', function (done) {
+            wrapper(fetch('http://github.com/apache/cordova-plugin-device.git#r1.0.0', temp, { expected_id: 'cordova-plugin-device' }), done, function () {
                 expect(1).toBe(1);
                 done();
             });
         }, TIMEOUT);
     });
 
-    describe('fetch recursive error CB-8809', function(){
+    describe('fetch recursive error CB-8809', function () {
 
         var srcDir = path.join(plugins_dir, 'recursivePlug');
         var appDir = path.join(plugins_dir, 'recursivePlug', 'demo');
 
-        if(/^win/.test(process.platform)) {
-            it('Test 020 : should copy all but the /demo/ folder',function(done) {
+        if (/^win/.test(process.platform)) {
+            it('Test 020 : should copy all but the /demo/ folder', function (done) {
                 var cp = spyOn(shell, 'cp');
-                wrapper(fetch(srcDir, appDir),done, function() {
-                    expect(cp).toHaveBeenCalledWith('-R',path.join(srcDir,'asset.txt'),path.join(appDir,'test-recursive'));
-                    expect(cp).not.toHaveBeenCalledWith('-R',srcDir,path.join(appDir,'test-recursive'));
+                wrapper(fetch(srcDir, appDir), done, function () {
+                    expect(cp).toHaveBeenCalledWith('-R', path.join(srcDir, 'asset.txt'), path.join(appDir, 'test-recursive'));
+                    expect(cp).not.toHaveBeenCalledWith('-R', srcDir, path.join(appDir, 'test-recursive'));
                 });
             });
-        }
-        else {
-            it('Test 021 : should skip copy to avoid recursive error', function(done) {
+        } else {
+            it('Test 021 : should skip copy to avoid recursive error', function (done) {
 
-                var cp = spyOn(shell, 'cp').and.callFake(function(){});
+                var cp = spyOn(shell, 'cp').and.callFake(function () {});
 
-                wrapper(fetch(srcDir, appDir),done, function() {
+                wrapper(fetch(srcDir, appDir), done, function () {
                     expect(cp).not.toHaveBeenCalled();
                 });
             });
@@ -293,10 +292,10 @@ describe('fetch', function() {
 
     });
 
-    describe('registry plugins', function() {
+    describe('registry plugins', function () {
         var pluginId = 'dummyplugin', sFetch;
         var rm, sym, save_metadata;
-        beforeEach(function() {
+        beforeEach(function () {
             rm = spyOn(shell, 'rm');
             sym = spyOn(fs, 'symlinkSync');
             save_metadata = spyOn(metadata, 'save_fetch_metadata');
@@ -304,35 +303,35 @@ describe('fetch', function() {
             realrm('-rf', temp);
         });
 
-        it('Test 022 : should fail when the expected ID with version specified doesn\'t match', function(done) {
-            //fetch(pluginId, temp, { expected_id: test_plugin_id + '@wrongVersion' })
+        it('Test 022 : should fail when the expected ID with version specified doesn\'t match', function (done) {
+            // fetch(pluginId, temp, { expected_id: test_plugin_id + '@wrongVersion' })
             fetch(pluginId, temp, { expected_id: 'wrongID' })
-            .then(function() {
+            .then(function () {
                 expect('this call').toBe('fail');
-            }, function(err) {
-                expect(''+err).toContain('Expected plugin to have ID "wrongID" but got');
+            }, function (err) {
+                expect('' + err).toContain('Expected plugin to have ID "wrongID" but got');
             }).fin(done);
         });
-        
-        it('Test 023 : should succeed when the expected ID is correct', function(done) {
-            wrapper(fetch(pluginId, temp, { expected_id: test_plugin_id }), done, function() {
+
+        it('Test 023 : should succeed when the expected ID is correct', function (done) {
+            wrapper(fetch(pluginId, temp, { expected_id: test_plugin_id }), done, function () {
                 expect(1).toBe(1);
             });
         });
-        it('Test 024 : should succeed when the plugin version specified is correct', function(done) {
-            wrapper(fetch(pluginId, temp, { expected_id: test_plugin_id + '@' + test_plugin_version }), done, function() {
+        it('Test 024 : should succeed when the plugin version specified is correct', function (done) {
+            wrapper(fetch(pluginId, temp, { expected_id: test_plugin_id + '@' + test_plugin_version }), done, function () {
                 expect(1).toBe(1);
             });
         });
-        it('Test 025 : should fetch plugins that are scoped packages', function(done) {
+        it('Test 025 : should fetch plugins that are scoped packages', function (done) {
             var scopedPackage = '@testcope/dummy-plugin';
-            wrapper(fetch(scopedPackage, temp, { expected_id: test_plugin_id }), done, function() {
+            wrapper(fetch(scopedPackage, temp, { expected_id: test_plugin_id }), done, function () {
                 expect(sFetch).toHaveBeenCalledWith([scopedPackage]);
             });
         });
-        it('Test 026 : should fetch plugins that are scoped packages and have versions specified', function(done) {
+        it('Test 026 : should fetch plugins that are scoped packages and have versions specified', function (done) {
             var scopedPackage = '@testcope/dummy-plugin@latest';
-            wrapper(fetch(scopedPackage, temp, { expected_id: test_plugin_id }), done, function() {
+            wrapper(fetch(scopedPackage, temp, { expected_id: test_plugin_id }), done, function () {
                 expect(sFetch).toHaveBeenCalledWith([scopedPackage]);
             });
         });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/integration-tests/plugman_uninstall.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/plugman_uninstall.spec.js b/integration-tests/plugman_uninstall.spec.js
index 4755929..7d1b73a 100644
--- a/integration-tests/plugman_uninstall.spec.js
+++ b/integration-tests/plugman_uninstall.spec.js
@@ -24,16 +24,16 @@ var uninstall = require('../src/plugman/uninstall'),
     actions = require('cordova-common').ActionStack,
     PluginInfo = require('cordova-common').PluginInfo,
     events = require('cordova-common').events,
-    common  = require('../spec/common'),
+    common = require('../spec/common'),
     platforms = require('../src/platforms/platforms'),
     xmlHelpers = require('cordova-common').xmlHelpers,
-    et      = require('elementtree'),
-    fs      = require('fs'),
-    path    = require('path'),
-    shell   = require('shelljs'),
-    Q       = require('q'),
-    spec    = path.join(__dirname, '..', 'spec', 'plugman'),
-    done    = false,
+    et = require('elementtree'),
+    fs = require('fs'),
+    path = require('path'),
+    shell = require('shelljs'),
+    Q = require('q'),
+    spec = path.join(__dirname, '..', 'spec', 'plugman'),
+    done = false,
     srcProject = path.join(spec, 'projects', 'android'),
     project = path.join(spec, 'projects', 'android_uninstall.test'),
     project2 = path.join(spec, 'projects', 'android_uninstall.test2'),
@@ -45,9 +45,9 @@ var uninstall = require('../src/plugman/uninstall'),
     plugins_install_dir3 = path.join(project3, 'cordova', 'plugins'),
 
     plugins = {
-        'org.test.plugins.dummyplugin' : path.join(plugins_dir, 'org.test.plugins.dummyplugin'),
-        'A' : path.join(plugins_dir, 'dependencies', 'A'),
-        'C' : path.join(plugins_dir, 'dependencies', 'C')
+        'org.test.plugins.dummyplugin': path.join(plugins_dir, 'org.test.plugins.dummyplugin'),
+        'A': path.join(plugins_dir, 'dependencies', 'A'),
+        'C': path.join(plugins_dir, 'dependencies', 'C')
     },
     dummy_id = 'org.test.plugins.dummyplugin';
 
@@ -69,60 +69,60 @@ var TEST_XML = '<?xml version="1.0" encoding="UTF-8"?>\n' +
     '    <access origin="*" />\n' +
     '</widget>\n';
 
-describe('plugman uninstall start', function() {
+describe('plugman uninstall start', function () {
     beforeEach(function () {
         var origParseElementtreeSync = xmlHelpers.parseElementtreeSync.bind(xmlHelpers);
-        spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function(path) {
+        spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function (path) {
             if (/config.xml$/.test(path)) return new et.ElementTree(et.XML(TEST_XML));
             return origParseElementtreeSync(path);
         });
     });
 
-    it('Test 001 : plugman uninstall start', function(done) {
+    it('Test 001 : plugman uninstall start', function (done) {
         shell.rm('-rf', project, project2, project3);
         shell.cp('-R', path.join(srcProject, '*'), project);
         shell.cp('-R', path.join(srcProject, '*'), project2);
         shell.cp('-R', path.join(srcProject, '*'), project3);
 
         return install('android', project, plugins['org.test.plugins.dummyplugin'])
-        .then(function(result){
+        .then(function (result) {
             return install('android', project, plugins['A']);
-        }).then( function(){
+        }).then(function () {
             return install('android', project2, plugins['C']);
-        }).then(function(){
+        }).then(function () {
             return install('android', project2, plugins['A']);
-        }).then(function(){
+        }).then(function () {
             return install('android', project3, plugins['A']);
-        }).then(function(){
+        }).then(function () {
             return install('android', project3, plugins['C']);
-        }).then(function(result){
+        }).then(function (result) {
             expect(result).toEqual(true);
             done();
-        }).fail(function(err){
+        }).fail(function (err) {
             expect(err).toBeUndefined();
         });
     }, 60000);
 });
 
-describe('uninstallPlatform', function() {
+describe('uninstallPlatform', function () {
     var proc, rm;
     var fsWrite;
 
-    beforeEach(function() {
+    beforeEach(function () {
         proc = spyOn(actions.prototype, 'process').and.returnValue(Q());
         fsWrite = spyOn(fs, 'writeFileSync').and.returnValue(true);
         rm = spyOn(shell, 'rm').and.returnValue(true);
         spyOn(shell, 'cp').and.returnValue(true);
         done = false;
     });
-    describe('success', function() {
+    describe('success', function () {
 
-        it('Test 002 : should get PlatformApi instance for platform and invoke its\' removePlugin method', function(done) {
+        it('Test 002 : should get PlatformApi instance for platform and invoke its\' removePlugin method', function (done) {
             var platformApi = { removePlugin: jasmine.createSpy('removePlugin').and.returnValue(Q()) };
             var getPlatformApi = spyOn(platforms, 'getPlatformApi').and.returnValue(platformApi);
 
             uninstall.uninstallPlatform('android', project, dummy_id)
-            .then(function() {
+            .then(function () {
                 expect(getPlatformApi).toHaveBeenCalledWith('android', project);
                 expect(platformApi.removePlugin).toHaveBeenCalled();
                 done();
@@ -132,7 +132,7 @@ describe('uninstallPlatform', function() {
             });
         }, 6000);
 
-        it('Test 003 : should return propagate value returned by PlatformApi removePlugin method', function(done) {
+        it('Test 003 : should return propagate value returned by PlatformApi removePlugin method', function (done) {
             var platformApi = { removePlugin: jasmine.createSpy('removePlugin') };
             spyOn(platforms, 'getPlatformApi').and.returnValue(platformApi);
 
@@ -145,7 +145,7 @@ describe('uninstallPlatform', function() {
             var fakeProvider = jasmine.createSpyObj('fakeProvider', ['get']);
             fakeProvider.get.and.returnValue(dummyPluginInfo);
 
-            function validateReturnedResultFor(values, expectedResult) {
+            function validateReturnedResultFor (values, expectedResult) {
                 return values.reduce(function (promise, value) {
                     return promise
                     .then(function () {
@@ -153,38 +153,38 @@ describe('uninstallPlatform', function() {
                         return uninstall.uninstallPlatform('android', project, dummy_id, null,
                             { pluginInfoProvider: fakeProvider, platformVersion: '9.9.9' });
                     })
-                    .then(function(result) {
+                    .then(function (result) {
                         expect(!!result).toEqual(expectedResult);
-                    }, function(err) {
+                    }, function (err) {
                         expect(err).toBeUndefined();
                     });
                 }, Q());
             }
 
-            validateReturnedResultFor([ true, {}, [], 'foo', function(){} ], true)
+            validateReturnedResultFor([ true, {}, [], 'foo', function () {} ], true)
             .then(function () {
                 return validateReturnedResultFor([ false, null, undefined, '' ], false);
             })
             .fin(done);
         });
 
-        describe('with dependencies', function() {
+        describe('with dependencies', function () {
             var emit;
-            beforeEach(function() {
+            beforeEach(function () {
                 emit = spyOn(events, 'emit');
             });
             uninstall.uninstallPlatform('android', project, 'A')
-            .then(function(result) {
+            .then(function (result) {
                 expect(emit).toHaveBeenCalledWith('log', 'Uninstalling 2 dependent plugins.');
                 done();
             });
         });
     });
 
-    describe('failure ', function() {
-        it('Test 004 : should throw if platform is unrecognized', function(done) {
+    describe('failure ', function () {
+        it('Test 004 : should throw if platform is unrecognized', function (done) {
             uninstall.uninstallPlatform('atari', project, 'SomePlugin')
-            .then(function(result){
+            .then(function (result) {
                 expect(false).toBe(true);
                 done();
             }).fail(function err (errMsg) {
@@ -193,9 +193,9 @@ describe('uninstallPlatform', function() {
             });
         }, 6000);
 
-        it('Test 005 : should throw if plugin is missing', function(done) {
+        it('Test 005 : should throw if plugin is missing', function (done) {
             uninstall.uninstallPlatform('android', project, 'SomePluginThatDoesntExist')
-            .then(function(result){
+            .then(function (result) {
                 expect(false).toBe(true);
                 done();
             }).fail(function err (errMsg) {
@@ -206,21 +206,21 @@ describe('uninstallPlatform', function() {
     });
 });
 
-describe('uninstallPlugin', function() {
+describe('uninstallPlugin', function () {
     var rm, fsWrite, rmstack = [], emit;
 
-    beforeEach(function() {
+    beforeEach(function () {
         fsWrite = spyOn(fs, 'writeFileSync').and.returnValue(true);
-        rm = spyOn(shell, 'rm').and.callFake(function(f,p) { rmstack.push(p); return true; });
+        rm = spyOn(shell, 'rm').and.callFake(function (f, p) { rmstack.push(p); return true; });
         rmstack = [];
         emit = spyOn(events, 'emit');
         done = false;
     });
-    describe('with dependencies', function() {
+    describe('with dependencies', function () {
 
-        it('Test 006 : should delete all dependent plugins', function(done) {
+        it('Test 006 : should delete all dependent plugins', function (done) {
             uninstall.uninstallPlugin('A', plugins_install_dir)
-            .then(function(result) {
+            .then(function (result) {
                 var del = common.spy.getDeleted(emit);
                 expect(del).toEqual([
                     'Deleted "C"',
@@ -231,9 +231,9 @@ describe('uninstallPlugin', function() {
             });
         });
 
-        it('Test 007 : should fail if plugin is a required dependency', function(done) {
+        it('Test 007 : should fail if plugin is a required dependency', function (done) {
             uninstall.uninstallPlugin('C', plugins_install_dir)
-            .then(function(result){
+            .then(function (result) {
                 expect(false).toBe(true);
                 done();
             }).fail(function err (errMsg) {
@@ -242,18 +242,18 @@ describe('uninstallPlugin', function() {
             });
         }, 6000);
 
-        it('Test 008 : allow forcefully removing a plugin', function(done) {
-            uninstall.uninstallPlugin('C', plugins_install_dir, {force: true}) 
-            .then(function() {
+        it('Test 008 : allow forcefully removing a plugin', function (done) {
+            uninstall.uninstallPlugin('C', plugins_install_dir, {force: true})
+            .then(function () {
                 var del = common.spy.getDeleted(emit);
                 expect(del).toEqual(['Deleted "C"']);
                 done();
             });
         });
 
-        it('Test 009 : never remove top level plugins if they are a dependency', function(done) {
+        it('Test 009 : never remove top level plugins if they are a dependency', function (done) {
             uninstall.uninstallPlugin('A', plugins_install_dir2)
-            .then(function() {
+            .then(function () {
                 var del = common.spy.getDeleted(emit);
                 expect(del).toEqual([
                     'Deleted "D"',
@@ -263,9 +263,9 @@ describe('uninstallPlugin', function() {
             });
         });
 
-        it('Test 010 : should not remove dependent plugin if it was installed after as top-level', function(done) {
+        it('Test 010 : should not remove dependent plugin if it was installed after as top-level', function (done) {
             uninstall.uninstallPlugin('A', plugins_install_dir3)
-            .then(function() {
+            .then(function () {
                 var del = common.spy.getDeleted(emit);
                 expect(del).toEqual([
                     'Deleted "D"',
@@ -277,19 +277,19 @@ describe('uninstallPlugin', function() {
     });
 });
 
-describe('uninstall', function() {
+describe('uninstall', function () {
     var fsWrite, rm;
 
-    beforeEach(function() {
+    beforeEach(function () {
         fsWrite = spyOn(fs, 'writeFileSync').and.returnValue(true);
         rm = spyOn(shell, 'rm').and.returnValue(true);
         done = false;
     });
-    
-    describe('failure', function() {
-        it('Test 011 : should throw if platform is unrecognized', function(done) {
+
+    describe('failure', function () {
+        it('Test 011 : should throw if platform is unrecognized', function (done) {
             return uninstall('atari', project, 'SomePlugin')
-            .then(function(result){
+            .then(function (result) {
                 expect(false).toBe(true);
                 done();
             }).fail(function err (errMsg) {
@@ -298,9 +298,9 @@ describe('uninstall', function() {
             });
         }, 6000);
 
-        it('Test 012 : should throw if plugin is missing', function(done) {
+        it('Test 012 : should throw if plugin is missing', function (done) {
             uninstall('android', project, 'SomePluginThatDoesntExist')
-            .then(function(result){
+            .then(function (result) {
                 expect(false).toBe(true);
                 done();
             }).fail(function err (errMsg) {
@@ -311,20 +311,19 @@ describe('uninstall', function() {
     });
 });
 
-describe('end', function() {
-    it('Test 013 : end', function(done) {
+describe('end', function () {
+    it('Test 013 : end', function (done) {
         return uninstall('android', project, plugins['org.test.plugins.dummyplugin'])
-        .then(function(){
+        .then(function () {
             // Fails... A depends on
             return uninstall('android', project, plugins['C']);
-        }).fail(function(err) {
+        }).fail(function (err) {
             expect(err.stack).toMatch(/The plugin 'C' is required by \(A\), skipping uninstallation./);
-        }).then(function(){
+        }).then(function () {
             // dependencies on C,D ... should this only work with --recursive? prompt user..?
             return uninstall('android', project, plugins['A']);
-        }).fin(function(err){
-            if(err)
-                events.emit('error', err);
+        }).fin(function (err) {
+            if (err) { events.emit('error', err); }
             shell.rm('-rf', project, project2, project3);
             done();
         });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/common.js
----------------------------------------------------------------------
diff --git a/spec/common.js b/spec/common.js
index dd29539..3c1c45b 100644
--- a/spec/common.js
+++ b/spec/common.js
@@ -49,30 +49,26 @@ var common = {};
 
 module.exports = common = {
     spy: {
-        getInstall: function(emitSpy){
+        getInstall: function (emitSpy) {
             return common.spy.startsWith(emitSpy, 'Install start');
         },
 
-        getDeleted: function(emitSpy){
+        getDeleted: function (emitSpy) {
             return common.spy.startsWith(emitSpy, 'Deleted');
         },
 
-        startsWith: function(emitSpy, string)
-        {
+        startsWith: function (emitSpy, string) {
             var match = [];
-            emitSpy.calls.all().forEach(function(val, i) {
-                if(emitSpy.calls.argsFor(i)[1].substr(0, string.length) === string)
-                    match.push(emitSpy.calls.argsFor(i)[1]);
+            emitSpy.calls.all().forEach(function (val, i) {
+                if (emitSpy.calls.argsFor(i)[1].substr(0, string.length) === string) { match.push(emitSpy.calls.argsFor(i)[1]); }
             });
             return match;
         },
 
-        contains: function(emitSpy, string)
-        {
+        contains: function (emitSpy, string) {
             var match = [];
-            emitSpy.calls.all().forEach(function(val, i) {
-                if(emitSpy.calls.argsFor(i)[1].indexOf(string) >= 0)
-                    match.push(emitSpy.calls.argsFor(i)[1]);
+            emitSpy.calls.all().forEach(function (val, i) {
+                if (emitSpy.calls.argsFor(i)[1].indexOf(string) >= 0) { match.push(emitSpy.calls.argsFor(i)[1]); }
             });
             return match;
         }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/build.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/build.spec.js b/spec/cordova/build.spec.js
index 7c9e737..c7919b2 100644
--- a/spec/cordova/build.spec.js
+++ b/spec/cordova/build.spec.js
@@ -16,20 +16,23 @@
     specific language governing permissions and limitations
     under the License.
 */
-var cordova = require('../../src/cordova/cordova'),
-    platforms = require('../../src/platforms/platforms'),
-    HooksRunner = require('../../src/hooks/HooksRunner'),
-    Q = require('q'),
-    util = require('../../src/cordova/util');
+var cordova = require('../../src/cordova/cordova');
+var platforms = require('../../src/platforms/platforms');
+var HooksRunner = require('../../src/hooks/HooksRunner');
+var Q = require('q');
+var util = require('../../src/cordova/util');
 
-var supported_platforms = Object.keys(platforms).filter(function(p) { return p != 'www'; });
+var supported_platforms = Object.keys(platforms).filter(function (p) { return p !== 'www'; });
 
-describe('build command', function() {
-    var is_cordova, cd_project_root, list_platforms, fire;
+describe('build command', function () {
+    var is_cordova;
+    var cd_project_root; // eslint-disable-line no-unused-vars
+    var list_platforms;
+    var fire;
     var project_dir = '/some/path';
     var prepare_spy, compile_spy;
 
-    beforeEach(function() {
+    beforeEach(function () {
         is_cordova = spyOn(util, 'isCordova').and.returnValue(project_dir);
         cd_project_root = spyOn(util, 'cdProjectRoot').and.returnValue(project_dir);
         list_platforms = spyOn(util, 'listPlatforms').and.returnValue(supported_platforms);
@@ -37,44 +40,44 @@ describe('build command', function() {
         prepare_spy = spyOn(cordova, 'prepare').and.returnValue(Q());
         compile_spy = spyOn(cordova, 'compile').and.returnValue(Q());
     });
-    describe('failure', function() {
-        it('Test 001 : should not run inside a project with no platforms', function(done) {
+    describe('failure', function () {
+        it('Test 001 : should not run inside a project with no platforms', function (done) {
             list_platforms.and.returnValue([]);
             cordova.build()
-            .then(function() {
-                expect('this call').toBe('fail');
-            }, function(err) {
-                expect(err.message).toEqual(
-                    'No platforms added to this project. Please use `cordova platform add <platform>`.'
-                );
-            }).fin(done);
+                .then(function () {
+                    expect('this call').toBe('fail');
+                }, function (err) {
+                    expect(err.message).toEqual(
+                        'No platforms added to this project. Please use `cordova platform add <platform>`.'
+                    );
+                }).fin(done);
         });
 
-        it('Test 002 : should not run outside of a Cordova-based project', function(done) {
+        it('Test 002 : should not run outside of a Cordova-based project', function (done) {
             is_cordova.and.returnValue(false);
 
             cordova.build()
-            .then(function() {
-                expect('this call').toBe('fail');
-            }, function(err) {
-                expect(err.message).toEqual(
-                    'Current working directory is not a Cordova-based project.'
-                );
-            }).fin(done);
+                .then(function () {
+                    expect('this call').toBe('fail');
+                }, function (err) {
+                    expect(err.message).toEqual(
+                        'Current working directory is not a Cordova-based project.'
+                    );
+                }).fin(done);
         });
     });
 
-    describe('success', function() {
-        it('Test 003 : should run inside a Cordova-based project with at least one added platform and call both prepare and compile', function(done) {
-            cordova.build(['android','ios']).then(function() {
-                var opts = Object({ platforms: [ 'android', 'ios' ], verbose: false, options: Object({  }) });
+    describe('success', function () {
+        it('Test 003 : should run inside a Cordova-based project with at least one added platform and call both prepare and compile', function (done) {
+            cordova.build(['android', 'ios']).then(function () {
+                var opts = Object({ platforms: [ 'android', 'ios' ], verbose: false, options: Object({ }) });
                 expect(prepare_spy).toHaveBeenCalledWith(opts);
                 expect(compile_spy).toHaveBeenCalledWith(opts);
                 done();
             });
         });
-        it('Test 004 : should pass down options', function(done) {
-            cordova.build({platforms: ['android'], options: {release: true}}).then(function() {
+        it('Test 004 : should pass down options', function (done) {
+            cordova.build({platforms: ['android'], options: {release: true}}).then(function () {
                 var opts = {platforms: ['android'], options: {release: true}, verbose: false};
                 expect(prepare_spy).toHaveBeenCalledWith(opts);
                 expect(compile_spy).toHaveBeenCalledWith(opts);
@@ -83,12 +86,12 @@ describe('build command', function() {
         });
 
         it('Test 005 : should convert options from old format and warn user about this', function (done) {
-            function warnSpy(message) {
+            function warnSpy (message) {
                 expect(message).toMatch('The format of cordova.* methods "options" argument was changed');
             }
 
             cordova.on('warn', warnSpy);
-            cordova.build({platforms:['android'], options:['--release', '--cdvBuildOpt=opt']}).then(function () {
+            cordova.build({platforms: ['android'], options: ['--release', '--cdvBuildOpt=opt']}).then(function () {
                 var opts = {platforms: ['android'], options: jasmine.objectContaining({release: true, argv: ['--cdvBuildOpt=opt']}), verbose: false};
                 expect(prepare_spy).toHaveBeenCalledWith(opts);
                 expect(compile_spy).toHaveBeenCalledWith(opts);
@@ -98,28 +101,28 @@ describe('build command', function() {
         });
     });
 
-    describe('hooks', function() {
-        describe('when platforms are added', function() {
-            it('Test 006 : should fire before hooks through the hooker module', function(done) {
-                cordova.build(['android', 'ios']).then(function() {
-                    expect(fire.calls.argsFor(0)).toEqual(['before_build', {verbose: false, platforms:['android', 'ios'] , options: {}}]);
+    describe('hooks', function () {
+        describe('when platforms are added', function () {
+            it('Test 006 : should fire before hooks through the hooker module', function (done) {
+                cordova.build(['android', 'ios']).then(function () {
+                    expect(fire.calls.argsFor(0)).toEqual(['before_build', {verbose: false, platforms: ['android', 'ios'], options: {}}]);
                     done();
                 });
             });
-            it('Test 007 : should fire after hooks through the hooker module', function(done) {
-                cordova.build('android').then(function() {
-                     expect(fire.calls.argsFor(1)).toEqual([ 'after_build', { platforms: [ 'android' ], verbose: false, options: {} } ]);
-                     done();
+            it('Test 007 : should fire after hooks through the hooker module', function (done) {
+                cordova.build('android').then(function () {
+                    expect(fire.calls.argsFor(1)).toEqual([ 'after_build', { platforms: [ 'android' ], verbose: false, options: {} } ]);
+                    done();
                 });
             });
         });
 
-        describe('with no platforms added', function() {
-            it('Test 008 : should not fire the hooker', function(done) {
+        describe('with no platforms added', function () {
+            it('Test 008 : should not fire the hooker', function (done) {
                 list_platforms.and.returnValue([]);
-                Q().then(cordova.build).then(function() {
+                Q().then(cordova.build).then(function () {
                     expect('this call').toBe('fail');
-                }, function(err) {
+                }, function (err) {
                     expect(err.message).toEqual(
                         'No platforms added to this project. Please use `cordova platform add <platform>`.'
                     );

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/compile.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/compile.spec.js b/spec/cordova/compile.spec.js
index 425e4f0..e090fb6 100644
--- a/spec/cordova/compile.spec.js
+++ b/spec/cordova/compile.spec.js
@@ -16,120 +16,130 @@
     specific language governing permissions and limitations
     under the License.
 */
-var cordova = require('../../src/cordova/cordova'),
-    platforms = require('../../src/platforms/platforms'),
-    HooksRunner = require('../../src/hooks/HooksRunner'),
-    util = require('../../src/cordova/util'),
-    Q = require('q');
+var cordova = require('../../src/cordova/cordova');
+var platforms = require('../../src/platforms/platforms');
+var HooksRunner = require('../../src/hooks/HooksRunner');
+var util = require('../../src/cordova/util');
+var Q = require('q');
 
-var supported_platforms = Object.keys(platforms).filter(function(p) { return p != 'www'; });
+var supported_platforms = Object.keys(platforms).filter(function (p) { return p !== 'www'; });
 
-
-describe('compile command', function() {
-    var is_cordova, list_platforms, fire, cd_project_root, fail, platformApi, getPlatformApi;
+describe('compile command', function () {
+    var is_cordova;
+    var list_platforms;
+    var fire;
+    var cd_project_root; // eslint-disable-line no-unused-vars
+    var fail;
+    var platformApi;
+    var getPlatformApi;
     var project_dir = '/some/path';
 
-    beforeEach(function() {
+    beforeEach(function () {
         is_cordova = spyOn(util, 'isCordova').and.returnValue(project_dir);
         cd_project_root = spyOn(util, 'cdProjectRoot').and.returnValue(project_dir);
-        list_platforms= spyOn(util, 'listPlatforms').and.returnValue(supported_platforms);
+        list_platforms = spyOn(util, 'listPlatforms').and.returnValue(supported_platforms);
         fire = spyOn(HooksRunner.prototype, 'fire').and.returnValue(Q());
-        platformApi = { build: jasmine.createSpy('build').and.returnValue(Q())};
+        platformApi = { build: jasmine.createSpy('build').and.returnValue(Q()) };
         getPlatformApi = spyOn(platforms, 'getPlatformApi').and.returnValue(platformApi);
         fail = function (err) { expect(err.stack).not.toBeDefined(); };
     });
-    describe('failure', function() {
-        it('Test 001 : should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function(done) {
+    describe('failure', function () {
+        it('Test 001 : should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function (done) {
             list_platforms.and.returnValue([]);
             var success = jasmine.createSpy('success');
             cordova.compile()
-            .then(success, function(result) {
-                expect(result instanceof Error).toBe(true);
-                expect('' + result).toContain('No platforms added to this project. Please use `cordova platform add <platform>`.');
-            })
-            .fin(function() {
-                expect(success).not.toHaveBeenCalled();
-                done();
-            });
+                .then(success, function (result) {
+                    expect(result instanceof Error).toBe(true);
+                    expect('' + result).toContain('No platforms added to this project. Please use `cordova platform add <platform>`.');
+                })
+                .fin(function () {
+                    expect(success).not.toHaveBeenCalled();
+                    done();
+                });
         });
-        it('Test 002 : should not run outside of a Cordova-based project', function(done) {
+        it('Test 002 : should not run outside of a Cordova-based project', function (done) {
             is_cordova.and.returnValue(false);
             var success = jasmine.createSpy('success');
             cordova.compile()
-            .then(success, function(result) {
-                expect(result instanceof Error).toBe(true);
-            })
-            .fin(function() {
-                expect(success).not.toHaveBeenCalled();
-                done();
-            });
+                .then(success, function (result) {
+                    expect(result instanceof Error).toBe(true);
+                })
+                .fin(function () {
+                    expect(success).not.toHaveBeenCalled();
+                    done();
+                });
         });
     });
 
-    describe('success', function() {
-        it('Test 003 : should run inside a Cordova-based project with at least one added platform and shell out to build', function(done) {
-            cordova.compile(['android','ios']).then(function() {
-                expect(getPlatformApi).toHaveBeenCalledWith('android');
-                expect(getPlatformApi).toHaveBeenCalledWith('ios');
-                expect(platformApi.build).toHaveBeenCalled();
-            })
-            .fail(fail)
-            .fin(done);
+    describe('success', function () {
+        it('Test 003 : should run inside a Cordova-based project with at least one added platform and shell out to build', function (done) {
+            cordova.compile(['android', 'ios'])
+                .then(function () {
+                    expect(getPlatformApi).toHaveBeenCalledWith('android');
+                    expect(getPlatformApi).toHaveBeenCalledWith('ios');
+                    expect(platformApi.build).toHaveBeenCalled();
+                })
+                .fail(fail)
+                .fin(done);
         });
 
         it('Test 004 : should pass down optional parameters', function (done) {
-            cordova.compile({platforms:['blackberry10'], options:{release: true}}).then(function () {
-                expect(getPlatformApi).toHaveBeenCalledWith('blackberry10');
-                expect(platformApi.build).toHaveBeenCalledWith({release: true});
-            })
-            .fail(fail)
-            .fin(done);
+            cordova.compile({platforms: ['blackberry10'], options: {release: true}})
+                .then(function () {
+                    expect(getPlatformApi).toHaveBeenCalledWith('blackberry10');
+                    expect(platformApi.build).toHaveBeenCalledWith({release: true});
+                })
+                .fail(fail)
+                .fin(done);
         });
 
         it('Test 005 : should convert options from old format and warn user about this', function (done) {
-            function warnSpy(message) {
+            function warnSpy (message) {
                 expect(message).toMatch('The format of cordova.* methods "options" argument was changed');
             }
 
             cordova.on('warn', warnSpy);
-            cordova.compile({platforms:['blackberry10'], options:['--release']}).then(function () {
-                expect(getPlatformApi).toHaveBeenCalledWith('blackberry10');
-                expect(platformApi.build).toHaveBeenCalledWith({release: true, argv: []});
-            })
-            .fail(fail)
-            .fin(function () {
-                cordova.off('warn', warnSpy);
-                done();
-            });
+            cordova.compile({platforms: ['blackberry10'], options: ['--release']})
+                .then(function () {
+                    expect(getPlatformApi).toHaveBeenCalledWith('blackberry10');
+                    expect(platformApi.build).toHaveBeenCalledWith({release: true, argv: []});
+                })
+                .fail(fail)
+                .fin(function () {
+                    cordova.off('warn', warnSpy);
+                    done();
+                });
         });
     });
 
-    describe('hooks', function() {
-        describe('when platforms are added', function() {
-            it('Test 006 : should fire before hooks through the hooker module', function(done) {
-                cordova.compile(['android', 'ios']).then(function() {
-                    expect(fire.calls.argsFor(0)).toEqual(['before_compile', {verbose: false, platforms:['android', 'ios'] , options: {}}]);
-                    done();
-                })
-                .fail(fail)
-                .fin(done);
+    describe('hooks', function () {
+        describe('when platforms are added', function () {
+            it('Test 006 : should fire before hooks through the hooker module', function (done) {
+                cordova.compile(['android', 'ios'])
+                    .then(function () {
+                        expect(fire.calls.argsFor(0)).toEqual(['before_compile', {verbose: false, platforms: ['android', 'ios'], options: {}}]);
+                        done();
+                    })
+                    .fail(fail)
+                    .fin(done);
             });
-            it('Test 007 : should fire after hooks through the hooker module', function(done) {
-                cordova.compile('android').then(function() {
-                    expect(fire.calls.argsFor(1)).toEqual(['after_compile', {verbose: false, platforms:['android'] , options: {}}]);
-                    done();
-                })
-                .fail(fail)
-                .fin(done);
+            it('Test 007 : should fire after hooks through the hooker module', function (done) {
+                cordova.compile('android')
+                    .then(function () {
+                        expect(fire.calls.argsFor(1)).toEqual(['after_compile', {verbose: false, platforms: ['android'], options: {}}]);
+                        done();
+                    })
+                    .fail(fail)
+                    .fin(done);
             });
         });
 
-        describe('with no platforms added', function() {
-            it('Test 008 : should not fire the hooker', function(done) {
+        describe('with no platforms added', function () {
+            it('Test 008 : should not fire the hooker', function (done) {
                 list_platforms.and.returnValue([]);
-                Q().then(cordova.compile).then(function() {
+                Q().then(cordova.compile).then(function () {
                     expect('this call').toBe('fail');
-                }, function(err) {
+                }, function (err) {
                     expect(fire).not.toHaveBeenCalled();
                     expect(err.message).toContain(
                         'No platforms added to this project. Please use `cordova platform add <platform>`.'

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/cordova-lib.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/cordova-lib.spec.js b/spec/cordova/cordova-lib.spec.js
index 8243d59..e8a4cca 100644
--- a/spec/cordova/cordova-lib.spec.js
+++ b/spec/cordova/cordova-lib.spec.js
@@ -17,7 +17,5 @@
     under the License.
 */
 
-/* jshint unused:false */
-
 // Verify that cordova-lib.js can be loaded
-var cordovaLib = require('../../cordova-lib');
+var cordovaLib = require('../../cordova-lib'); // eslint-disable-line no-unused-vars

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/17438d2b/spec/cordova/create.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova/create.spec.js b/spec/cordova/create.spec.js
index b4cb43c..0a088e1 100644
--- a/spec/cordova/create.spec.js
+++ b/spec/cordova/create.spec.js
@@ -17,13 +17,13 @@
     under the License.
 */
 
-var helpers = require('../helpers'),
-    path = require('path'),
-    shell = require('shelljs'),
-    Q = require('q'),
-    events = require('cordova-common').events,
-    ConfigParser = require('cordova-common').ConfigParser,
-    cordova = require('../../src/cordova/cordova');
+var helpers = require('../helpers');
+var path = require('path');
+var shell = require('shelljs');
+var Q = require('q');
+var events = require('cordova-common').events;
+var ConfigParser = require('cordova-common').ConfigParser;
+var cordova = require('../../src/cordova/cordova');
 
 var tmpDir = helpers.tmpDir('create_test');
 var appName = 'TestBase';
@@ -38,43 +38,41 @@ var configBasic = {
     }
 };
 
-describe('cordova create checks for valid-identifier', function() {
-    it('Test 001 : should reject reserved words from start of id', function(done) {
+describe('cordova create checks for valid-identifier', function () {
+    it('Test 001 : should reject reserved words from start of id', function (done) {
         cordova.create('projectPath', 'int.bob', 'appName', {}, events)
-        .fail(function(err) {
-            expect(err.message).toBe('App id contains a reserved word, or is not a valid identifier.');
-        })
-        .fin(done);
+            .fail(function (err) {
+                expect(err.message).toBe('App id contains a reserved word, or is not a valid identifier.');
+            })
+            .fin(done);
     });
-    
-    it('Test 002 : should reject reserved words from end of id', function(done) {
+
+    it('Test 002 : should reject reserved words from end of id', function (done) {
         cordova.create('projectPath', 'bob.class', 'appName', {}, events)
-        .fail(function(err) {
-            expect(err.message).toBe('App id contains a reserved word, or is not a valid identifier.');
-        })
-        .fin(done);
+            .fail(function (err) {
+                expect(err.message).toBe('App id contains a reserved word, or is not a valid identifier.');
+            })
+            .fin(done);
     });
 });
 
+describe('create basic test (see more in cordova-create)', function () {
+    // this.timeout(240000);
 
-describe('create basic test (see more in cordova-create)', function() {
-    //this.timeout(240000);
-
-    beforeEach(function() {
+    beforeEach(function () {
         shell.rm('-rf', project);
         shell.mkdir('-p', tmpDir);
     });
 
-
-    afterEach(function() {
-        process.chdir(path.join(__dirname, '..'));  // Needed to rm the dir on Windows.
+    afterEach(function () {
+        process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows.
         shell.rm('-rf', tmpDir);
     });
 
-    function checkProject() {
+    function checkProject () {
         // Check if top level dirs exist.
         var dirs = ['hooks', 'platforms', 'plugins', 'www'];
-        dirs.forEach(function(d) {
+        dirs.forEach(function (d) {
             expect(path.join(project, d)).toExist();
         });
 
@@ -91,18 +89,18 @@ describe('create basic test (see more in cordova-create)', function() {
         // expect(configXml.name()).toEqual('TestBase');
     }
 
-    var results;
-    events.on('results', function(res) { results = res; });
+    var results; // eslint-disable-line no-unused-vars
+    events.on('results', function (res) { results = res; });
 
-    it('Test 003 : should successfully run', function(done) {
+    it('Test 003 : should successfully run', function (done) {
         // Call cordova create with no args, should return help.
         Q()
-            .then(function() {
+            .then(function () {
                 // Create a real project
                 return cordova.create(project, appId, appName, configBasic, events);
             })
             .then(checkProject)
-            .fail(function(err) {
+            .fail(function (err) {
                 console.log(err && err.stack);
                 expect(err).toBeUndefined();
             })


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