You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/07/10 20:09:42 UTC

[1/3] git commit: [CB-4077] Fix tests for cordova-cli

Updated Branches:
  refs/heads/CB-4077 [created] cb4c49aeb


[CB-4077] Fix tests for cordova-cli


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

Branch: refs/heads/CB-4077
Commit: 88026614da80dca42a98414f724a5e743aa78abe
Parents: f577c4d
Author: Ian Clelland <ic...@chromium.org>
Authored: Mon Jul 8 14:08:58 2013 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Wed Jul 10 09:44:39 2013 -0400

----------------------------------------------------------------------
 spec/plugin.spec.js | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88026614/spec/plugin.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugin.spec.js b/spec/plugin.spec.js
index f340151..ddd9b59 100644
--- a/spec/plugin.spec.js
+++ b/spec/plugin.spec.js
@@ -33,7 +33,7 @@ var project_dir = path.join('some','path');
 var plugins_dir = path.join(project_dir, 'plugins');
 
 describe('plugin command', function() {
-    var is_cordova, list_platforms, fire, find_plugins, rm, mkdir, existsSync, exec, prep_spy, plugman_install, plugman_fetch, parsers = {}, uninstall;
+    var is_cordova, list_platforms, fire, find_plugins, rm, mkdir, existsSync, exec, prep_spy, plugman_install, plugman_fetch, parsers = {}, uninstallPlatform, uninstallPlugin;
     beforeEach(function() {
         is_cordova = spyOn(util, 'isCordova').andReturn(project_dir);
         fire = spyOn(hooker.prototype, 'fire').andCallFake(function(e, opts, cb) {
@@ -61,7 +61,10 @@ describe('plugin command', function() {
         });
         plugman_install = spyOn(plugman, 'install');
         plugman_fetch = spyOn(plugman, 'fetch').andCallFake(function(target, plugins_dir, opts, cb) { cb(false, path.join(plugins_dir, target)); });
-        uninstall = spyOn(plugman, 'uninstall');
+        uninstallPlatform = spyOn(plugman.uninstall, 'uninstallPlatform');
+        uninstallPlugin = spyOn(plugman.uninstall, 'uninstallPlugin').andCallFake(function(target, plugins_dir, cb) {
+            cb && cb();
+        });
     });
 
     describe('failure', function() {
@@ -141,14 +144,19 @@ describe('plugin command', function() {
                 }).toThrow('Plugin "somethingrandom" not added to project.');
             });
 
-            it('should call plugman.uninstall for every matching installedplugin-supportedplatform pair', function() {
+            it('should call plugman.uninstall.uninstallPlatform for every matching installedplugin-supportedplatform pair', function() {
                 cordova.plugin('rm', sample_plugins);
                 sample_plugins.forEach(function(plug) {
                     subset.forEach(function(plat) {
-                        expect(uninstall).toHaveBeenCalledWith(plat, path.join(project_dir, 'platforms', plat), plug, plugins_dir, jasmine.any(Object));
+                        expect(uninstallPlatform).toHaveBeenCalledWith(plat, path.join(project_dir, 'platforms', plat), plug, plugins_dir, jasmine.any(Object));
                     });
                 });
             });
+            it('should call plugman.uninstall.uninstallPlugin once for every removed plugin', function() {
+                uninstallPlugin.reset();
+                cordova.plugin('rm', sample_plugins);
+                expect(uninstallPlugin.callCount).toBe(2);
+            });
         });
     });
     describe('hooks', function() {


[2/3] git commit: [CB-4077] Separate the actions of removing a plugin from a platform and removing the plugin entirely

Posted by fi...@apache.org.
[CB-4077] Separate the actions of removing a plugin from a platform and removing the plugin entirely


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

Branch: refs/heads/CB-4077
Commit: f577c4dd1c7e751b64abc0317eded567882bc1a3
Parents: 6773ecd
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri Jul 5 10:49:51 2013 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Wed Jul 10 09:44:39 2013 -0400

----------------------------------------------------------------------
 src/plugin.js | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f577c4dd/src/plugin.js
----------------------------------------------------------------------
diff --git a/src/plugin.js b/src/plugin.js
index ca43e35..a280277 100644
--- a/src/plugin.js
+++ b/src/plugin.js
@@ -138,17 +138,17 @@ module.exports = function plugin(command, targets, callback) {
                                 else return true;
                             });
 
-                            // Iterate over all the common platforms between the plugin
-                            // and the app, and uninstall.
-                            // If this is a web-only plugin with no platform tags, this step
-                            // is not needed and we just --remove the plugin below.
-                            intersection.forEach(function(platform) {
+                            // 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.
+                            platformList.forEach(function(platform) {
                                 var platformRoot = path.join(projectRoot, 'platforms', platform);
                                 var parser = new platforms[platform].parser(platformRoot);
                                 events.emit('log', 'Calling plugman.uninstall on plugin "' + target + '" for platform "' + platform + '"');
-                                plugman.uninstall((platform=='blackberry'?'blackberry10':platform), platformRoot, target, path.join(projectRoot, 'plugins'), { www_dir: parser.staging_dir() });
+                                plugman.uninstall.uninstallPlatform((platform=='blackberry'?'blackberry10':platform), platformRoot, target, path.join(projectRoot, 'plugins'), { www_dir: parser.staging_dir() });
                             });
-                            end();
+                            plugman.uninstall.uninstallPlugin(target, path.join(projectRoot, 'plugins'), end);
                         } else {
                             var err = new Error('Plugin "' + target + '" not added to project.');
                             if (callback) callback(err);


[3/3] git commit: [CB-4077] updating plugman version to 0.9.0.

Posted by fi...@apache.org.
[CB-4077] updating plugman version to 0.9.0.


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

Branch: refs/heads/CB-4077
Commit: cb4c49aeb7d8bcb53b0782da8cbe2f0e5727bdd7
Parents: 8802661
Author: Fil Maj <ma...@gmail.com>
Authored: Wed Jul 10 11:09:38 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Wed Jul 10 11:09:38 2013 -0700

----------------------------------------------------------------------
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cb4c49ae/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 9b8ca88..9bd24f1 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
   "dependencies": {
     "colors":">=0.6.0",
     "elementtree":"0.1.3",
-    "plugman":"0.8.2",
+    "plugman":"0.9.0",
     "plist":"0.4.x",
     "xcode":"0.5.1",
     "express":"3.0.0",