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 865E7108BF for ; Mon, 19 Aug 2013 20:30:04 +0000 (UTC) Received: (qmail 60532 invoked by uid 500); 19 Aug 2013 20:30:04 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 60145 invoked by uid 500); 19 Aug 2013 20:29:59 -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 60135 invoked by uid 99); 19 Aug 2013 20:29:58 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Aug 2013 20:29:58 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 7D7B68BFDC6; Mon, 19 Aug 2013 20:29:58 +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: <4efe6eb7befb4c7baa18019a235d0969@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [CB-4570] [BlackBerry10] Updating the parser not to overwrite config.xml Date: Mon, 19 Aug 2013 20:29:58 +0000 (UTC) Updated Branches: refs/heads/master 9f83b4ac8 -> 4b77decee [CB-4570] [BlackBerry10] Updating the parser not to overwrite config.xml - preferences are now copied from master www/config.xml Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/4b77dece Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/4b77dece Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/4b77dece Branch: refs/heads/master Commit: 4b77decee47e97cdf12cbb37dc2b4d6e16605a69 Parents: 9f83b4a Author: Jeffrey Heifetz Authored: Mon Aug 19 12:15:44 2013 -0400 Committer: Bryan Higgins Committed: Mon Aug 19 16:31:20 2013 -0400 ---------------------------------------------------------------------- src/metadata/blackberry10_parser.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/4b77dece/src/metadata/blackberry10_parser.js ---------------------------------------------------------------------- diff --git a/src/metadata/blackberry10_parser.js b/src/metadata/blackberry10_parser.js index dbaf85b..1d9f9d0 100644 --- a/src/metadata/blackberry10_parser.js +++ b/src/metadata/blackberry10_parser.js @@ -37,7 +37,7 @@ module.exports = function blackberry_parser(project) { module.exports.check_requirements = function(project_root, callback) { var lib_path = path.join(util.libDirectory, 'blackberry10', 'cordova', require('../../platforms').blackberry10.version); shell.exec(path.join(lib_path, 'bin', 'check_reqs'), {silent:true, async:true}, function(code, output) { - if (code != 0) { + if (code !== 0) { callback(output); } else { callback(false); @@ -47,6 +47,8 @@ module.exports.check_requirements = function(project_root, callback) { module.exports.prototype = { update_from_config:function(config) { + var self = this; + if (config instanceof config_parser) { } else throw new Error('update_from_config requires a config_parser object'); @@ -57,11 +59,13 @@ module.exports.prototype = { this.xml.version(config.version()); events.emit('log', 'Wrote out BlackBerry version to "' + config.version() + '"'); this.xml.access.remove(); - var self = this; config.access.getAttributes().forEach(function(attribs) { self.xml.access.add(attribs.uri || attribs.origin, attribs.subdomains); }); - + this.xml.preference.remove(); + config.preference.get().forEach(function (pref) { + self.xml.preference.add(pref); + }); this.xml.content(config.content()); }, update_project:function(cfg, callback) { @@ -70,9 +74,8 @@ module.exports.prototype = { try { self.update_from_config(cfg); } catch(e) { - if (callback) callback(e); + if (callback) return callback(e); else throw e; - return; } self.update_www(); self.update_overrides(); @@ -98,11 +101,13 @@ module.exports.prototype = { var projectRoot = util.isCordova(this.path); var www = util.projectWww(projectRoot); var platformWww = this.www_dir(); + // remove the stock www folder shell.rm('-rf', this.www_dir()); - // copy over project www assets shell.cp('-rf', www, this.path); + //Re-Write config.xml + this.xml.update(); var custom_path = config.has_custom_path(projectRoot, 'blackberry10'); var lib_path = path.join(util.libDirectory, 'blackberry10', 'cordova', require('../../platforms').blackberry10.version);