You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2013/03/26 17:06:51 UTC
git commit: Use the new style of plugman commands
Updated Branches:
refs/heads/future 76ed29cc3 -> fb7cbc60f
Use the new style of plugman commands
The commands have been split into --fetch, --install, --uninstall,
and --remove.
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/fb7cbc60
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/fb7cbc60
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/fb7cbc60
Branch: refs/heads/future
Commit: fb7cbc60f783ed0d7ba19d35dc525a4c522df505
Parents: 76ed29c
Author: Braden Shepherdson <br...@gmail.com>
Authored: Tue Mar 26 12:06:13 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Tue Mar 26 12:06:13 2013 -0400
----------------------------------------------------------------------
src/plugin.js | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/fb7cbc60/src/plugin.js
----------------------------------------------------------------------
diff --git a/src/plugin.js b/src/plugin.js
index b323429..03442eb 100644
--- a/src/plugin.js
+++ b/src/plugin.js
@@ -73,9 +73,20 @@ module.exports = function plugin(command, targets, callback) {
targets.forEach(function(target, index) {
hooks.fire('before_plugin_add');
var cli = path.join(__dirname, '..', 'node_modules', 'plugman', 'plugman.js');
+ var pluginsDir = path.join(projectRoot, 'plugins');
+
+ var lastSlash = target.lastIndexOf('/', target.length - 2);
+
+ // Fetch the plugin first.
+ var cmd = util.format('%s --fetch --plugin "%s" --plugins_dir "%s"', cli, target, pluginsDir);
+ console.log(cmd);
+ var plugin_fetch = shell.exec(cmd, {silent: true});
+ if (plugin_fetch.code > 0) throw new Error('An error occured during plugin fetching:\n' + plugin_fetch.output);
+
// Iterate over all platforms in the project and install the plugin.
platforms.forEach(function(platform) {
- var cmd = util.format('%s --platform %s --project "%s" --plugin "%s" --plugins_dir "%s"', cli, platform, path.join(projectRoot, 'platforms', platform), target, path.join(projectRoot, 'plugins'));
+ cmd = util.format('%s --platform %s --project "%s" --plugin "%s" --plugins_dir "%s"', cli, platform, path.join(projectRoot, 'platforms', platform), names[index], pluginsDir);
+ console.log(cmd);
var plugin_cli = shell.exec(cmd, {silent:true});
if (plugin_cli.code > 0) throw new Error('An error occured during plugin installation for ' + platform + ': ' + plugin_cli.output);
});
@@ -107,14 +118,19 @@ module.exports = function plugin(command, targets, callback) {
// Iterate over all matchin app-plugin platforms in the project and uninstall the
// plugin.
+ var cmd;
intersection.forEach(function(platform) {
- var cmd = util.format('%s --platform %s --project "%s" --plugin "%s" --remove', cli, platform, path.join(projectRoot, 'platforms', platform), targetPath);
+ cmd = util.format('%s --platform %s --project "%s" --plugin "%s" --plugins_dir "%s" --uninstall', cli, platform, path.join(projectRoot, 'platforms', platform), targetName, path.join(projectRoot, 'plugins'));
+ console.log(cmd);
var plugin_cli = shell.exec(cmd, {silent:true});
if (plugin_cli.code > 0) throw new Error('An error occured during plugin uninstallation for ' + platform + '. ' + plugin_cli.output);
});
// Finally remove the plugin dir from plugins/
- shell.rm('-rf', targetPath);
+ cmd = util.format('%s --plugin "%s" --plugins_dir "%s" --remove', cli, targetName, path.join(projectRoot, 'plugins'));
+ console.log(cmd);
+ var plugin_remove = shell.exec(cmd, {silent: true});
+ if (plugin_remove.code > 0) throw new Error('An error occurred during plugin removal:\n' + plugin_remove.output);
hooks.fire('after_plugin_rm');
} else {