Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4AD741060E for ; Wed, 24 Jul 2013 20:59:11 +0000 (UTC) Received: (qmail 28463 invoked by uid 500); 24 Jul 2013 20:59:11 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 28447 invoked by uid 500); 24 Jul 2013 20:59:11 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 28437 invoked by uid 99); 24 Jul 2013 20:59:11 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jul 2013 20:59:11 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BCD938B3E23; Wed, 24 Jul 2013 20:59:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bhiggins@apache.org To: commits@cordova.apache.org Message-Id: <9113cb651ad8489eb6f72e282206d5bc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [CB-4372] Fixed "Plugman fails when fetching local plugins with space in path" Date: Wed, 24 Jul 2013 20:59:10 +0000 (UTC) Updated Branches: refs/heads/master bdf4d061b -> 2a8b9add0 [CB-4372] Fixed "Plugman fails when fetching local plugins with space in path" Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/2a8b9add Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/2a8b9add Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/2a8b9add Branch: refs/heads/master Commit: 2a8b9add0f7fb2d98a172cba404203772e65d951 Parents: bdf4d06 Author: jkeshavarzi Authored: Wed Jul 24 16:04:50 2013 -0400 Committer: Bryan Higgins Committed: Wed Jul 24 16:59:44 2013 -0400 ---------------------------------------------------------------------- spec/fetch.spec.js | 5 +++++ src/fetch.js | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2a8b9add/spec/fetch.spec.js ---------------------------------------------------------------------- diff --git a/spec/fetch.spec.js b/spec/fetch.spec.js index 1fc1aaf..4151020 100644 --- a/spec/fetch.spec.js +++ b/spec/fetch.spec.js @@ -7,6 +7,7 @@ var fetch = require('../src/fetch'), metadata = require('../src/util/metadata'), temp = path.join(os.tmpdir(), 'plugman'), test_plugin = path.join(__dirname, 'plugins', 'ChildBrowser'), + test_plugin_with_space = path.join(__dirname, 'folder with space', 'plugins', 'ChildBrowser'), plugins = require('../src/util/plugins'); describe('fetch', function() { @@ -26,6 +27,10 @@ describe('fetch', function() { fetch(test_plugin, temp); expect(cp).toHaveBeenCalledWith('-R', path.join(test_plugin, '*'), path.join(temp, 'id')); }); + it('should copy locally-available plugin to plugins directory when spaces in path', function() { + fetch(test_plugin_with_space, temp); + expect(cp).toHaveBeenCalledWith('-R', path.join(test_plugin_with_space, '*'), path.join(temp, 'id')); + }); it('should create a symlink if used with `link` param', function() { fetch(test_plugin, temp, { link: true }); expect(sym).toHaveBeenCalledWith(test_plugin, path.join(temp, 'id'), 'dir'); http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2a8b9add/src/fetch.js ---------------------------------------------------------------------- diff --git a/src/fetch.js b/src/fetch.js index 28d9994..e2b3d71 100644 --- a/src/fetch.js +++ b/src/fetch.js @@ -46,7 +46,9 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback // Copy from the local filesystem. // First, read the plugin.xml and grab the ID. - plugin_dir = path.join(uri.href, options.subdir); + // NOTE: Can't use uri.href here as it will convert spaces to %20 and make path invalid. + // Use original plugin_dir value instead. + plugin_dir = path.join(plugin_dir, options.subdir); var plugin_xml_path = path.join(plugin_dir, 'plugin.xml'); require('../plugman').emit('log', 'Fetch is reading plugin.xml from location "' + plugin_xml_path + '"...'); var xml = xml_helpers.parseElementtreeSync(plugin_xml_path);