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 06140114DA for ; Thu, 9 May 2013 14:31:09 +0000 (UTC) Received: (qmail 63240 invoked by uid 500); 9 May 2013 14:08:04 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 62602 invoked by uid 500); 9 May 2013 14:07:35 -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 62216 invoked by uid 99); 9 May 2013 14:07:19 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 May 2013 14:07:19 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 0C00988A8BA; Thu, 9 May 2013 14:07:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: braden@apache.org To: commits@cordova.apache.org Message-Id: <3d2066cc128d4ecc95afd0bf78d585bc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: Access config.xml from serve. Serve from platform dir only Date: Thu, 9 May 2013 14:07:18 +0000 (UTC) Updated Branches: refs/heads/future 2a5407e8b -> 6ad6a2652 Access config.xml from serve. Serve from platform dir only Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/6ad6a265 Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/6ad6a265 Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/6ad6a265 Branch: refs/heads/future Commit: 6ad6a2652f88cbbfc3f40b5ed6d7883be8e87e61 Parents: 2a5407e Author: Shravan Narayan Authored: Wed May 8 14:50:21 2013 -0400 Committer: Shravan Narayan Committed: Wed May 8 18:17:55 2013 -0400 ---------------------------------------------------------------------- src/metadata/android_parser.js | 4 ++++ src/metadata/blackberry_parser.js | 4 ++++ src/metadata/ios_parser.js | 7 ++++++- src/serve.js | 12 +++++++++--- 4 files changed, 23 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6ad6a265/src/metadata/android_parser.js ---------------------------------------------------------------------- diff --git a/src/metadata/android_parser.js b/src/metadata/android_parser.js index be3015c..79c1f2b 100644 --- a/src/metadata/android_parser.js +++ b/src/metadata/android_parser.js @@ -130,6 +130,10 @@ module.exports.prototype = { return path.join(this.path, '.staging', 'www'); }, + config_xml:function(){ + return this.android_config; + }, + update_www:function() { var projectRoot = util.isCordova(this.path); var www = util.projectWww(projectRoot); http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6ad6a265/src/metadata/blackberry_parser.js ---------------------------------------------------------------------- diff --git a/src/metadata/blackberry_parser.js b/src/metadata/blackberry_parser.js index 16fcbad..97cdd59 100644 --- a/src/metadata/blackberry_parser.js +++ b/src/metadata/blackberry_parser.js @@ -94,6 +94,10 @@ module.exports.prototype = { return path.join(this.path, '.staging', 'www'); }, + config_xml:function(){ + return this.config_path; + }, + update_www:function() { var projectRoot = util.isCordova(this.path); var www = util.projectWww(projectRoot); http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6ad6a265/src/metadata/ios_parser.js ---------------------------------------------------------------------- diff --git a/src/metadata/ios_parser.js b/src/metadata/ios_parser.js index 5e83ed3..5c22256 100644 --- a/src/metadata/ios_parser.js +++ b/src/metadata/ios_parser.js @@ -55,7 +55,8 @@ module.exports = function ios_parser(project) { } this.path = project; this.pbxproj = path.join(this.xcodeproj, 'project.pbxproj'); - this.config = new config_parser(path.join(this.cordovaproj, 'config.xml')); + this.config_path = path.join(this.cordovaproj, 'config.xml'); + this.config = new config_parser(this.config_path); }; module.exports.check_requirements = function(callback) { @@ -141,6 +142,10 @@ module.exports.prototype = { return path.join(this.path, '.staging', 'www'); }, + config_xml:function(){ + return this.config_path; + }, + update_www:function() { var projectRoot = util.isCordova(this.path); var www = util.projectWww(projectRoot); http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6ad6a265/src/serve.js ---------------------------------------------------------------------- diff --git a/src/serve.js b/src/serve.js index 771f64f..2829847 100644 --- a/src/serve.js +++ b/src/serve.js @@ -30,11 +30,11 @@ var cordova_util = require('./util'), url = require("url"); -function launch_server(www, platform_www, port) { +function launch_server(www, platform_www, config_xml_path, port) { port = port || 8000; // Searches these directories in order looking for the requested file. - var searchPath = [www, platform_www]; + var searchPath = [platform_www]; var server = http.createServer(function(request, response) { var uri = url.parse(request.url).pathname; @@ -48,6 +48,9 @@ function launch_server(www, platform_www, port) { } var filename = path.join(searchPath[pathIndex], uri); + if(uri === "/config.xml"){ + filename = config_xml_path; + } fs.exists(filename, function(exists) { if(!exists) { @@ -82,7 +85,7 @@ module.exports = function serve (platform, port) { var returnValue = {}; module.exports.config(platform, port, function (config) { - returnValue.server = launch_server(config.paths[0], config.paths[1], port); + returnValue.server = launch_server(config.paths[0], config.paths[1], config.config_xml_path, port); }); // Hack for testing despite its async nature. @@ -113,6 +116,8 @@ module.exports.config = function (platform, port, callback) { var result = { paths: [], + // Config file path + config_xml_path : "", // Default port is 8000 if not given. This is also the default of the Python module. port: port || 8000 }; @@ -137,6 +142,7 @@ module.exports.config = function (platform, port, callback) { // Update the related platform project from the config parser.update_project(cfg, function() { result.paths.push(parser.www_dir()); + result.config_xml_path = parser.config_xml(); callback(result); }); }