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/05/23 19:38:55 UTC

[2/4] git commit: removed debuggin statements. fix for proper handling of fetch callback to check for errors before triggering main plugin handling.

removed debuggin statements. fix for proper handling of fetch callback to check for errors before triggering main plugin handling.


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

Branch: refs/heads/master
Commit: a79a75e1fee41e58c0bd29a94556507a06411405
Parents: 03214e7
Author: Fil Maj <ma...@gmail.com>
Authored: Wed May 22 12:49:20 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Wed May 22 12:49:20 2013 -0700

----------------------------------------------------------------------
 src/fetch.js        |    5 -----
 src/install.js      |   15 ++++++---------
 src/util/plugins.js |    3 +--
 3 files changed, 7 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/a79a75e1/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index de38d9a..e58ef00 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -26,15 +26,11 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, link, subdir, git
 
         // Copy from the local filesystem.
         // First, read the plugin.xml and grab the ID.
-        console.log('top', plugin_dir);
         plugin_dir = path.join(plugin_dir, subdir);
-        console.log('2');
         var xml = xml_helpers.parseElementtreeSync(path.join(plugin_dir, 'plugin.xml'));
-        console.log('3');
         var plugin_id = xml.getroot().attrib.id;
 
         var dest = path.join(plugins_dir, plugin_id);
-        console.log('4');
 
         shell.rm('-rf', dest);
         if (link) {
@@ -42,7 +38,6 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, link, subdir, git
         } else {
             shell.mkdir('-p', dest);
             shell.cp('-R', path.join(plugin_dir, '*') , dest);
-            console.log('5');
         }
 
         if (callback) callback(null, dest);

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/a79a75e1/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 33a95a1..89bd034 100644
--- a/src/install.js
+++ b/src/install.js
@@ -7,7 +7,6 @@ var path = require('path'),
     platform_modules = require('./platforms');
 
 module.exports = function installPlugin(platform, project_dir, id, plugins_dir, subdir, cli_variables, www_dir, callback) {
-    console.log('===========\n\nwww_dir = ' + www_dir + '\n\n==================');
     if (!platform_modules[platform]) {
         var err = new Error(platform + " not supported.");
         if (callback) callback(err);
@@ -21,10 +20,7 @@ module.exports = function installPlugin(platform, project_dir, id, plugins_dir,
 };
 
 function possiblyFetch(actions, platform, project_dir, id, plugins_dir, subdir, cli_variables, www_dir, git_ref, is_top_level, callback) {
-    console.log('f1');
-    console.log(plugins_dir, id);
     var plugin_dir = path.join(plugins_dir, id);
-    console.log('f2');
 
     // Check that the plugin has already been fetched.
     if (!fs.existsSync(plugin_dir)) {
@@ -109,11 +105,12 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, cli
                 runInstall(actions, platform, project_dir, dep_plugin_dir, plugins_dir, filtered_variables, www_dir, false, end);
             } else {
                 console.log('Dependent plugin ' + dep_plugin_id + ' not fetched, retrieving then installing.');
-                try {
-                    possiblyFetch(actions, platform, project_dir, dep_url, plugins_dir, dep_subdir, filtered_variables, www_dir, dep_git_ref, false, end);
-                } catch (e) {
-                    console.log(e);
-                }
+                possiblyFetch(actions, platform, project_dir, dep_url, plugins_dir, dep_subdir, filtered_variables, www_dir, dep_git_ref, false, function(err) {
+                    if (err) {
+                        if (callback) callback(err);
+                        else throw err;
+                    } else end();
+                });
             }
         });
     } else {

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/a79a75e1/src/util/plugins.js
----------------------------------------------------------------------
diff --git a/src/util/plugins.js b/src/util/plugins.js
index 7fda99b..f8b2846 100644
--- a/src/util/plugins.js
+++ b/src/util/plugins.js
@@ -37,7 +37,6 @@ module.exports = {
             else throw err;
         }
 
-        console.log('clonePluginGitRepo', plugin_git_url, plugins_dir, subdir, git_ref);
         shell.rm('-rf', tmp_dir);
 
         var cmd = util.format('git clone "%s" "%s"', plugin_git_url, tmp_dir);
@@ -51,7 +50,7 @@ module.exports = {
                 if (git_ref) {
                     var result = shell.exec(util.format('git checkout "%s"', git_ref), { silent: true });
                     if (result.code > 0) {
-                        var err = new Error('failed to checkout git ref "' + git_ref + '"');
+                        var err = new Error('failed to checkout git ref "' + git_ref + '" for plugin at git url "' + plugin_git_url + '"');
                         if (callback) callback(err);
                         else throw err;
                     }