android handler should be good to go. added fetch spec to install
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/63624edb Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/63624edb Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/63624edb Branch: refs/heads/master Commit: 63624edb5104bcf5f52c5859cfe18dd2bf1290f1 Parents: 1d23f0a Author: Fil Maj <[email protected]> Authored: Mon Apr 22 16:16:57 2013 -0700 Committer: Fil Maj <[email protected]> Committed: Mon Apr 22 16:16:57 2013 -0700 ---------------------------------------------------------------------- spec/install.spec.js | 4 ++++ src/install.js | 4 ++-- src/platforms/android.js | 7 ++++--- 3 files changed, 10 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/63624edb/spec/install.spec.js ---------------------------------------------------------------------- diff --git a/spec/install.spec.js b/spec/install.spec.js index 9b93a39..20de7dc 100644 --- a/spec/install.spec.js +++ b/spec/install.spec.js @@ -34,6 +34,10 @@ describe('install', function() { }); it('should call fetch if provided plugin cannot be resolved locally', function() { + shell.cp('-rf', android_one_project, temp); + var s = spyOn(plugman, 'fetch'); + install('android', temp, 'CLEANYOURSHORTS', plugins_dir, {}); + expect(s).toHaveBeenCalled(); }); // TODO: possibly test how diff platform transaction logs are created it('should generate an array of transactions required to run an installation and pass into appropriate platform handler\'s install method', function() { http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/63624edb/src/install.js ---------------------------------------------------------------------- diff --git a/src/install.js b/src/install.js index f3cb776..a3d355e 100644 --- a/src/install.js +++ b/src/install.js @@ -1,9 +1,9 @@ var path = require('path'), fs = require('fs'), et = require('elementtree'), - fetch= require('./fetch'), platform_modules = require('./platforms'); +// TODO: is name necessary as a param ehre? module.exports = function installPlugin(platform, project_dir, name, plugins_dir, cli_variables, callback) { if (!platform_modules[platform]) { var err = new Error(platform + " not supported."); @@ -19,7 +19,7 @@ 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. - fetch(name, plugins_dir, false, function(err) { + require('../plugman').fetch(name, plugins_dir, false, function(err) { if (err) { callback(err); } else { http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/63624edb/src/platforms/android.js ---------------------------------------------------------------------- diff --git a/src/platforms/android.js b/src/platforms/android.js index 0914165..b017a9f 100644 --- a/src/platforms/android.js +++ b/src/platforms/android.js @@ -55,8 +55,6 @@ function handlePlugin(action, plugin_id, txs, project_dir, plugin_dir, variables }); */ var completed = []; - console.log(txs); - return; while(txs.length) { var mod = txs.shift(); try { @@ -127,10 +125,13 @@ function handlePlugin(action, plugin_id, txs, project_dir, plugin_dir, variables if (action == 'install') { variables['PACKAGE_NAME'] = androidPackageName(project_dir); - searchAndReplace(path.resolve(project_dir, config_xml_filename), variables); + var config_filename = path.resolve(project_dir, 'res', 'xml', 'config.xml'); + if (!fs.existsSync(config_filename)) config_filename = path.resolve(project_dir, 'res', 'xml', 'plugins.xml'); + searchAndReplace(config_filename, variables); searchAndReplace(path.resolve(project_dir, 'AndroidManifest.xml'), variables); } + if (callback) callback(); } // reads the package name out of the Android Manifest file
