cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [2/3] cordova-lib git commit: CB-9589 added test to check id conversion
Date Wed, 07 Oct 2015 05:28:05 GMT
CB-9589 added test to check id conversion


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

Branch: refs/heads/master
Commit: 1c0810a86d6a946d75220271125d455759fb90e7
Parents: a7287ce
Author: Steve Gill <stevengill97@gmail.com>
Authored: Fri Oct 2 19:08:16 2015 -0700
Committer: Steve Gill <stevengill97@gmail.com>
Committed: Tue Oct 6 17:40:12 2015 -0700

----------------------------------------------------------------------
 cordova-lib/spec-plugman/install.spec.js | 14 ++++++++++++++
 cordova-lib/src/plugman/fetch.js         |  1 -
 cordova-lib/src/plugman/uninstall.js     | 16 ++++++++--------
 3 files changed, 22 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1c0810a8/cordova-lib/spec-plugman/install.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/install.spec.js b/cordova-lib/spec-plugman/install.spec.js
index e8a3cd5..572ffde 100644
--- a/cordova-lib/spec-plugman/install.spec.js
+++ b/cordova-lib/spec-plugman/install.spec.js
@@ -227,6 +227,20 @@ describe('install', function() {
                 expect(fetchSpy).toHaveBeenCalled();
             });
         });
+        it('should call fetch and convert oldID to newID', function() {
+            fetchSpy.andReturn( Q( plugins['org.test.plugins.dummyplugin'] ) );
+            spyOn(fs, 'existsSync').andCallFake( fake['existsSync']['noPlugins'] );
+            var emit = spyOn(events, 'emit');
+            runs(function() {
+                installPromise(install('android', project, 'org.apache.cordova.device' ));
+            });
+            waitsFor(function() { return done; }, 'install promise never resolved', 200);
+            runs(function() {
+                expect(emit.calls[0].args[1]).toBe('Notice: org.apache.cordova.device has
been automatically converted to cordova-plugin-device and fetched from npm. This is due to
our old plugins registry shutting down.');
+                expect(done).toBe(true);
+                expect(fetchSpy).toHaveBeenCalled();
+            });
+        });
 
         describe('engine versions', function () {
             var fail, satisfies;

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1c0810a8/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index ad511e4..33e36ed 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -180,7 +180,6 @@ 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.

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1c0810a8/cordova-lib/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/uninstall.js b/cordova-lib/src/plugman/uninstall.js
index 3771c1b..7251d35 100644
--- a/cordova-lib/src/plugman/uninstall.js
+++ b/cordova-lib/src/plugman/uninstall.js
@@ -148,14 +148,14 @@ module.exports.uninstallPlugin = function(id, plugins_dir, options)
{
             var splitVersion = d.id.split('@');
             deps_path = path.join(plugin_dir, '..', splitVersion[0]);
             if (!fs.existsSync(deps_path)) {
-                    var newId = pluginMapper[splitVersion[0]];
-                    if (newId && toDelete.indexOf(newId) === -1) {
-                        toDelete.push(newId);
-                        findDependencies(newId);
-                    }
+                var newId = pluginMapper[splitVersion[0]];
+                if (newId && toDelete.indexOf(newId) === -1) {
+                   toDelete.push(newId);
+                   findDependencies(newId);
+                }
             } else if (toDelete.indexOf(d.id) === -1) {
-                    toDelete.push(d.id);
-                    findDependencies(d.id);
+                toDelete.push(d.id);
+                findDependencies(d.id);
             }
         });
     }
@@ -277,7 +277,7 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir,
plugin
 
             var opts = underscore.extend({}, options, {
                 is_top_level: depsInfo.top_level_plugins.indexOf(dangler) > -1,
-                depsInfo: depsInfo  
+                depsInfo: depsInfo
             });
 
             return runUninstallPlatform(actions, platform, project_dir, dependent_path, plugins_dir,
opts);


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


Mime
View raw message