Updated Branches: refs/heads/master fef05584f -> 9caee42ee
Fixes dependency fetching to work with subdirectories. Also allows subdirectories within platform tags Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/dd31b393 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/dd31b393 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/dd31b393 Branch: refs/heads/master Commit: dd31b39367bcb1c13324944557a190e4cf8fd023 Parents: fef0558 Author: Jeffrey Heifetz <[email protected]> Authored: Wed Jul 17 21:55:22 2013 -0400 Committer: Fil Maj <[email protected]> Committed: Thu Jul 18 13:40:17 2013 -0700 ---------------------------------------------------------------------- src/install.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/dd31b393/src/install.js ---------------------------------------------------------------------- diff --git a/src/install.js b/src/install.js index c1b5d17..13aa9bb 100644 --- a/src/install.js +++ b/src/install.js @@ -51,7 +51,7 @@ function possiblyFetch(actions, platform, project_dir, id, plugins_dir, options, // 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(id, plugins_dir, { link: false, subdir: '.', git_ref: options.git_ref }, function(err, plugin_dir) { + require('../plugman').fetch(id, plugins_dir, { link: false, subdir: options.subdir, git_ref: options.git_ref }, function(err, plugin_dir) { if (err) { callback(err); } else { @@ -92,8 +92,8 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt if (callback) callback(); return; } - - // checking engine + + // checking engine // will there be a case for multiple engine support? var versionPath = path.join(project_dir, 'cordova', 'version'); if (fs.existsSync(versionPath)) { @@ -111,14 +111,14 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt engines.forEach(function(engine){ if(engine.attrib["name"].toLowerCase() === "cordova"){ var engineVersion = engine.attrib["version"]; - // clean only versionScript.output since semver.clean strips out + // clean only versionScript.output since semver.clean strips out // the gt and lt operators if(current_version == 'dev' || semver.satisfies(current_version, engineVersion)){ // engine ok! } else { var err = new Error('Plugin doesn\'t support this project\'s Cordova version. Project version: ' + current_version + ', failed version requirement: ' + engineVersion); if (callback) return callback(err); - else throw err; + else throw err; } } else { // check for other engines? worklight phonegap etc @@ -149,7 +149,8 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt } // Check for dependencies, (co)recurse to install each one - var dependencies = plugin_et.findall('dependency'); + var dependencies = plugin_et.findall('dependency') || []; + dependencies = dependencies.concat(plugin_et.findall('./platform[@name="'+platform+'"]/dependency')); if (dependencies && dependencies.length) { require('../plugman').emit('log', 'Dependencies detected, iterating through them...'); var end = n(dependencies.length, function() { @@ -171,7 +172,7 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt if (dep_url == '.') { // Look up the parent plugin's fetch metadata and determine the correct URL. var fetchdata = require('./util/metadata').get_fetch_metadata(plugin_dir); - + if (!fetchdata || !(fetchdata.source && fetchdata.source.type)) { var err = new Error('No fetch metadata found for ' + plugin_id + '. Cannot install relative dependencies.'); if (callback) callback(err);
