Updated Branches: refs/heads/master 3161e5703 -> f2a815bce
[CB-5184] Fix uninstall logic being too aggressive Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/f2a815bc Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/f2a815bc Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/f2a815bc Branch: refs/heads/master Commit: f2a815bceafefd58637a0fb2c9669c0ffb2750a0 Parents: 3161e57 Author: Braden Shepherdson <[email protected]> Authored: Wed Oct 23 15:01:03 2013 -0400 Committer: Braden Shepherdson <[email protected]> Committed: Wed Oct 23 15:01:03 2013 -0400 ---------------------------------------------------------------------- spec/uninstall.spec.js | 8 +++----- src/uninstall.js | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/f2a815bc/spec/uninstall.spec.js ---------------------------------------------------------------------- diff --git a/spec/uninstall.spec.js b/spec/uninstall.spec.js index 733b7b0..b505743 100644 --- a/spec/uninstall.spec.js +++ b/spec/uninstall.spec.js @@ -127,7 +127,6 @@ describe('uninstallPlatform', function() { expect(err).toBeUndefined(); }).done(done); }); - it('should not uninstall any dependencies that are relied on by other plugins'); }); }); @@ -188,7 +187,7 @@ describe('uninstallPlugin', function() { }); }); describe('with dependencies', function() { - var parseET, emit, findPlugins; + var parseET, emit; beforeEach(function() { emit = spyOn(plugman, 'emit'); var counter = 0; @@ -207,17 +206,16 @@ describe('uninstallPlugin', function() { } } }); - - findPlugins = spyOn(plugins, 'findPlugins').andReturn([dummyplugin, 'somedependent']); }); it('should delete all dangling plugins', function(done) { uninstall.uninstallPlugin(dummyplugin, plugins_dir) .then(function() { expect(rm).toHaveBeenCalledWith('-rf', path.join(plugins_dir, dummyplugin)); expect(rm).toHaveBeenCalledWith('-rf', path.join(plugins_dir, 'somedependent')); + expect(rm.calls.length).toBe(2); }, function(err) { expect(err).toBeUndefined(); - }).done(done); + }).fin(done); }); }); }); http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/f2a815bc/src/uninstall.js ---------------------------------------------------------------------- diff --git a/src/uninstall.js b/src/uninstall.js index 4ef7501..11ff7fb 100644 --- a/src/uninstall.js +++ b/src/uninstall.js @@ -82,7 +82,7 @@ module.exports.uninstallPlugin = function(id, plugins_dir) { }); }); - var danglers = underscore.difference(plugins.findPlugins(plugins_dir), found); + var danglers = underscore.difference(toDelete, found); if (danglers && danglers.length) { require('../plugman').emit('log', 'Found ' + danglers.length + ' removable plugins. Deleting them.'); danglers.forEach(doDelete);
