cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [08/12] cordova-lib git commit: added ability to remove plugin via package-name
Date Tue, 03 Mar 2015 07:37:43 GMT
added ability to remove plugin via package-name


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

Branch: refs/heads/CB-8551
Commit: 38a0afbdaef58dd2bc9cff88c76b0e382d835592
Parents: fee6daa
Author: Steve Gill <stevengill97@gmail.com>
Authored: Tue Jan 27 14:15:32 2015 -0800
Committer: Steve Gill <stevengill97@gmail.com>
Committed: Tue Jan 27 14:15:32 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/cordova/plugin.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/38a0afbd/cordova-lib/src/cordova/plugin.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/plugin.js b/cordova-lib/src/cordova/plugin.js
index b044a2f..5c349bd 100644
--- a/cordova-lib/src/cordova/plugin.js
+++ b/cordova-lib/src/cordova/plugin.js
@@ -28,6 +28,7 @@ var cordova_util  = require('./util'),
     shell         = require('shelljs'),
     PluginInfoProvider = require('../PluginInfoProvider'),
     plugman       = require('../plugman/plugman'),
+    pluginMapper  = require('cordova-registry-mapper'),
     events        = require('../events');
 
 // Returns a promise.
@@ -178,6 +179,17 @@ module.exports = function plugin(command, targets, opts) {
             return hooksRunner.fire('before_plugin_rm', opts)
             .then(function() {
                 return opts.plugins.reduce(function(soFar, target) {
+                    // Convert target from package-name to package-id if necessary
+                    var keys = Object.keys(pluginMapper);
+                    //Traverse through pluginMapper values to see if it equals our target.
+                    //Cordova-plugin-device would get changes to org.apache.cordova.device
+                    for (var i = 0; i < keys.length; i++) {
+                        var val = pluginMapper[keys[i]]; 
+                        if(val === target) {
+                            target = keys[i];
+                        }
+                    }
+
                     // Check if we have the plugin.
                     if (plugins.indexOf(target) < 0) {
                         return Q.reject(new CordovaError('Plugin "' + target + '" is not
present in the project. See `'+cordova_util.binname+' plugin list`.'));


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


Mime
View raw message