Updated Branches: refs/heads/master 0b9903992 -> 202d49d07
Remove all assets and JS modules on plugin uninstallation. Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/7e819251 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/7e819251 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/7e819251 Branch: refs/heads/master Commit: 7e819251106094558a3cc8c2813d22ca9efbad45 Parents: 26017e8 Author: Braden Shepherdson <[email protected]> Authored: Tue Apr 16 14:03:04 2013 -0400 Committer: Braden Shepherdson <[email protected]> Committed: Tue Apr 16 14:03:04 2013 -0400 ---------------------------------------------------------------------- platforms/android.js | 14 ++++++++++++-- platforms/blackberry.js | 11 +++++++++++ platforms/ios.js | 13 ++++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/7e819251/platforms/android.js ---------------------------------------------------------------------- diff --git a/platforms/android.js b/platforms/android.js index f95f022..e5ccd0b 100644 --- a/platforms/android.js +++ b/platforms/android.js @@ -163,13 +163,23 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et, var output = xmlDoc.write({indent: 4}); fs.writeFileSync(filepath, output); }); - + if (action == 'install') { variables['PACKAGE_NAME'] = androidPackageName(project_dir); searchAndReplace(path.resolve(project_dir, config_xml_filename), variables); searchAndReplace(path.resolve(project_dir, 'AndroidManifest.xml'), variables); } - + + // Remove all assets and JS modules installed by this plugin. + if (action == 'uninstall') { + var assets = plugin_et.findall('./asset'); + assets && assets.forEach(function(asset) { + var target = asset.attrib.target; + shell.rm('-rf', path.join(project_dir, assetsDir, target)); + }); + + shell.rm('-rf', path.join(project_dir, assetsDir, 'plugins', plugin_id)); + } } http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/7e819251/platforms/blackberry.js ---------------------------------------------------------------------- diff --git a/platforms/blackberry.js b/platforms/blackberry.js index cdd89ee..231aacc 100644 --- a/platforms/blackberry.js +++ b/platforms/blackberry.js @@ -138,6 +138,17 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et) { output = xmlDoc.write({indent: 4}); fs.writeFileSync(filepath, output); }); + + // Remove all assets and JS modules installed by this plugin. + if (action == 'uninstall') { + var assets = plugin_et.findall('./asset'); + assets && assets.forEach(function(asset) { + var target = asset.attrib.target; + shell.rm('-rf', path.join(project_dir, 'www', target)); + }); + + shell.rm('-rf', path.join(project_dir, 'www', 'plugins', plugin_id)); + } } http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/7e819251/platforms/ios.js ---------------------------------------------------------------------- diff --git a/platforms/ios.js b/platforms/ios.js index 99769a0..de7ffaf 100644 --- a/platforms/ios.js +++ b/platforms/ios.js @@ -191,7 +191,18 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et, var searchAndReplace(projectPListPath, variables); searchAndReplace(config_file, variables); } - + + // Remove all assets and JS modules installed by this plugin. + if (action == 'uninstall') { + var assets = plugin_et.findall('./asset'); + assets && assets.forEach(function(asset) { + var target = asset.attrib.target; + shell.rm('-rf', path.join(project_dir, 'www', target)); + }); + + shell.rm('-rf', path.join(project_dir, 'www', 'plugins', plugin_id)); + } + } function getRelativeDir(file) {
