You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2013/01/30 23:57:56 UTC

android commit: CB-1961 update to create script for android/windows

Updated Branches:
  refs/heads/master 3610bbf21 -> 77f9cae50


CB-1961 update to create script for android/windows


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/77f9cae5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/77f9cae5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/77f9cae5

Branch: refs/heads/master
Commit: 77f9cae50b0b36800b48a01fa2dd597a957a1718
Parents: 3610bbf
Author: Anis Kadri <an...@gmail.com>
Authored: Wed Jan 30 14:57:49 2013 -0800
Committer: Anis Kadri <an...@gmail.com>
Committed: Wed Jan 30 14:57:49 2013 -0800

----------------------------------------------------------------------
 bin/create.js |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/77f9cae5/bin/create.js
----------------------------------------------------------------------
diff --git a/bin/create.js b/bin/create.js
index 258c32c..d0d9999 100644
--- a/bin/create.js
+++ b/bin/create.js
@@ -33,12 +33,22 @@ function read(filename) {
     f.Close();
     return s;
 }
+
+function checkTargets(targets) {
+    if(!targets) {
+        WScript.Echo("You do not have any android targets setup. Please create at least one target with the `android` command");
+        WScript.Quit(69);
+    }
+}
+
 function setTarget() {
     var targets = shell.Exec('android.bat list targets').StdOut.ReadAll().match(/id:\s\d+/g);
+    checkTargets(targets);
     return targets[targets.length - 1].replace(/id: /, ""); // TODO: give users the option to set their target 
 }
 function setApiLevel() {
     var targets = shell.Exec('android.bat list targets').StdOut.ReadAll().match(/API level:\s\d+/g);
+    checkTargets(targets);
     return targets[targets.length - 1].replace(/API level: /, "");
 }
 function write(filename, contents) {