cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cordova-lib git commit: CB-8551 added plugin-name support for removing plugins.
Date Tue, 03 Mar 2015 08:27:38 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/CB-8551 9370401b6 -> c063fdec7 (forced update)


CB-8551 added plugin-name support for removing plugins.


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

Branch: refs/heads/CB-8551
Commit: c063fdec756ff1dac6edb5e5dff1c72d2c985c1f
Parents: 9b36f20
Author: Steve Gill <stevengill97@gmail.com>
Authored: Tue Mar 3 00:17:29 2015 -0800
Committer: Steve Gill <stevengill97@gmail.com>
Committed: Tue Mar 3 00:27:18 2015 -0800

----------------------------------------------------------------------
 cordova-lib/src/cordova/plugin.js            | 32 ++++++++++++++---------
 cordova-lib/src/plugman/fetch.js             |  2 +-
 cordova-lib/src/plugman/registry/registry.js | 12 ++++-----
 cordova-lib/src/plugman/uninstall.js         |  1 -
 4 files changed, 27 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c063fdec/cordova-lib/src/cordova/plugin.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/plugin.js b/cordova-lib/src/cordova/plugin.js
index 0a8855f..db3c6d9 100644
--- a/cordova-lib/src/cordova/plugin.js
+++ b/cordova-lib/src/cordova/plugin.js
@@ -237,20 +237,27 @@ 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`.'));
+                    
+                        // 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) {
+                                events.emit('log', 'Plugin "' + target + '" is not present
in the project. Converting value to "' + keys[i] + '" and trying again.');
+                                target = keys[i]; 
+                            }
+                        }
+                        
+                        if (plugins.indexOf(target) < 0) {
+
+                            return Q.reject(new CordovaError('Plugin "' + target + '" is
not present in the project. See `'+cordova_util.binname+' plugin list`.'));
+                        }
                     }
 
                     // Iterate over all installed platforms and uninstall.
@@ -292,6 +299,7 @@ module.exports = function plugin(command, targets, opts) {
                 opts.cordova = { plugins: cordova_util.findPlugins(path.join(projectRoot,
'plugins')) };
                 return hooksRunner.fire('after_plugin_rm', opts);
             });
+
         case 'search':
             return hooksRunner.fire('before_plugin_search')
             .then(function() {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c063fdec/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index 416a7b6..4e58a68 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -133,7 +133,7 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
                         id: plugin_src
                     }
                 };
-            })
+            });
         }).then(function(result) {
             options.plugin_src_dir = result.pinfo.dir;
             return Q.when(copyPlugin(result.pinfo, plugins_dir, options.link && result.fetchJsonSource.type
== 'local'))

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c063fdec/cordova-lib/src/plugman/registry/registry.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/registry.js b/cordova-lib/src/plugman/registry/registry.js
index 75e234c..fb574b5 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -355,7 +355,7 @@ function fetchNPM(plugin, client) {
     })
     .fail(function(error) {
         events.emit('log', 'Fetching from npm registry failed');
-        return Q.reject(error)
+        return Q.reject(error);
     });
 }
 
@@ -390,8 +390,8 @@ function fetchPlugReg(plugin, client) {
     })
     .fail(function(error) {
         events.emit('log', 'Fetching from cordova plugin registry failed');
-        return Q.reject(error)
-    });;
+        return Q.reject(error);
+    });
 }
 
 /**
@@ -416,9 +416,9 @@ function checkPluginID(plugin) {
         //if it does, warn the users to use package-name
         var packageName = pluginMapper[pluginID[0]];
         if(packageName) {
-            events.emit('log', 'WARNING: ' + plugin + ' has been renamed to ' 
-                    + packageName + ' and moved to npm. Please use `cordova plugin add '
-                    + packageName + '` next time.');
+            events.emit('log', 'WARNING: ' + plugin + ' has been renamed to ' + 
+                    packageName + ' and moved to npm. Please use `cordova plugin add ' +

+                    packageName + '` next time.');
         }
     }
     return Q(); 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c063fdec/cordova-lib/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/uninstall.js b/cordova-lib/src/plugman/uninstall.js
index 4d09996..ecb4518 100644
--- a/cordova-lib/src/plugman/uninstall.js
+++ b/cordova-lib/src/plugman/uninstall.js
@@ -47,7 +47,6 @@ function uninstall(platform, project_dir, id, plugins_dir, options) {
     options.is_top_level = true;
     options.pluginInfoProvider = options.pluginInfoProvider || new PluginInfoProvider();
     plugins_dir = plugins_dir || path.join(project_dir, 'cordova', 'plugins');
-
     // Allow `id` to be a path to a file.
     var xml_path = path.join(id, 'plugin.xml');
     if ( fs.existsSync(xml_path) ) {


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


Mime
View raw message