You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/04/24 20:00:14 UTC
git commit: clonePluginGitRepo provides the dir of cloned plugin as
callback param. propagates back to install module during a
install->fetch->install flow.
Updated Branches:
refs/heads/master 1cd301219 -> 372b0a3a2
clonePluginGitRepo provides the dir of cloned plugin as callback param. propagates back to install module during a install->fetch->install flow.
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/372b0a3a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/372b0a3a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/372b0a3a
Branch: refs/heads/master
Commit: 372b0a3a2e7631502aa2f0cdeb35ba2034c2124e
Parents: 1cd3012
Author: Fil Maj <ma...@gmail.com>
Authored: Wed Apr 24 11:00:12 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Wed Apr 24 11:00:12 2013 -0700
----------------------------------------------------------------------
src/fetch.js | 2 +-
src/install.js | 5 +++--
src/util/plugins.js | 5 +++--
3 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/372b0a3a/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index d20cf08..f01c3e2 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -29,6 +29,6 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, link, callback) {
shell.cp('-R', plugin_dir, plugins_dir); // Yes, not dest.
}
- if (callback) callback(null);
+ if (callback) callback(null, dest);
}
};
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/372b0a3a/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 560ce72..e3a9423 100644
--- a/src/install.js
+++ b/src/install.js
@@ -19,10 +19,11 @@ module.exports = function installPlugin(platform, project_dir, name, plugins_dir
// Check that the plugin has already been fetched.
if (!fs.existsSync(plugin_dir)) {
// if plugin doesnt exist, use fetch to get it.
- require('../plugman').fetch(name, plugins_dir, false, function(err) {
+ require('../plugman').fetch(name, plugins_dir, false, function(err, plugin_dir) {
if (err) {
callback(err);
} else {
+ // update ref to plugin_dir after successful fetch, via fetch callback
runInstall(platform, project_dir, plugin_dir, plugins_dir, cli_variables, callback);
}
});
@@ -49,7 +50,7 @@ function runInstall(platform, project_dir, plugin_dir, plugins_dir, cli_variable
missing_vars.push(key)
else
filtered_variables[key] = cli_variables[key]
- })
+ });
if (missing_vars.length > 0) {
var err = new Error('Variable(s) missing: ' + missing_vars.join(", "));
if (callback) {
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/372b0a3a/src/util/plugins.js
----------------------------------------------------------------------
diff --git a/src/util/plugins.js b/src/util/plugins.js
index 1ad4936..52739be 100644
--- a/src/util/plugins.js
+++ b/src/util/plugins.js
@@ -91,17 +91,18 @@ module.exports = {
var plugin_dir = path.join(plugins_dir, basename);
// trash it if it already exists (something went wrong before probably)
+ // TODO: is this the correct behaviour?
if(fs.existsSync(plugin_dir)) {
shell.rm('-rf', plugin_dir);
}
- shell.exec('git clone ' + plugin_git_url + ' ' + plugin_dir + ' 2>&1 1>/dev/null', {silent: true, async:true}, function(code, output) {
+ shell.exec('git clone ' + plugin_git_url + ' ' + plugin_dir, {silent: true, async:true}, function(code, output) {
if (code > 0) {
var err = new Error('failed to get the plugin via git from URL '+ plugin_git_url);
if (callback) callback(err)
else throw err;
} else {
- if (callback) callback(null);
+ if (callback) callback(null, plugin_dir);
}
});
}