cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [1/6] git commit: [CB-4077] Separate the actions of removing a plugin from a platform and removing the plugin entirely
Date Wed, 10 Jul 2013 18:03:21 GMT
Updated Branches:
  refs/heads/master 4646aa41c -> ba9d4b0cb


[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-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/21a102c3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/21a102c3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/21a102c3

Branch: refs/heads/master
Commit: 21a102c360f2ec1f5501e7f0c1316e98ffde885a
Parents: 4646aa4
Author: Ian Clelland <iclelland@chromium.org>
Authored: Fri Jul 5 10:49:04 2013 -0400
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Wed Jul 10 11:01:27 2013 -0700

----------------------------------------------------------------------
 src/uninstall.js | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/21a102c3/src/uninstall.js
----------------------------------------------------------------------
diff --git a/src/uninstall.js b/src/uninstall.js
index dbe0fae..8728711 100644
--- a/src/uninstall.js
+++ b/src/uninstall.js
@@ -11,7 +11,17 @@ var path = require('path'),
     platform_modules = require('./platforms');
 
 // possible options: cli_variables, www_dir
-module.exports = function uninstallPlugin(platform, project_dir, id, plugins_dir, options,
callback) {
+module.exports = function(platform, project_dir, id, plugins_dir, options, callback) {
+    module.exports.uninstallPlatform(platform, project_dir, id, plugins_dir, options, function(err)
{
+        if (err) {
+            if (callback) return callback(err);
+            else throw err;
+        }
+        module.exports.uninstallPlugin(id, plugins_dir, options, callback);
+    });
+}
+
+module.exports.uninstallPlatform = function(platform, project_dir, id, plugins_dir, options,
callback) {
     if (!platform_modules[platform]) {
         var err = new Error(platform + " not supported.");
         if (callback) return callback(err);
@@ -32,11 +42,21 @@ module.exports = function uninstallPlugin(platform, project_dir, id, plugins_dir
     runUninstall(current_stack, platform, project_dir, plugin_dir, plugins_dir, options,
callback);
 };
 
+module.exports.uninstallPlugin = function(id, plugins_dir, callback) {
+    var plugin_dir = path.join(plugins_dir, id);
+    var xml_path     = path.join(plugin_dir, 'plugin.xml')
+      , plugin_et    = xml_helpers.parseElementtreeSync(xml_path);
+    var plugin_id    = plugin_et._root.attrib['id'];
+    // axe the directory
+    shell.rm('-rf', plugin_dir);
+    require('../plugman').emit('log', plugin_id + ' uninstalled.');
+    if (callback) callback();
+};
+
 // possible options: cli_variables, www_dir, is_top_level
 function runUninstall(actions, platform, project_dir, plugin_dir, plugins_dir, options, callback)
{
     var xml_path     = path.join(plugin_dir, 'plugin.xml')
       , plugin_et    = xml_helpers.parseElementtreeSync(xml_path);
-    var name         = plugin_et.findall('name').text;
     var plugin_id    = plugin_et._root.attrib['id'];
     options = options || {};
 
@@ -131,9 +151,6 @@ function handleUninstall(actions, platform, plugin_id, plugin_et, project_dir,
w
             config_changes.add_uninstalled_plugin_to_prepare_queue(plugins_dir, path.basename(plugin_dir),
platform, is_top_level);
             // call prepare after a successful uninstall
             require('./../plugman').prepare(project_dir, platform, plugins_dir);
-            // axe the directory
-            shell.rm('-rf', plugin_dir);
-            require('../plugman').emit('log', plugin_id + ' uninstalled.');
             if (callback) callback();
         }
     });


Mime
View raw message