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-8775 plugins will not get copied into project/plugins if it already exists or if old id exists
Date Wed, 08 Apr 2015 23:58:33 GMT
CB-8775 plugins will not get copied into project/plugins if it already exists or if old id
exists


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

Branch: refs/heads/master
Commit: 91c683fc74948f723f7e79bf98e40bec85d70843
Parents: ebadd2e
Author: Steve Gill <stevengill97@gmail.com>
Authored: Tue Apr 7 17:21:32 2015 -0700
Committer: Steve Gill <stevengill97@gmail.com>
Committed: Wed Apr 8 14:32:17 2015 -0700

----------------------------------------------------------------------
 cordova-lib/src/plugman/fetch.js | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/91c683fc/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index e449bd4..0cf19be 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -29,7 +29,9 @@ var shell   = require('shelljs'),
     metadata = require('./util/metadata'),
     path    = require('path'),
     Q       = require('q'),
-    registry = require('./registry/registry');
+    registry = require('./registry/registry'),
+    pluginMappernto = require('cordova-registry-mapper').newToOld,
+    pluginMapperotn = require('cordova-registry-mapper').oldToNew;
 var cordovaUtil = require('../cordova/util');
 
 // Cache of PluginInfo objects for plugins in search path.
@@ -238,11 +240,30 @@ function findLocalPlugin(plugin_src, searchpath, pluginInfoProvider)
{
 
 
 // Copy or link a plugin from plugin_dir to plugins_dir/plugin_id.
+// if plugin exists in plugins_dir/plugin_id, skip copy
 function copyPlugin(pinfo, plugins_dir, link) {
 
     var plugin_dir = pinfo.dir;
     var dest = path.join(plugins_dir, pinfo.id);
+    var altDest;
 
+    //check if alternative id already exists in plugins directory
+    if(pluginMapperotn[pinfo.id]) {
+        altDest = path.join(plugins_dir, pluginMapperotn[pinfo.id]);
+    }   
+    if(pluginMappernto[pinfo.id]) {
+        altDest = path.join(plugins_dir, pluginMappernto[pinfo.id]);
+    }
+
+    if(fs.existsSync(dest)) {
+        events.emit('log', pinfo.id + '" already exists in "' + dest + '"');
+        return dest;
+
+    }
+    if(fs.existsSync(altDest)) {
+        events.emit('log', pinfo.id + '" already exists in "' + altDest + '"');
+        return altDest;
+    }
 
     shell.rm('-rf', dest);
     if (link) {


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


Mime
View raw message