Allow specifying a platform when building.

This limits the build to only the specified platforms.
Refs #32.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/commit/e8fdc25d
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/tree/e8fdc25d
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/diff/e8fdc25d

Branch: refs/heads/cordova-client
Commit: e8fdc25d3de98e12c08ff941d892547af6530534
Parents: 322facf
Author: Darryl Pogue <dvpdin...@gmail.com>
Authored: Tue Oct 2 23:04:47 2012 -0700
Committer: Fil Maj <maj....@gmail.com>
Committed: Wed Oct 3 01:06:43 2012 -0700

----------------------------------------------------------------------
 src/build.js |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/e8fdc25d/src/build.js
----------------------------------------------------------------------
diff --git a/src/build.js b/src/build.js
index 3339427..88dc00a 100644
--- a/src/build.js
+++ b/src/build.js
@@ -23,7 +23,7 @@ function shell_out_to_debug(projectRoot, platform) {
     if (response.code > 0) throw 'An error occurred while building the ' + 
platform + ' project. ' + response.output;
 }
 
-module.exports = function build (callback) {
+module.exports = function build (platforms, callback) {
     var projectRoot = cordova_util.isCordova(process.cwd());
 
     if (!projectRoot) {
@@ -33,7 +33,12 @@ module.exports = function build (callback) {
     var xml = path.join(projectRoot, 'www', 'config.xml');
     var assets = path.join(projectRoot, 'www');
     var cfg = new config_parser(xml);
-    var platforms = platform('ls');
+
+    if (arguments.length === 0) {
+        platforms = platform('ls');
+    } else if (!(platforms instanceof Array)) {
+        platforms = [platforms];
+    }
 
     if (platforms.length === 0) throw 'No platforms added to this project. 
Please use `cordova platform add <platform>`.';
 

Reply via email to