error 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/8c0dbf73 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/8c0dbf73 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/8c0dbf73 Branch: refs/heads/master Commit: 8c0dbf737c753c3d52fb0396aa0e45d430d5101c Parents: 332dc21 Author: Anis Kadri <[email protected]> Authored: Mon Jul 15 17:33:02 2013 -0700 Committer: Anis Kadri <[email protected]> Committed: Mon Jul 15 17:33:02 2013 -0700 ---------------------------------------------------------------------- plugman.js | 1 + src/fetch.js | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8c0dbf73/plugman.js ---------------------------------------------------------------------- diff --git a/plugman.js b/plugman.js index c1f9d2d..541946a 100755 --- a/plugman.js +++ b/plugman.js @@ -27,6 +27,7 @@ module.exports = { uninstall: require('./src/uninstall'), fetch: require('./src/fetch'), prepare: require('./src/prepare'), + config: require('./config'), adduser: require('./src/adduser'), publish: require('./src/publish'), unpublish:require('./src/unpublish'), http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8c0dbf73/src/fetch.js ---------------------------------------------------------------------- diff --git a/src/fetch.js b/src/fetch.js index 910c69d..7cd4fb2 100644 --- a/src/fetch.js +++ b/src/fetch.js @@ -5,8 +5,8 @@ var shell = require('shelljs'), xml_helpers = require('./util/xml-helpers'), metadata = require('./util/metadata'), path = require('path'), - registry = require('plugman-registry'); - + registry = require('plugman-registry'); +// XXX: leave the require('../plugman') because jasmine shits itself if you declare it up top // possible options: link, subdir, git_ref module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback) { require('../plugman').emit('log', 'Fetching plugin from location "' + plugin_dir + '"...'); @@ -80,9 +80,11 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback if(!fs.existsSync(plugin_dir)) { - registry.use(null, function() { + registry.use(require('../plugman').config.registry, function() { registry.fetch([plugin_dir], function(err, plugin_dir) { - movePlugin(plugin_dir, false); + if (callback) return callback(err); + else throw err; + movePlugin(plugin_dir, false); }); }) } else {
