cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From audre...@apache.org
Subject [15/18] cordova-lib git commit: CB-12895 : updated integration tests with eslint format and rebased
Date Fri, 28 Jul 2017 18:26:46 GMT
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


Mime
View raw message