cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwbro...@apache.org
Subject [3/5] git commit: [CB-3238] Update cordova-android to 2.7.0
Date Tue, 30 Apr 2013 21:05:39 GMT
[CB-3238] Update cordova-android to 2.7.0


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/298ad426
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/298ad426
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/298ad426

Branch: refs/heads/master
Commit: 298ad4269679ac0342a434fa8c196005d875189c
Parents: b49b363
Author: Michael Brooks <michael@michaelbrooks.ca>
Authored: Tue Apr 30 13:27:04 2013 -0700
Committer: Michael Brooks <michael@michaelbrooks.ca>
Committed: Tue Apr 30 13:27:04 2013 -0700

----------------------------------------------------------------------
 lib/cordova-android/VERSION                        |    2 +-
 lib/cordova-android/bin/check_reqs.bat             |    9 -
 lib/cordova-android/bin/check_reqs.js              |   81 --
 lib/cordova-android/bin/create                     |   11 +-
 lib/cordova-android/bin/create.bat                 |   34 +-
 lib/cordova-android/bin/create.js                  |   81 +--
 lib/cordova-android/bin/templates/cordova/build    |    5 +-
 .../bin/templates/cordova/build.bat                |   20 +-
 lib/cordova-android/bin/templates/cordova/clean    |    5 +-
 .../bin/templates/cordova/clean.bat                |   20 +-
 lib/cordova-android/bin/templates/cordova/cordova  |  159 ++++
 .../bin/templates/cordova/cordova.bat              |    7 +-
 .../bin/templates/cordova/cordova.js               |  137 ++++
 .../bin/templates/cordova/lib/cordova              |  386 ----------
 .../bin/templates/cordova/lib/cordova.js           |  593 ---------------
 .../bin/templates/cordova/lib/install-device       |   23 -
 .../bin/templates/cordova/lib/install-device.bat   |    9 -
 .../bin/templates/cordova/lib/install-emulator     |   23 -
 .../bin/templates/cordova/lib/install-emulator.bat |    9 -
 .../bin/templates/cordova/lib/list-devices         |   23 -
 .../bin/templates/cordova/lib/list-devices.bat     |    9 -
 .../bin/templates/cordova/lib/list-emulator-images |   23 -
 .../templates/cordova/lib/list-emulator-images.bat |    9 -
 .../templates/cordova/lib/list-started-emulators   |   23 -
 .../cordova/lib/list-started-emulators.bat         |    9 -
 .../bin/templates/cordova/lib/start-emulator       |   23 -
 .../bin/templates/cordova/lib/start-emulator.bat   |    9 -
 lib/cordova-android/bin/templates/cordova/log      |    5 +-
 lib/cordova-android/bin/templates/cordova/log.bat  |   20 +-
 lib/cordova-android/bin/templates/cordova/release  |   24 +
 lib/cordova-android/bin/templates/cordova/run      |    5 +-
 lib/cordova-android/bin/templates/cordova/run.bat  |    3 +-
 .../bin/templates/project/assets/www/index.html    |    2 +-
 lib/cordova-android/bin/update                     |   11 +-
 lib/cordova-android/bin/update.js                  |    8 +-
 .../framework/assets/js/cordova.android.js         |    6 +-
 .../framework/assets/www/index.html                |    2 +-
 .../framework/src/org/apache/cordova/Device.java   |    2 +-
 .../cordova/IceCreamCordovaWebViewClient.java      |   11 +-
 .../src/org/apache/cordova/api/PluginManager.java  |    1 -
 40 files changed, 443 insertions(+), 1399 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/VERSION
----------------------------------------------------------------------
diff --git a/lib/cordova-android/VERSION b/lib/cordova-android/VERSION
index e70b452..24ba9a3 100644
--- a/lib/cordova-android/VERSION
+++ b/lib/cordova-android/VERSION
@@ -1 +1 @@
-2.6.0
+2.7.0

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/check_reqs.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/check_reqs.bat b/lib/cordova-android/bin/check_reqs.bat
deleted file mode 100644
index 65514c8..0000000
--- a/lib/cordova-android/bin/check_reqs.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@ECHO OFF
-SET full_path=%~dp0
-IF EXIST %full_path%check_reqs.js (
-        cscript "%full_path%check_reqs.js" //nologo
-) ELSE (
-    ECHO.
-    ECHO ERROR: Could not find 'check_reqs.js' in 'bin' folder, aborting...>&2
-    EXIT /B 1
-)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/check_reqs.js
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/check_reqs.js b/lib/cordova-android/bin/check_reqs.js
deleted file mode 100644
index ef30991..0000000
--- a/lib/cordova-android/bin/check_reqs.js
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-// 
-// http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-var ROOT  = WScript.ScriptFullName.split('\\bin\\check_reqs.js').join(''),
-    shell = WScript.CreateObject("WScript.Shell"),
-    fso   = WScript.CreateObject('Scripting.FileSystemObject');
-
-
-// executes a command in the shell, returns stdout or stderr if error
-function exec_out(command) {
-    var oExec=shell.Exec(command);
-    var output = new String();
-    while (oExec.Status == 0) {
-        if (!oExec.StdOut.AtEndOfStream) {
-            var line = oExec.StdOut.ReadAll();
-            // XXX: Change to verbose mode 
-            // WScript.StdOut.WriteLine(line);
-            output += line;
-        }
-        WScript.sleep(100);
-    }
-    //Check to make sure our scripts did not encounter an error
-    if (!oExec.StdErr.AtEndOfStream) {
-        var line = oExec.StdErr.ReadAll();
-        return {'error' : true, 'output' : line};
-    } else if (!oExec.StdOut.AtEndOfStream) {
-            var line = oExec.StdOut.ReadAll();
-            // XXX: Change to verbose mode 
-            // WScript.StdOut.WriteLine(line);
-            output += line;
-    }
-    return {'error' : false, 'output' : output};
-}
-
-// log to stdout or stderr
-function Log(msg, error) {
-    if (error) {
-        WScript.StdErr.WriteLine(msg);
-    }
-    else {
-        WScript.StdOut.WriteLine(msg);
-    }
-} 
-
-// checks that android requirements are met
-function check_requirements() {
-    var result = exec_out('%comspec% /c android list target');
-    if(result.error) {
-        Log('The command `android` failed. Make sure you have the latest Android SDK installed, and the `android` command (inside the tools/ folder) added to your path. Output: ' + result.output, true);
-        WScript.Quit(2);
-    }
-    else if(!result.output.match(/android[-]17/)) {
-        Log('Please install Android target 17 (the Android 4.2 SDK). Make sure you have the latest Android tools installed as well. Run `android` from your command-line to install/update any missing SDKs or tools.', true);
-        Log('Output : ' + result.output);
-        WScript.Quit(2);
-    }
-    else {
-        var cmd = '%comspec% /c android update project -p ' + ROOT + '\\framework -t android-17';
-        result = exec_out(cmd);
-        if(result.error) {
-            Log('Error updating the Cordova library to work with your Android environment. Command run: "' + cmd + '", output: ' + result.output, true);
-            WScript.Quit(2);  
-        }
-    }
-}
-
-check_requirements();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/create
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/create b/lib/cordova-android/bin/create
index b7e96b4..35d3363 100755
--- a/lib/cordova-android/bin/create
+++ b/lib/cordova-android/bin/create
@@ -161,18 +161,11 @@ replace "s/__APILEVEL__/${API_LEVEL}/g" "$MANIFEST_PATH"
 
 # creating cordova folder and copying run/build/log/launch scripts
 mkdir "$PROJECT_PATH"/cordova
-mkdir "$PROJECT_PATH"/cordova/lib
 createAppInfoJar
 cp "$BUILD_PATH"/bin/templates/cordova/appinfo.jar "$PROJECT_PATH"/cordova/appinfo.jar
+cp "$BUILD_PATH"/bin/templates/cordova/cordova "$PROJECT_PATH"/cordova/cordova
 cp "$BUILD_PATH"/bin/templates/cordova/build "$PROJECT_PATH"/cordova/build
+cp "$BUILD_PATH"/bin/templates/cordova/release "$PROJECT_PATH"/cordova/release
 cp "$BUILD_PATH"/bin/templates/cordova/clean "$PROJECT_PATH"/cordova/clean
 cp "$BUILD_PATH"/bin/templates/cordova/log "$PROJECT_PATH"/cordova/log
 cp "$BUILD_PATH"/bin/templates/cordova/run "$PROJECT_PATH"/cordova/run
-cp "$BUILD_PATH"/bin/templates/cordova/lib/cordova "$PROJECT_PATH"/cordova/lib/cordova
-cp "$BUILD_PATH"/bin/templates/cordova/lib/install-device "$PROJECT_PATH"/cordova/lib/install-device
-cp "$BUILD_PATH"/bin/templates/cordova/lib/install-emulator "$PROJECT_PATH"/cordova/lib/install-emulator
-cp "$BUILD_PATH"/bin/templates/cordova/lib/list-devices "$PROJECT_PATH"/cordova/lib/list-devices
-cp "$BUILD_PATH"/bin/templates/cordova/lib/list-emulator-images "$PROJECT_PATH"/cordova/lib/list-emulator-images
-cp "$BUILD_PATH"/bin/templates/cordova/lib/list-started-emulators "$PROJECT_PATH"/cordova/lib/list-started-emulators
-cp "$BUILD_PATH"/bin/templates/cordova/lib/start-emulator "$PROJECT_PATH"/cordova/lib/start-emulator
-

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/create.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/create.bat b/lib/cordova-android/bin/create.bat
index 7f0346f..cdbd611 100644
--- a/lib/cordova-android/bin/create.bat
+++ b/lib/cordova-android/bin/create.bat
@@ -1,5 +1,3 @@
-@ECHO OFF
-GOTO BEGIN
 :: Licensed to the Apache Software Foundation (ASF) under one
 :: or more contributor license agreements.  See the NOTICE file
 :: distributed with this work for additional information
@@ -17,23 +15,23 @@ GOTO BEGIN
 :: specific language governing permissions and limitations
 :: under the License.
 
-:BEGIN
-        IF NOT DEFINED JAVA_HOME GOTO MISSING_JAVA_HOME
+@ECHO OFF
+IF NOT DEFINED JAVA_HOME GOTO MISSING_JAVA_HOME
 
-        FOR %%X in (java.exe javac.exe ant.bat android.bat) do (
-            IF [%%~$PATH:X]==[] (
-              ECHO Cannot locate %%X using the PATH environment variable.
-              ECHO Retry after adding directory containing %%X to the PATH variable.
-              ECHO Remember to open a new command window after updating the PATH variable.
-              IF "%%X"=="java.exe" GOTO GET_JAVA
-              IF "%%X"=="javac.exe" GOTO GET_JAVA
-              IF "%%X"=="ant.bat" GOTO GET_ANT
-              IF "%%X"=="android.bat" GOTO GET_ANDROID
-              GOTO ERROR
-            )
-        )
-        cscript "%~dp0\create.js" %* //nologo
-        GOTO END
+FOR %%X in (java.exe javac.exe ant.bat android.bat) do (
+    IF [%%~$PATH:X]==[] (
+      ECHO Cannot locate %%X using the PATH environment variable.
+      ECHO Retry after adding directory containing %%X to the PATH variable.
+      ECHO Remember to open a new command window after updating the PATH variable.
+      IF "%%X"=="java.exe" GOTO GET_JAVA
+      IF "%%X"=="javac.exe" GOTO GET_JAVA
+      IF "%%X"=="ant.bat" GOTO GET_ANT
+      IF "%%X"=="android.bat" GOTO GET_ANDROID
+      GOTO ERROR
+    )
+)
+cscript "%~dp0\create.js" %*
+GOTO END
 :MISSING_JAVA_HOME
         ECHO The JAVA_HOME environment variable is not set.
         ECHO Set JAVA_HOME to an existing JRE directory.

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/create.js
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/create.js b/lib/cordova-android/bin/create.js
index 5176b7d..d0d9999 100644
--- a/lib/cordova-android/bin/create.js
+++ b/lib/cordova-android/bin/create.js
@@ -24,30 +24,7 @@
  *  ./create [path package activity]
  */
 
-var args = WScript.Arguments, PROJECT_PATH="example", 
-    PACKAGE="org.apache.cordova.example", ACTIVITY="cordovaExample",
-    shell=WScript.CreateObject("WScript.Shell"),
-    fso = WScript.CreateObject('Scripting.FileSystemObject');
-
-function Usage() {
-    Log("Usage: create PathTONewProject [ PackageName AppName ]");
-    Log("    PathTONewProject : The path to where you wish to create the project");
-    Log("    PackageName      : The package for the project (default is org.apache.cordova.example)")
-    Log("    AppName          : The name of the application/activity (default is cordovaExample)");
-    Log("examples:");
-    Log("    create C:\\Users\\anonymous\\Desktop\\MyProject");
-    Log("    create C:\\Users\\anonymous\\Desktop\\MyProject io.Cordova.Example AnApp");
-}
-
-// logs messaged to stdout and stderr
-function Log(msg, error) {
-    if (error) {
-        WScript.StdErr.WriteLine(msg);
-    }
-    else {
-        WScript.StdOut.WriteLine(msg);
-    }
-}
+var fso = WScript.CreateObject('Scripting.FileSystemObject');
 
 function read(filename) {
     var fso=WScript.CreateObject("Scripting.FileSystemObject");
@@ -59,7 +36,7 @@ function read(filename) {
 
 function checkTargets(targets) {
     if(!targets) {
-        Log("You do not have any android targets setup. Please create at least one target with the `android` command", true);
+        WScript.Echo("You do not have any android targets setup. Please create at least one target with the `android` command");
         WScript.Quit(69);
     }
 }
@@ -97,7 +74,7 @@ function exec(command) {
 
 function createAppInfoJar() {
     if(!fso.FileExists(ROOT+"\\bin\\templates\\cordova\\appinfo.jar")) {
-        Log("Creating appinfo.jar...");
+        WScript.Echo("Creating appinfo.jar...");
         var cur = shell.CurrentDirectory;
         shell.CurrentDirectory = ROOT+"\\bin\\templates\\cordova\\ApplicationInfo";
         exec("javac ApplicationInfo.java");
@@ -143,7 +120,7 @@ function downloadCommonsCodec() {
           stream.SaveToFile(savePath);
           stream.Close();
         } else {
-          Log('Could not retrieve the commons-codec. Please download it yourself and put into the framework/libs directory. This process may fail now. Sorry.');
+          WScript.Echo('Could not retrieve the commons-codec. Please download it yourself and put into the framework/libs directory. This process may fail now. Sorry.');
         }
       }
       var app = WScript.CreateObject('Shell.Application');
@@ -159,34 +136,23 @@ function downloadCommonsCodec() {
       fso.DeleteFolder(ROOT + '\\framework\\libs\\commons-codec-1.7', true);
     }
 }
+
+var args = WScript.Arguments, PROJECT_PATH="example", 
+    PACKAGE="org.apache.cordova.example", ACTIVITY="cordovaExample",
+    shell=WScript.CreateObject("WScript.Shell");
     
 // working dir
 var ROOT = WScript.ScriptFullName.split('\\bin\\create.js').join('');
-if (args.Count() > 0) {
-    // support help flags
-    if (args(0) == "--help" || args(0) == "/?" ||
-            args(0) == "help" || args(0) == "-help" || args(0) == "/help" || args(0) == "-h") {
-        Usage();
-        WScript.Quit(2);
-    }
 
+if (args.Count() == 3) {
     PROJECT_PATH=args(0);
-    if (args.Count() > 1) {
-        PACKAGE = args(1);
-    }
-    if (args.Count() > 2) {
-        ACTIVITY = args(2);
-    }
-}
-else {
-    Log("Error : No project path provided.");
-    Usage();
-    WScript.Quit(2);
+    PACKAGE=args(1);
+    ACTIVITY=args(2);
 }
 
 if(fso.FolderExists(PROJECT_PATH)) {
-    Log("Project already exists!", true);
-    WScript.Quit(2);
+    WScript.Echo("Project already exists!");
+    WScript.Quit(1);
 }
 
 var PACKAGE_AS_PATH=PACKAGE.replace(/\./g, '\\');
@@ -196,13 +162,13 @@ var TARGET=setTarget();
 var API_LEVEL=setApiLevel();
 var VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,'');
 // create the project
-Log("Creating new android project...");
+WScript.Echo("Creating new android project...");
 exec('android.bat create project --target '+TARGET+' --path '+PROJECT_PATH+' --package '+PACKAGE+' --activity '+ACTIVITY);
 
 // build from source. distro should have these files
 if (!fso.FileExists(ROOT+'\\cordova-'+VERSION+'.jar') &&
     !fso.FileExists(ROOT+'\\cordova-'+VERSION+'.js')) {
-    Log("Building jar and js files...");
+    WScript.Echo("Building jar and js files...");
     // update the cordova framework project to a target that exists on this machine
     exec('android.bat update project --target '+TARGET+' --path '+ROOT+'\\framework');
     // pull down commons codec if necessary
@@ -211,14 +177,14 @@ if (!fso.FileExists(ROOT+'\\cordova-'+VERSION+'.jar') &&
 }
 
 // copy in the project template
-Log("Copying template files...");
+WScript.Echo("Copying template files...");
 exec('%comspec% /c xcopy "'+ ROOT + '"\\bin\\templates\\project\\res '+PROJECT_PATH+'\\res\\ /E /Y');
 exec('%comspec% /c xcopy "'+ ROOT + '"\\bin\\templates\\project\\assets '+PROJECT_PATH+'\\assets\\ /E /Y');
 exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\project\\AndroidManifest.xml ' + PROJECT_PATH + '\\AndroidManifest.xml /Y');
 exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\project\\Activity.java '+ ACTIVITY_PATH +' /Y');
 
 // check if we have the source or the distro files
-Log("Copying js, jar & config.xml files...");
+WScript.Echo("Copying js, jar & config.xml files...");
 if(fso.FolderExists(ROOT + '\\framework')) {
     exec('%comspec% /c copy "'+ROOT+'"\\framework\\assets\\www\\cordova-'+VERSION+'.js '+PROJECT_PATH+'\\assets\\www\\cordova-'+VERSION+'.js /Y');
     exec('%comspec% /c copy "'+ROOT+'"\\framework\\cordova-'+VERSION+'.jar '+PROJECT_PATH+'\\libs\\cordova-'+VERSION+'.jar /Y');
@@ -236,17 +202,10 @@ if(fso.FolderExists(ROOT + '\\framework')) {
 
 // copy cordova scripts
 fso.CreateFolder(PROJECT_PATH + '\\cordova');
-fso.CreateFolder(PROJECT_PATH + '\\cordova\\lib');
 createAppInfoJar();
-Log("Copying cordova command tools...");
+WScript.Echo("Copying cordova command tools...");
 exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\appinfo.jar ' + PROJECT_PATH + '\\cordova\\appinfo.jar /Y');
-exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\cordova.js ' + PROJECT_PATH + '\\cordova\\lib\\cordova.js /Y');
-exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\install-device.bat ' + PROJECT_PATH + '\\cordova\\lib\\install-device.bat /Y');
-exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\install-emulator.bat ' + PROJECT_PATH + '\\cordova\\lib\\install-emulator.bat /Y');
-exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\list-emulator-images.bat ' + PROJECT_PATH + '\\cordova\\lib\\list-emulator-images.bat /Y');
-exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\list-devices.bat ' + PROJECT_PATH + '\\cordova\\lib\\list-devices.bat /Y');
-exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\list-started-emulators.bat ' + PROJECT_PATH + '\\cordova\\lib\\list-started-emulators.bat /Y');
-exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\start-emulator.bat ' + PROJECT_PATH + '\\cordova\\lib\\start-emulator.bat /Y');
+exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\cordova.js ' + PROJECT_PATH + '\\cordova\\cordova.js /Y');
 exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\cordova.bat ' + PROJECT_PATH + '\\cordova\\cordova.bat /Y');
 exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\clean.bat ' + PROJECT_PATH + '\\cordova\\clean.bat /Y');
 exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\build.bat ' + PROJECT_PATH + '\\cordova\\build.bat /Y');
@@ -254,7 +213,7 @@ exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\log.bat ' + PROJECT
 exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\run.bat ' + PROJECT_PATH + '\\cordova\\run.bat /Y');
 
 // interpolate the activity name and package
-Log("Updating AndroidManifest.xml and Main Activity...");
+WScript.Echo("Updating AndroidManifest.xml and Main Activity...");
 replaceInFile(ACTIVITY_PATH, /__ACTIVITY__/, ACTIVITY);
 replaceInFile(ACTIVITY_PATH, /__ID__/, PACKAGE);
 

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/build
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/build b/lib/cordova-android/bin/templates/cordova/build
index 3cbd9c1..e586e4d 100755
--- a/lib/cordova-android/bin/templates/cordova/build
+++ b/lib/cordova-android/bin/templates/cordova/build
@@ -1,4 +1,3 @@
-#!/bin/bash
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -16,8 +15,10 @@
 # specific language governing permissions and limitations
 # under the License.
 
+#!/bin/bash
+
 set -e
 
 CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
 
-bash "$CORDOVA_PATH"/lib/cordova build "$@"
+bash "$CORDOVA_PATH"/cordova build

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/build.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/build.bat b/lib/cordova-android/bin/templates/cordova/build.bat
index 7aa7c75..8e6ca9a 100644
--- a/lib/cordova-android/bin/templates/cordova/build.bat
+++ b/lib/cordova-android/bin/templates/cordova/build.bat
@@ -1,2 +1,18 @@
-@ECHO OFF
-%~dp0\cordova.bat build %*
\ No newline at end of file
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements.  See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership.  The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License.  You may obtain a copy of the License at
+:: 
+:: http://www.apache.org/licenses/LICENSE-2.0
+:: 
+:: Unless required by applicable law or agreed to in writing,
+:: software distributed under the License is distributed on an
+:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+:: KIND, either express or implied.  See the License for the
+:: specific language governing permissions and limitations
+:: under the License.
+
+%~dp0\cordova.bat build

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/clean
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/clean b/lib/cordova-android/bin/templates/cordova/clean
index f52966a..53b7f9a 100755
--- a/lib/cordova-android/bin/templates/cordova/clean
+++ b/lib/cordova-android/bin/templates/cordova/clean
@@ -1,4 +1,3 @@
-#!/bin/bash
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -16,8 +15,10 @@
 # specific language governing permissions and limitations
 # under the License.
 
+#!/bin/bash
+
 set -e
 
 CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
 
-bash "$CORDOVA_PATH"/lib/cordova clean "$@"
+bash "$CORDOVA_PATH"/cordova clean

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/clean.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/clean.bat b/lib/cordova-android/bin/templates/cordova/clean.bat
index b41bdc9..fe5c09f 100644
--- a/lib/cordova-android/bin/templates/cordova/clean.bat
+++ b/lib/cordova-android/bin/templates/cordova/clean.bat
@@ -1,2 +1,18 @@
-@ECHO OFF
-%~dp0\cordova.bat clean %*
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements.  See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership.  The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License.  You may obtain a copy of the License at
+:: 
+:: http://www.apache.org/licenses/LICENSE-2.0
+:: 
+:: Unless required by applicable law or agreed to in writing,
+:: software distributed under the License is distributed on an
+:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+:: KIND, either express or implied.  See the License for the
+:: specific language governing permissions and limitations
+:: under the License.
+
+%~dp0\cordova.bat clean

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/cordova
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/cordova b/lib/cordova-android/bin/templates/cordova/cordova
new file mode 100755
index 0000000..1945a4c
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/cordova
@@ -0,0 +1,159 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#!/bin/bash
+
+
+PROJECT_PATH=$( cd "$( dirname "$0" )/.." && pwd )
+
+function check_devices {
+# FIXME
+    local devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep device`
+    if [ -z "$devices"  ] ; then
+        echo "1"
+    else
+        echo "0"
+    fi
+}
+
+function emulate {
+    declare -a avd_list=($(android list avd | grep "Name:" | cut -f 2 -d ":" | xargs))
+    # we need to start adb-server
+    adb start-server 1>/dev/null
+
+    # Do not launch an emulator if there is already one running or if a device is attached
+    if [ $(check_devices) == 0 ] ; then
+        return
+    fi
+
+    local avd_id="1000" #FIXME: hopefully user does not have 1000 AVDs
+    # User has no AVDs
+    if [ ${#avd_list[@]} == 0 ]
+    then
+        echo "You don't have any Android Virtual Devices. Please create at least one AVD."
+        echo "android"
+    fi
+    # User has only one AVD
+    if [ ${#avd_list[@]} == 1 ]
+    then
+        emulator -cpu-delay 0 -no-boot-anim -cache /tmp/cache -avd ${avd_list[0]} 1> /dev/null 2>&1 &
+    # User has more than 1 AVD
+    elif [ ${#avd_list[@]} -gt 1 ]
+    then
+        while [ -z ${avd_list[$avd_id]} ]
+        do
+            echo "Choose from one of the following Android Virtual Devices [0 to $((${#avd_list[@]}-1))]:"
+            for(( i = 0 ; i < ${#avd_list[@]} ; i++ ))
+            do
+                echo "$i) ${avd_list[$i]}"
+            done
+            read -t 5 -p "> " avd_id
+            # default value if input timeout
+            if [ $avd_id -eq 1000 ] ; then avd_id=0 ; fi
+        done
+        emulator -cpu-delay 0 -no-boot-anim -cache /tmp/cache -avd ${avd_list[$avd_id]} 1> /dev/null 2>&1 &
+    fi
+    
+}
+
+function clean {
+    ant clean
+}
+# has to be used independently and not in conjunction with other commands
+function log {
+    adb logcat
+}
+
+function run {
+    clean && emulate && wait_for_device && install && launch 
+}
+
+function install {
+    
+    declare -a devices=($(adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep device | cut -f 1))
+    local device_id="1000" #FIXME: hopefully user does not have 1000 AVDs
+    
+    if [ ${#devices[@]} == 0 ]
+    then
+        # should not reach here. Emulator should launch or device should be attached
+        echo "Emulator not running or device not attached. Could not install debug package"
+        exit 70
+    fi
+    
+    if [ ${#devices[@]} == 1 ]
+    then
+        export ANDROID_SERIAL=${devices[0]}
+    # User has more than 1 AVD
+    elif [ ${#devices[@]} -gt 1 ]
+    then
+        while [ -z ${devices[$device_id]} ]
+        do
+            echo "Choose from one of the following devices/emulators [0 to $((${#devices[@]}-1))]:"
+            for(( i = 0 ; i < ${#devices[@]} ; i++ ))
+            do
+                echo "$i) ${devices[$i]}"
+            done
+            read -t 5 -p "> " device_id
+            # default value if input timeout
+            if [ $device_id -eq 1000 ] ; then device_id=0 ; fi
+        done
+        export ANDROID_SERIAL=${devices[$device_id]}
+    fi
+
+    ant debug install
+}
+
+function build {
+    ant debug
+}
+
+function release {
+    ant release
+}
+
+function wait_for_device {
+    local i="0"
+    echo -n "Waiting for device..."
+
+    while [ $i -lt 300 ]
+    do
+        if [ $(check_devices) -eq 0 ]
+        then
+            break
+        else
+            sleep 1
+            i=$[i+1]
+            echo -n "."
+        fi
+    done
+    # Device timeout: emulator has not started in time or device not attached
+    if [ $i -eq 300 ]
+    then
+        echo "device timeout!"
+        exit 69
+    else
+        echo "connected!"
+    fi
+}
+
+function launch {
+    local launch_str=$(java -jar "$PROJECT_PATH"/cordova/appinfo.jar "$PROJECT_PATH"/AndroidManifest.xml)
+    adb shell am start -n $launch_str 
+}
+
+# TODO parse arguments
+(cd "$PROJECT_PATH" && $1)

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/cordova.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/cordova.bat b/lib/cordova-android/bin/templates/cordova/cordova.bat
index 9b56199..22c289a 100644
--- a/lib/cordova-android/bin/templates/cordova/cordova.bat
+++ b/lib/cordova-android/bin/templates/cordova/cordova.bat
@@ -1,5 +1,3 @@
-@ECHO OFF
-GOTO BEGIN
 :: Licensed to the Apache Software Foundation (ASF) under one
 :: or more contributor license agreements.  See the NOTICE file
 :: distributed with this work for additional information
@@ -16,13 +14,14 @@ GOTO BEGIN
 :: KIND, either express or implied.  See the License for the
 :: specific language governing permissions and limitations
 :: under the License.
-:BEGIN
+
+@ECHO OFF
 IF NOT DEFINED JAVA_HOME GOTO MISSING
 FOR %%X in (java.exe ant.bat android.bat) do (
     SET FOUND=%%~$PATH:X
     IF NOT DEFINED FOUND GOTO MISSING
 )
-cscript %~dp0\lib\cordova.js %* //nologo
+cscript %~dp0\cordova.js %*
 GOTO END
 :MISSING
 ECHO Missing one of the following:

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/cordova.js b/lib/cordova-android/bin/templates/cordova/cordova.js
new file mode 100644
index 0000000..51533cb
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/cordova.js
@@ -0,0 +1,137 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+// http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+var ROOT = WScript.ScriptFullName.split('\\cordova\\cordova.js').join(''),
+    shell=WScript.CreateObject("WScript.Shell");
+
+function exec(command) {
+    var oExec=shell.Exec(command);
+    var output = new String();
+    while(oExec.Status == 0) {
+        if(!oExec.StdOut.AtEndOfStream) {
+            var line = oExec.StdOut.ReadLine();
+            // XXX: Change to verbose mode 
+            // WScript.StdOut.WriteLine(line);
+            output += line;
+        }
+        WScript.sleep(100);
+    }
+
+    return output;
+}
+
+function device_running() {
+    var local_devices = shell.Exec("%comspec% /c adb devices").StdOut.ReadAll();
+    if(local_devices.match(/\w+\tdevice/)) {
+        WScript.Echo("Yes");
+        return true;
+    }
+    WScript.Echo("No");
+    return false;
+}
+function emulate() {
+    // don't run emulator if a device is plugged in or if emulator is already running
+    if(device_running()) {
+        //WScript.Echo("Device or Emulator already running!");
+        return;
+    }
+    var oExec = shell.Exec("%comspec% /c android.bat list avd");
+    var avd_list = [];
+    var avd_id = -10;
+    while(!oExec.StdOut.AtEndOfStream) {
+        var output = oExec.StdOut.ReadLine();
+        if(output.match(/Name: (.)*/)) {
+            avd_list.push(output.replace(/ *Name:\s/, ""));
+        }
+    }
+    // user has no AVDs
+    if(avd_list.length == 0) {
+        WScript.Echo("You don't have any Android Virtual Devices. Please create at least one AVD.");
+        WScript.Echo("android");
+        WScript.Quit(1);
+    }
+    // user has only one AVD so we launch that one
+    if(avd_list.length == 1) {
+
+        shell.Run("emulator -cpu-delay 0 -no-boot-anim -cache %Temp%\cache -avd "+avd_list[0]);
+    }
+
+    // user has more than one avd so we ask them to choose
+    if(avd_list.length > 1) {
+        while(!avd_list[avd_id]) {
+            WScript.Echo("Choose from one of the following Android Virtual Devices [0 to "+(avd_list.length - 1)+"]:")
+            for(i = 0, j = avd_list.length ; i < j ; i++) {
+                WScript.Echo((i)+") "+avd_list[i]);
+            }
+            WScript.StdOut.Write("> ");
+            avd_id = new Number(WScript.StdIn.ReadLine());
+        }
+
+        shell.Run("emulator -cpu-delay 0 -no-boot-anim -cache %Temp%\\cache -avd "+avd_list[avd_id], 0, false);
+    }
+}
+
+function clean() {
+    WScript.Echo("Cleaning project...");
+    exec("%comspec% /c ant.bat clean -f "+ROOT+"\\build.xml 2>&1");
+}
+
+function build() {
+    WScript.Echo("Building project...");
+    exec("%comspec% /c ant.bat debug -f "+ROOT+"\\build.xml 2>&1");
+}
+
+function install() {
+    WScript.Echo("Building/Installing project...");
+    exec("%comspec% /c ant.bat debug install -f "+ROOT+"\\build.xml 2>&1");
+}
+
+function log() {
+    shell.Run("%comspec% /c adb logcat");
+}
+
+function launch() {
+    WScript.Echo("Launching app...");
+    var launch_str=exec("%comspec% /c java -jar "+ROOT+"\\cordova\\appinfo.jar "+ROOT+"\\AndroidManifest.xml");
+    //WScript.Echo(launch_str);
+    exec("%comspec% /c adb shell am start -n "+launch_str+" 2>&1");
+}
+
+function run() {
+    var i=0;
+   clean();
+   emulate();
+   WScript.Stdout.Write('Waiting for device...');
+   while(!device_running() && i < 300) {
+        WScript.Stdout.Write('.');
+        WScript.sleep(1000);
+        i += 1;
+   }
+   if(i == 300) {
+       WScript.Stderr.WriteLine("device/emulator timeout!"); 
+   } else {
+       WScript.Stdout.WriteLine("connected!");
+   }
+   install();
+   launch();
+}
+var args = WScript.Arguments;
+if(args.count() != 1) {
+    WScript.StdErr.Write("An error has occured!\n");
+    WScript.Quit(1);
+}
+eval(args(0)+"()");

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/cordova
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/cordova b/lib/cordova-android/bin/templates/cordova/lib/cordova
deleted file mode 100755
index 294df49..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/cordova
+++ /dev/null
@@ -1,386 +0,0 @@
-#!/bin/bash
-#   Licensed to the Apache Software Foundation (ASF) under one
-#   or more contributor license agreements.  See the NOTICE file
-#   distributed with this work for additional information
-#   regarding copyright ownership.  The ASF licenses this file
-#   to you under the Apache License, Version 2.0 (the
-#   "License"); you may not use this file except in compliance
-#   with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-#   Unless required by applicable law or agreed to in writing,
-#   software distributed under the License is distributed on an
-#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#   KIND, either express or implied.  See the License for the
-#   specific language governing permissions and limitations
-#   under the License.
-
-PROJECT_PATH=$( cd "$( dirname "$0" )/../.." && pwd )
-
-function list_devices {
-    IFS=$'\n'
-    devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep -v 'emulator'`
-    device_list=($devices)
-    if [[ ${#device_list[@]} > 0 ]] ; then
-        for i in ${devices[@]}
-        do
-            # remove space and 'device'
-            echo ${i/[^a-zA-Z0-9._]device/}
-        done
-    else
-        echo "No devices found."
-        exit 2
-    fi
-}
-
-function list_started_emulators {
-    IFS=$'\n'
-    devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep 'emulator'`
-    emulator_list=($devices)
-    if [[ ${#emulator_list[@]} > 0 ]] ; then
-        for i in ${emulator_list[@]}
-        do
-            # remove space and 'device'
-            echo ${i/[^a-zA-Z0-9._]device/}
-        done
-    else
-        echo "No started emulators found, you can start an emulator by using the command"
-        echo " 'cordova/lib/start-emulator'"
-        exit 2
-    fi
-}
-
-function list_emulator_images {
-    emulator_images=`android list avds | grep "Name:" | cut -f 2 -d ":"`
-    emulator_list=($emulator_images)
-    if [[ ${#emulator_list[@]} > 0 ]] ; then
-        for i in ${emulator_list[@]}
-        do
-            echo ${i/[^a-zA-Z0-9._]/}
-        done
-    else
-        echo "No emulators found, if you would like to create an emulator follow the instructions"
-        echo " provided here : http://developer.android.com/tools/devices/index.html"
-        echo " Or run 'android create avd --name <name> --target <targetID>' in on the command line."
-        exit 2
-    fi
-}
-
-function start_emulator {
-    emulator_images=`android list avds | grep "Name:" | cut -f 2 -d ":"`
-    # if target emulator is provided
-    if [[ "$#" -eq 1 ]] ; then
-        # check that it exists
-        if [[ $emulator_images =~ $1 ]] ; then
-            #xterm -e emulator -avd $1 &
-            emulator -avd $1 1> /dev/null 2>&1 &
-        else
-            echo "Could not find the provided emulator, make sure the emulator exists"
-            echo " by checking 'cordova/lib/list-emulator-images'"
-            exit 2
-        fi
-    else
-        # start first emulator
-        emulator_list=($emulator_images)
-        if [[ ${#emulator_list[@]} > 0 ]] ; then
-            #xterm -e emulator -avd ${emulator_list[0]} &
-            emulator -avd ${emulator_list[0]/[^a-zA-Z0-9._]/} 1> /dev/null 2>&1 &
-        else
-            echo "No emulators found, if you would like to create an emulator follow the instructions"
-            echo " provided here : http://developer.android.com/tools/devices/index.html"
-            echo " Or run 'android create avd --name <name> --target <targetID>' in on the command line."
-            exit 2
-        fi
-    fi
-}
-
-function install_device {
-    IFS=$'\n'
-    devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep -v 'emulator'`
-    device_list=($devices)
-    if [[ ${#device_list[@]} > 0 ]] ; then
-        apks=`find $PROJECT_PATH/bin -type f -maxdepth 1 | egrep '\.apk$'`
-        apk_list=($apks)
-        if [[ ${#apk_list[@]} > 0 ]] ; then
-            local target
-            # handle target emulator
-            if [[ "$#" -eq 1 ]] ; then
-                # deploy to given target
-                target=${1/--target=/}
-            else
-                # delete trailing space and 'device' after device ID
-                target=${device_list[0]/[^a-zA-Z0-9._]device/}
-            fi
-            echo "Installing ${apk_list[0]} onto device $target..."
-            adb -s $target install -r ${apk_list[0]};
-            echo "Launching application..."
-            local launch_str=$(java -jar "$PROJECT_PATH"/cordova/appinfo.jar "$PROJECT_PATH"/AndroidManifest.xml)
-            adb -s $target shell am start -W -a android.intent.action.MAIN -n $launch_str
-        else
-            echo "Application package not found, could not install to device"
-            echo " make sure your application is built before deploying."
-            exit 2
-        fi
-    else
-        echo "No devices found to deploy to. Please make sure your device is connected"
-        echo " and you can view it using the 'cordova/lib/list-devices' command."
-        exit 2
-    fi
-}
-
-function install_emulator {
-    IFS=$'\n'
-    # check that there is an emulator to deploy to
-    emulator_string=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'emulator'`
-    emulator_list=($emulator_string)
-    if [[ ${#emulator_list[@]} > 0 ]] ; then
-        apks=`find $PROJECT_PATH/bin -type f -maxdepth 1 | egrep '\.apk$'`
-        apk_list=($apks)
-        if [[ ${#apk_list[@]} > 0 ]] ; then
-            local target
-            # handle target emulator
-            if [[ "$#" -eq 1 ]] ; then
-                # deploy to given target
-                target=${1/--target=/}
-            else
-                # delete trailing space and 'device' after emulator ID
-                target=${emulator_list[0]/[^a-zA-Z0-9._]device/}
-            fi
-            echo "Installing ${apk_list[0]} onto $target..."
-            adb -s $target install -r ${apk_list[0]};
-            echo "Launching application..."
-            local launch_str=$(java -jar "$PROJECT_PATH"/cordova/appinfo.jar "$PROJECT_PATH"/AndroidManifest.xml)
-            adb -s $target shell am start -W -a android.intent.action.MAIN -n $launch_str
-
-        else
-            echo "Application package not found, could not install to device"
-            echo " make sure your application is built before deploying."
-            exit 2
-        fi
-    else
-        echo "No emulators found to deploy to. Please make sure your emulator is started"
-        echo " and you can view it using the 'cordova/lib/list-started-emulators' command."
-        exit 2
-    fi
-}
-
-# cleans the project
-function clean {
-    echo "Cleaning project..."
-    ant clean
-}
-
-# has to be used independently and not in conjunction with other commands
-function log {
-    # filter out nativeGetEnabledTags spam from latest sdk bug.
-    adb logcat | grep -v nativeGetEnabledTags
-}
-
-
-function build {
-    if [[ "$#" -eq 1 ]] ; then
-        if [[ $1 == "--debug" ]] ; then
-            clean
-            ant debug -f "$PROJECT_PATH"/build.xml
-        elif [[ $1 == "--release" ]] ; then
-            clean
-            ant release -f "$PROJECT_PATH"/build.xml
-        elif [[ $1 == "--nobuild" ]] ; then
-            echo "Skipping build..."
-        else
-            echo "Error : Build command '$1' not recognized."
-            exit 2
-        fi
-    else
-        echo "Warning : [ --debug | --release | --nobuild ] not specified, defaulting to --debug"
-        clean
-        ant debug -f "$PROJECT_PATH"/build.xml
-    fi
-}
-
-
-function wait_for_emulator {
-    emulator_string=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep 'emulator'`
-    old_started=($emulator_string)
-    local new_started
-    local new_emulator_name
-    local i="0"
-    echo -n "Waiting for emulator..."
-    while [ $i -lt 300 ]
-    do
-        emulator_string=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep 'emulator'`
-        new_started=($emulator_string)
-        if [[ ${#new_started[@]} > ${#old_started[@]} && -z "$new_emulator_name" ]] ; then
-            # get the name of the started emulator
-            local count="0"
-            if [[ ${#old_started[@]} == 0 ]] ; then
-                new_emulator_name=${new_started[$count]/[^a-zA-Z0-9._]device/}
-            else
-                for count in {0...${#old_started[@]}}
-                do
-                    if [[ ! ${new_started[$count]} == ${old_started[$count]} ]] ; then
-                        new_emulator_name=${new_started[$count]/[^a-zA-Z0-9._]device/}
-                    fi
-                done
-                if [[ -z "$new_emulator_name" ]] ; then
-                    count=$[count+1]
-                    new_emulator_name=${new_started[$count]/[^a-zA-Z0-9._]device/}
-                fi
-            fi
-        elif [[ "$new_emulator_name" ]] ; then
-            boot_anim=`adb -s $new_emulator_name shell getprop init.svc.bootanim`
-            if [[ $boot_anim =~ "stopped" ]] ; then
-                break
-            else
-                sleep 1
-                i=$[i+1]
-                echo -n "."
-            fi
-        else
-            sleep 1
-            i=$[i+1]
-            echo -n "."
-        fi
-    done
-    # Device timeout: emulator has not started in time
-    if [ $i -eq 300 ]
-    then
-        echo "emulator timeout!"
-        exit 69
-    else
-        echo "connected!"
-    fi
-}
-
-function run {
-    IFS=$'\n'
-    if [[ "$#" -eq 2 ]] ; then
-        build $2
-        if [[ $1 == "--device" ]] ; then
-            install_device
-        elif [[ $1 == "--emulator" ]] ; then
-            install_emulator
-        elif [[ $1 =~ "--target=" ]]; then
-            install_device $1
-        else
-            echo "Error : '$1' is not recognized as an install option"
-        fi
-    elif [[ "$#" -eq 1 ]] ; then
-        if [[ $1 == "--debug" || $1 == "--release" || $1 == "--nobuild" ]] ; then
-            build $1
-        elif [[ $1 == "--device" ]] ; then
-            install_device
-        elif [[ $1 == "--emulator" ]] ; then
-            install_emulator
-        elif [[ $1 =~ "--target=" ]]; then
-            install_device $1
-        else
-            echo "Error : '$1' is not recognized as an install option"
-        fi
-    else
-        echo "Warning : [ --device | --emulate | --target=<targetID> ] not specified, using defaults."
-        build
-        devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep -v 'emulator'`
-        device_list=($devices)
-        emulator_string=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep 'emulator'`
-        emulator_list=($emulator_string)
-        if [[ ${#device_list[@]} > 0 ]] ; then
-            install_device
-        elif [[ ${#emulator_list[@]} > 0 ]] ; then
-            install_emulator
-        else
-            emulator_images=`android list avds | grep "Name:" | cut -f 2 -d ":"`
-            echo $emulator_images
-            emulator_image_list=($emulator_images)
-            if [[ ${#emulator_image_list[@]} > 0 ]] ; then
-                echo "Starting emulator : ${emulator_image_list[0]}" 
-                emulator -avd ${emulator_image_list[0]/[^.\w]/} 1> /dev/null 2>&1 &
-                wait_for_emulator
-                install_emulator
-            else
-                # TODO : look for emulator images and start one if it's availible
-                echo "Error : there are no availible devices or emulators to deploy to."
-                echo " create an emulator or connect your device to run this command."
-                echo "If you would like to create an emulator follow the instructions"
-                echo " provided here : http://developer.android.com/tools/devices/index.html"
-                echo " Or run 'android create avd --name <name> --target <targetID>' in on the command line."
-                exit 2
-            fi
-        fi
-    fi
-}
-
-# parse command line arguments
-
-if [[ $# > 3 ]] ; then 
-    echo "Error :  too many arguments."
-    exit 2
-elif [[ $# == 3 ]] ; then
-    if [[ $1 == "run" ]] ; then
-        run $2 $3
-    else
-        echo "Error : too many arguments for '$1'"
-        exit 2
-    fi
-elif [[ $# == 2 ]] ; then
-    if [[ $1 == "run" ]] ; then
-        if [[ $2 == "--emulator" || $2 == "--device" || $2 =~ "--target=" ]] ; then
-            run $2 ''
-        elif [[ $2 == "--debug" || $2 == "--release" || $2 == "--nobuild" ]] ; then
-            run '' $2
-        else 
-            echo "Error : '$2' is not recognized as a run option."
-            exit 2
-        fi
-    elif [[ $1 == "build" ]] ; then
-        build $2
-    elif [[ $1 == "start-emulator" ]] ; then
-        start_emulator $2
-    elif [[ $1 == "install-device" ]] ; then
-        if [[ $2 =~ "--target=" ]] ; then
-            install_device $2
-        else
-            echo "Error : '$2' is not recognized as an install option"
-            exit 2
-        fi
-    elif [[ $1 == "install-emulator" ]] ; then
-        if [[ $2 =~ "--target=" ]] ; then
-            install_emulator $2
-        else
-            echo "Error : '$2' is not recognized as an install option"
-            exit 2
-        fi
-    else
-        echo "Error : '$1' is not recognized as an option that takes arguments"
-        exit 2
-    fi
-elif [[ $# == 1 ]] ; then
-    if [[ $1 == "run" ]] ; then
-        run
-    elif [[ $1 == "build" ]]; then
-        build
-    elif [[ $1 == "clean" ]]; then
-        clean
-    elif [[ $1 == "log" ]]; then
-        log
-    elif [[ $1 == "list-devices" ]]; then
-        list_devices
-    elif [[ $1 == "list-emulator-images" ]]; then
-        list_emulator_images
-    elif [[ $1 == "list-started-emulators" ]]; then
-        list_started_emulators
-    elif [[ $1 == "install-device" ]]; then
-        install_device
-    elif [[ $1 == "install-emulator" ]]; then
-        install_emulator
-    elif [[ $1 == "start-emulator" ]]; then
-        start_emulator
-    else
-        echo "Error : '$1' is not recognized as a tooling command."
-        exit 2
-    fi
-else
-    echo "Error : No command recieved, exiting..."
-    exit 2
-fi
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/cordova.js b/lib/cordova-android/bin/templates/cordova/lib/cordova.js
deleted file mode 100644
index 28f9b3e..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/cordova.js
+++ /dev/null
@@ -1,593 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-// 
-// http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-var ROOT  = WScript.ScriptFullName.split('\\cordova\\lib\\cordova.js').join(''),
-    shell = WScript.CreateObject("WScript.Shell"),
-    fso   = WScript.CreateObject('Scripting.FileSystemObject');
-
-
-// log to stdout or stderr
-function Log(msg, error) {
-    if (error) {
-        WScript.StdErr.WriteLine(msg);
-    }
-    else {
-        WScript.StdOut.WriteLine(msg);
-    }
-} 
-
-// executes a commmand in the shell, returning stdout
-function exec(command) {
-    var oExec=shell.Exec(command);
-    var output = new String();
-    while (oExec.Status == 0) {
-        if (!oExec.StdOut.AtEndOfStream) {
-            var line = oExec.StdOut.ReadLine();
-            output += line;
-        }
-        WScript.sleep(100);
-    }
-    return output;
-}
-
-// executes a command in the shell, returns stdout or stderr if error
-function exec_out(command) {
-    var oExec=shell.Exec(command);
-    var output = new String();
-    while (oExec.Status == 0) {
-        if (!oExec.StdOut.AtEndOfStream) {
-            var line = oExec.StdOut.ReadLine();
-            // XXX: Change to verbose mode 
-            // WScript.StdOut.WriteLine(line);
-            output += line;
-        }
-        WScript.sleep(100);
-    }
-    //Check to make sure our scripts did not encounter an error
-    if (!oExec.StdErr.AtEndOfStream) {
-        var line = oExec.StdErr.ReadAll();
-        return {'error' : true, 'output' : line};
-    }
-    return {'error' : false, 'output' : output};
-}
-
-// executes a commmand in the shell and outputs stdout and fails on stderr
-function exec_verbose(command) {
-    //Log("Command: " + command);
-    var oShell=shell.Exec(command);
-    while (oShell.Status == 0) {
-        //Wait a little bit so we're not super looping
-        WScript.sleep(100);
-        //Print any stdout output from the script
-        if (!oShell.StdOut.AtEndOfStream) {
-            var line = oShell.StdOut.ReadLine();
-            Log(line);
-        }
-    }
-    //Check to make sure our scripts did not encounter an error
-    if (!oShell.StdErr.AtEndOfStream) {
-        var line = oShell.StdErr.ReadAll();
-        Log(line, true);
-        WScript.Quit(2);
-    }
-}
-
-function get_devices() {
-    var device_list = []
-    var local_devices = shell.Exec("%comspec% /c adb devices").StdOut.ReadAll();
-    if (local_devices.match(/\w+\tdevice/)) {
-        devices = local_devices.split('\r\n');
-        //format (ID DESCRIPTION)
-        for (i in devices) {
-            if (devices[i].match(/\w+\tdevice/) && !devices[i].match(/emulator/)) {
-                device_list.push(devices[i].replace(/\t/, ' '));
-            }
-        }
-    }
-    return device_list
-}
-
-function list_devices() {
-    var devices = get_devices();
-    if (devices.length > 0) {
-        for (i in devices) {
-            Log(devices[i]);
-        }
-    }
-    else {
-        Log('No devices found, if your device is connected and not showing,');
-        Log(' then try and install the drivers for your device.');
-        Log(' http://developer.android.com/tools/extras/oem-usb.html');
-    }
-
-}
-
-function get_emulator_images() {
-    // discription contains all data recieved squashed onto one line
-    var add_description = true;
-    var avd_list = [];
-    var local_emulators = shell.Exec("%comspec% /c android list avds").StdOut.ReadAll();
-    if (local_emulators.match(/Name\:/)) {
-        emulators = local_emulators.split('\n');
-        //format (ID DESCRIPTION)
-        var count = 0;
-        var output = '';
-        for (i in emulators) {
-            if (emulators[i].match(/Name\:/)) {
-                var emulator_name = emulators[i].replace(/\s*Name\:\s/, '') + ' ';
-                if (add_description) {
-                    count = 1;
-                    output += emulator_name
-                }
-                else {
-                    avd_list.push(emulator_name);
-                }
-            }
-            // add description if indicated (all data squeezed onto one line)
-            if (count > 0) {
-                var emulator_description = emulators[i].replace(/\s*/g, '');
-                if (count > 4) {
-                    avd_list.push(output + emulator_description);
-                    count = 0;
-                    output = '';
-                }
-                else {
-                    count++;
-                    output += emulator_description + ' '
-                }
-            }
-        }
-    }
-    return avd_list;
-}
-
-function list_emulator_images() {
-    var images = get_emulator_images();
-    if (images.length > 0) {
-        for(i in images) {
-            Log(images[i]);
-        }
-    }
-    else {
-        Log('No emulators found, if you would like to create an emulator follow the instructions');
-        Log(' provided here : http://developer.android.com/tools/devices/index.html');
-        Log(' Or run \'android create avd --name <name> --target <targetID>\' in on the command line.');
-    }
-}
-
-function get_started_emulators() {
-    var started_emulators = [];
-    var local_devices = shell.Exec("%comspec% /c adb devices").StdOut.ReadAll();
-    if (local_devices.match(/emulator/)) {
-        devices = local_devices.split('\r\n');
-        //format (ID DESCRIPTION)
-        for (i in devices) {
-            if (devices[i].match(/\w+\tdevice/) && devices[i].match(/emulator/)) {
-                started_emulators.push(devices[i].replace(/\t/, ' '));
-            }
-        }
-    }
-    return started_emulators
-}
-
-function list_started_emulators() {
-    var images = get_started_emulators();
-    if (images.length > 0) {
-        for(i in images) {
-            Log(images[i]);
-        }
-    }
-    else {
-        Log('No started emulators found, if you would like to start an emulator call \'list-emulator-images\'');
-        Log(' to get the name of an emulator and then start the emulator with \'start-emulator <Name>\'');
-    }
-}
-
-function start_emulator(name) {  
-    var emulators = get_emulator_images();
-    var started_emulators = get_started_emulators();
-    var num_started = started_emulators.length;
-    var emulator_name;
-    var started = false;
-    if (name) {
-        for (i in emulators) {
-            if (emulators[i].substr(0,name.length) == name) {
-                Log("Starting emulator : " + name);
-                shell.Run("%comspec% /c start cmd /c emulator -avd " + name);
-                //shell.Run("%comspec% /c start cmd /c emulator -cpu-delay 0 -no-boot-anim -cache %Temp%\cache -avd " + name);
-                started = true;
-            }
-        }
-    }
-    else {
-        if (emulators.length > 0 && started_emulators < 1) {
-            emulator_name = emulators[0].split(' ', 1)[0];
-            start_emulator(emulator_name);
-            return;
-        } else if (started_emulators.length > 0) {
-            Log("Emulator already started : " + started_emulators[0].split(' ', 1));
-            return;
-        } else {
-            Log("Error : unable to start emulator, ensure you have emulators availible by checking \'list-emulator-images\'", true);
-            WScript.Quit(2);
-        }
-    }
-    if (!started) {
-        Log("Error : unable to start emulator, ensure you have emulators availible by checking \'list-emulator-images\'", true);
-        WScript.Quit(2);
-    }
-    else { // wait for emulator to boot before returning
-        WScript.Stdout.Write('Booting up emulator..');
-        var boot_anim = null;
-        var emulator_ID = null;
-        var new_started = get_started_emulators();
-        var i = 0;
-        // use boot animation property to tell when boot is complete.
-        while ((boot_anim == null || !boot_anim.output.match(/stopped/)) && i < 100) {
-            if (new_started.length > started_emulators.length && emulator_ID == null) {
-                // find new emulator that was just started to get it's ID
-                for(var i = 0; i < new_started.length; i++) {
-                    if (new_started[i] != started_emulators[i]) {
-                        emulator_ID = new_started[i].split(' ', 1)[0];
-                        boot_anim = exec_out('%comspec% /c adb -s ' + emulator_ID + ' shell getprop init.svc.bootanim');
-                        break;
-                    }
-                }
-            }
-            else if (boot_anim == null) {
-                new_started = get_started_emulators(); 
-            }
-            else {
-                boot_anim = exec_out('%comspec% /c adb -s ' + emulator_ID + ' shell getprop init.svc.bootanim'); 
-            }
-            i++;
-            WScript.Stdout.Write('.');
-            WScript.Sleep(2000);
-        }
-        if (i < 100) {
-            Log('\nBoot Complete!');
-        } else {
-             Log('\nEmulator boot timed out. Failed to load emulator');
-             WScript.Quit(2);
-        }
-    }
-}
-
-function install_device(target) {
-    var devices = get_devices();
-    var use_target = false;
-    if (devices.length < 1) {
-        Log("Error : No devices found to install to, make sure there are devices", true);
-        Log(" availible by checking \'<project_dir>\\cordova\\lib\\list-devices\'", true);
-        WScript.Quit(2);
-    }
-    if (target) {
-        var exists = false;
-        for (i in devices) {
-            if (devices[i].substr(0,target.length) == target)
-            {
-                exists = true;
-                break;
-            }
-        }
-        if (!exists) {
-            Log("Error : Unable to find target " + target, true);
-            Log("Please ensure the target exists by checking \'<project>\\cordova\\lib\\list-devices'");
-            WScript.Quit(2);
-        }
-        use_target = true;
-    }
-    // check if file .apk has been created
-    if (fso.FolderExists(ROOT + '\\bin')) {
-        var path_to_apk;
-        var out_folder = fso.GetFolder(ROOT + '\\bin');
-        var out_files = new Enumerator(out_folder.Files);
-        for (;!out_files.atEnd(); out_files.moveNext()) {
-            var path = out_files.item() + '';
-            if (fso.GetExtensionName(path) == 'apk' && !path.match(/unaligned/)) {
-                path_to_apk = out_files.item();
-                break;
-            }
-        }
-        if (path_to_apk) {
-            var launch_name = exec_out("%comspec% /c java -jar "+ROOT+"\\cordova\\appinfo.jar "+ROOT+"\\AndroidManifest.xml");
-            if (launch_name.error) {
-                Log("Failed to get application name from appinfo.jar + AndroidManifest : ", true);
-                Log("Output : " + launch_name.output, true);
-                WScript.Quit(2);
-            }
-            // install on device (-d)
-            Log("Installing app on device...");
-            var cmd;
-            if (use_target) {
-                cmd = '%comspec% /c adb -s ' + target + ' install -r ' + path_to_apk;
-            } else {
-                cmd = '%comspec% /c adb -s ' + devices[0].split(' ', 1)[0] + ' install -r ' + path_to_apk;
-            }
-            var install = exec_out(cmd);
-            if ( install.error && install.output.match(/Failure/)) {
-                Log("Error : Could not install apk to device : ", true);
-                Log(install.output, true);
-                WScript.Quit(2);
-            }
-            else {
-                Log(install.output);
-            }
-            // run on device
-            Log("Launching application...");
-            cmd;
-            if (use_target) {
-                cmd = '%comspec% /c adb -s ' + target + ' shell am start -W -a android.intent.action.MAIN -n ' + launch_name.output;
-            } else {
-                cmd = '%comspec% /c adb -s ' + devices[0].split(' ', 1)[0] + ' shell am start -W -a android.intent.action.MAIN -n ' + launch_name.output;
-            }
-            exec_verbose(cmd);
-        }
-        else {
-            Log('Failed to find apk, make sure you project is built and there is an ', true);
-            Log(' apk in <project>\\bin\\.  To build your project use \'<project>\\cordova\\build\'', true);
-            WScript.Quit(2);
-        }
-    }
-}
-
-function install_emulator(target) {
-    var emulators = get_started_emulators();
-    var use_target = false;
-    if (emulators.length < 1) {
-        Log("Error : No emulators found to install to, make sure there are emulators", true);
-        Log(" availible by checking \'<project_dir>\\cordova\\lib\\list-started-emulators\'", true);
-        WScript.Quit(2);
-    }
-    if (target) {
-        var exists = false;
-        for (i in emulators) {
-            if (emulators[i].substr(0,target.length) == target)
-            {
-                exists = true;
-                break;
-            }
-        }
-        if (!exists) {
-            Log("Error : Unable to find target " + target, true);
-            Log("Please ensure the target exists by checking \'<project>\\cordova\\lib\\list-started-emulators'")
-        }
-        use_target = true;
-    } else {
-        target = emulators[0].split(' ', 1)[0];
-        Log("Deploying to emulator : " + target);
-    }
-    // check if file .apk has been created
-    if (fso.FolderExists(ROOT + '\\bin')) {
-        var path_to_apk;
-        var out_folder = fso.GetFolder(ROOT + '\\bin');
-        var out_files = new Enumerator(out_folder.Files);
-        for (;!out_files.atEnd(); out_files.moveNext()) {
-            var path = out_files.item() + '';
-            if (fso.GetExtensionName(path) == 'apk' && !path.match(/unaligned/)) {
-                path_to_apk = out_files.item();
-                break;
-            }
-        }
-        if (path_to_apk) {
-            var launch_name = exec_out("%comspec% /c java -jar "+ROOT+"\\cordova\\appinfo.jar "+ROOT+"\\AndroidManifest.xml");
-            if (launch_name.error) {
-                Log("Failed to get application name from appinfo.jar + AndroidManifest : ", true);
-                Log("Output : " + launch_name.output, true);
-                WScript.Quit(2);
-            }
-            // install on emulator (-e)
-            Log("Installing app on emulator...");
-            var cmd = '%comspec% /c adb -s ' + target + ' install -r ' + path_to_apk;
-            var install = exec_out(cmd);
-            if ( install.error && install.output.match(/Failure/)) {
-                Log("Error : Could not install apk to emulator : ", true);
-                Log(install.output, true);
-                WScript.Quit(2);
-            }
-            else {
-                Log(install.output);
-            }
-            // run on emulator
-            Log("Launching application...");
-            cmd;
-            if (use_target) {
-                cmd = '%comspec% /c adb -s ' + target + ' shell am start -W -a android.intent.action.MAIN -n ' + launch_name.output;
-            } else {
-                cmd = '%comspec% /c adb -s ' + emulators[0].split(' ', 1)[0] + ' shell am start -W -a android.intent.action.MAIN -n ' + launch_name.output
-            }
-            exec_verbose(cmd);
-        }
-        else {
-            Log('Failed to find apk, make sure you project is built and there is an ', true);
-            Log(' apk in <project>\\bin\\.  To build your project use \'<project>\\cordova\\build\'', true);
-            WScript.Quit(2);
-        }
-    }
-    else {
-        Log('Failed to find apk, make sure you project is built and there is an ', true);
-        Log(' apk in <project>\\bin\\.  To build your project use \'<project>\\cordova\\build\'', true);
-        WScript.Quit(2);
-    }
-}
-
-function clean() {
-    Log("Cleaning project...");
-    exec("%comspec% /c ant.bat clean -f "+ROOT+"\\build.xml 2>&1");
-}
-
-function build(build_type) {
-    if (build_type) {
-        switch (build_type) {
-            case "--debug" :
-                clean();
-                Log("Building project...");
-                exec_verbose("%comspec% /c ant.bat debug -f "+ROOT+"\\build.xml 2>&1");
-                break;
-            case "--release" :
-                clean();
-                Log("Building project...");
-                exec_verbose("%comspec% /c ant.bat release -f "+ROOT+"\\build.xml 2>&1");
-                break;
-            case "--nobuild" :
-                Log("Skipping build process.");
-                break;
-            default :
-                Log("Build option not recognized: " + build_type, true);
-                WScript.Quit(2);
-                break;
-        }
-    }
-    else {
-        Log("WARNING: [ --debug | --release | --nobuild ] not specified, defaulting to --debug.");
-        exec_verbose("%comspec% /c ant.bat debug -f "+ROOT+"\\build.xml 2>&1");
-    }
-}
-
-function log() {
-    // filter out nativeGetEnabledTags spam from latest sdk bug.
-    shell.Run("%comspec% /c adb logcat | grep -v nativeGetEnabledTags");
-}
-
-function run(target, build_type) {
-    var use_target = false;
-    if (!target) {
-        Log("WARNING: [ --target=<ID> | --emulator | --device ] not specified, using defaults");
-    }
-    // build application
-    build(build_type);
-    // attempt to deploy to connected device 
-    var devices = get_devices();
-    if (devices.length > 0 || target == "--device") {
-        if (target) {
-            if (target.substr(0,9) == "--target=") {
-                install_device(target.split('--target=').join(''))
-            } else if (target == "--device") {
-                install_device();
-            } else {
-                Log("Did not regognize " + target + " as a run option.", true);
-                WScript.Quit(2);
-            }
-        }
-        else {
-            Log("WARNING: [ --target=<ID> | --emulator | --device ] not specified, using defaults");
-            install_device();
-        }
-    }
-    else {
-        var emulators = get_started_emulators();
-        if (emulators.length > 0) {
-            install_emulator();
-        }
-        else {
-            var emulator_images = get_emulator_images();
-            if (emulator_images.length < 1) {
-                Log('No emulators found, if you would like to create an emulator follow the instructions', true);
-                Log(' provided here : http://developer.android.com/tools/devices/index.html', true);
-                Log(' Or run \'android create avd --name <name> --target <targetID>\' in on the command line.', true);
-                WScript.Quit(2);
-            }
-            start_emulator(emulator_images[0].split(' ')[0]);
-            emulators = get_started_emulators();
-            if (emulators.length > 0) {
-                install_emulator();
-            }
-            else {
-                Log("Error : emulator failed to start.", true);
-                WScript.Quit(2);
-            }
-        }
-    }
-}
-
-var args = WScript.Arguments;
-if (args.count() == 0) {
-    Log("Error: no args provided.");
-    WScript.Quit(2);
-}
-else {
-    if (args(0) == "build") {
-        if (args.Count() > 1) {
-            build(args(1))
-        } else {
-            build();
-        }
-    } else if (args(0) == "clean") {
-        clean();
-    } else if (args(0) == "list-devices") {
-        list_devices();
-    } else if (args(0) == "list-emulator-images") {
-        list_emulator_images();
-    } else if (args(0) == "list-started-emulators") {
-        list_started_emulators();
-    } else if (args(0) == "start-emulator") {
-        if (args.Count() > 1) {
-            start_emulator(args(1))
-        } else {
-            start_emulator();
-        }
-    } else if (args(0) == "log") {
-        log();
-    } else if (args(0) == "install-emulator") {
-        if (args.Count() == 2) {
-            if (args(1).substr(0,9) == "--target=") {
-                install_emulator(args(1).split('--target=').join(''));
-            } else {
-                Log('Error: \"' + args(1) + '\" is not recognized as an install option', true);
-                WScript.Quit(2);
-            }
-        } else {
-            install_emulator();
-        }
-    } else if (args(0) == "install-device") {
-        if (args.Count() == 2) {
-            if (args(1).substr(0,9) == "--target=") {
-                install_device(args(1).split('--target=').join(''));
-            } else {
-                Log('Error: \"' + args(1) + '\" is not recognized as an install option', true);
-                WScript.Quit(2);
-            }
-        } else {
-            install_device();
-        }
-    } else if (args(0) == "run") {
-        if (args.Count() == 3) {
-            run(args(1), args(2));
-        }
-        else if (args.Count() == 2) {
-            if (args(1).substr(0,9) == "--target=" ||
-               args(1) == "--emulator" ||
-               args(1) == "--device") {
-                run(args(1));
-            } else if (args(1) == "--debug" ||
-                       args(1) == "--release" ||
-                       args(1) == "--nobuild") {
-                run(null, args(1))
-            } else {
-                Log('Error: \"' + args(1) + '\" is not recognized as a run option', true);
-                WScript.Quit(2);
-            }
-        }
-        else {
-            run();
-        }
-    } else {
-        Log('Error: \"' + args(0) + '\" is not recognized as a tooling command', true);
-        WScript.Quit(2);
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/install-device
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/install-device b/lib/cordova-android/bin/templates/cordova/lib/install-device
deleted file mode 100755
index 604b5ae..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/install-device
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -e
-
-CORDOVA_LIB_PATH=$( cd "$( dirname "$0" )" && pwd )
-
-bash "$CORDOVA_LIB_PATH"/cordova install-device "$@"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/install-device.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/install-device.bat b/lib/cordova-android/bin/templates/cordova/lib/install-device.bat
deleted file mode 100644
index 52d9775..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/install-device.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@ECHO OFF
-SET full_path=%~dp0
-IF EXIST %full_path%cordova.js (
-    cscript "%full_path%cordova.js" install-device %* //nologo
-) ELSE (
-    ECHO. 
-    ECHO ERROR: Could not find 'cordova.js' in cordova/lib, aborting...>&2
-    EXIT /B 1
-)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/install-emulator
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/install-emulator b/lib/cordova-android/bin/templates/cordova/lib/install-emulator
deleted file mode 100755
index 105e2ee..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/install-emulator
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -e
-
-CORDOVA_LIB_PATH=$( cd "$( dirname "$0" )" && pwd )
-
-bash "$CORDOVA_LIB_PATH"/cordova install-emulator "$@"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/install-emulator.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/install-emulator.bat b/lib/cordova-android/bin/templates/cordova/lib/install-emulator.bat
deleted file mode 100644
index d11a7be..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/install-emulator.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@ECHO OFF
-SET full_path=%~dp0
-IF EXIST %full_path%cordova.js (
-    cscript "%full_path%cordova.js" install-emulator %* //nologo
-) ELSE (
-    ECHO. 
-    ECHO ERROR: Could not find 'cordova.js' in cordova/lib, aborting...>&2
-    EXIT /B 1
-)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/list-devices
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/list-devices b/lib/cordova-android/bin/templates/cordova/lib/list-devices
deleted file mode 100755
index 7a5b2f5..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/list-devices
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -e
-
-CORDOVA_LIB_PATH=$( cd "$( dirname "$0" )" && pwd )
-
-bash "$CORDOVA_LIB_PATH"/cordova list-devices
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/list-devices.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/list-devices.bat b/lib/cordova-android/bin/templates/cordova/lib/list-devices.bat
deleted file mode 100644
index c146f10..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/list-devices.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@ECHO OFF
-SET full_path=%~dp0
-IF EXIST %full_path%cordova.js (
-    cscript "%full_path%cordova.js" list-devices //nologo
-) ELSE (
-    ECHO. 
-    ECHO ERROR: Could not find 'cordova.js' in cordova/lib, aborting...>&2
-    EXIT /B 1
-)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/list-emulator-images
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/list-emulator-images b/lib/cordova-android/bin/templates/cordova/lib/list-emulator-images
deleted file mode 100755
index db8e563..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/list-emulator-images
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -e
-
-CORDOVA_LIB_PATH=$( cd "$( dirname "$0" )" && pwd )
-
-bash "$CORDOVA_LIB_PATH"/cordova list-emulator-images
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/list-emulator-images.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/list-emulator-images.bat b/lib/cordova-android/bin/templates/cordova/lib/list-emulator-images.bat
deleted file mode 100644
index 172520b..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/list-emulator-images.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@ECHO OFF
-SET full_path=%~dp0
-IF EXIST %full_path%cordova.js (
-    cscript "%full_path%cordova.js" list-emulator-images //nologo
-) ELSE (
-    ECHO. 
-    ECHO ERROR: Could not find 'cordova.js' in cordova/lib, aborting...>&2
-    EXIT /B 1
-)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/list-started-emulators
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/list-started-emulators b/lib/cordova-android/bin/templates/cordova/lib/list-started-emulators
deleted file mode 100755
index 7911763..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/list-started-emulators
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -e
-
-CORDOVA_LIB_PATH=$( cd "$( dirname "$0" )" && pwd )
-
-bash "$CORDOVA_LIB_PATH"/cordova list-started-emulators
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/list-started-emulators.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/list-started-emulators.bat b/lib/cordova-android/bin/templates/cordova/lib/list-started-emulators.bat
deleted file mode 100644
index f1b3c5d..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/list-started-emulators.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@ECHO OFF
-SET full_path=%~dp0
-IF EXIST %full_path%cordova.js (
-    cscript "%full_path%cordova.js" list-started-emulators //nologo
-) ELSE (
-    ECHO. 
-    ECHO ERROR: Could not find 'cordova.js' in cordova/lib, aborting...>&2
-    EXIT /B 1
-)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/start-emulator
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/start-emulator b/lib/cordova-android/bin/templates/cordova/lib/start-emulator
deleted file mode 100755
index 8e8964d..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/start-emulator
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -e
-
-CORDOVA_LIB_PATH=$( cd "$( dirname "$0" )" && pwd )
-
-bash "$CORDOVA_LIB_PATH"/cordova start-emulator "$@"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/lib/start-emulator.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/lib/start-emulator.bat b/lib/cordova-android/bin/templates/cordova/lib/start-emulator.bat
deleted file mode 100644
index 4f3fb5d..0000000
--- a/lib/cordova-android/bin/templates/cordova/lib/start-emulator.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@ECHO OFF
-SET full_path=%~dp0
-IF EXIST %full_path%cordova.js (
-    cscript "%full_path%cordova.js" start-emulator %* //nologo
-) ELSE (
-    ECHO. 
-    ECHO ERROR: Could not find 'cordova.js' in cordova/lib, aborting...>&2
-    EXIT /B 1
-)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/298ad426/lib/cordova-android/bin/templates/cordova/log
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/log b/lib/cordova-android/bin/templates/cordova/log
index 01fe107..087a200 100755
--- a/lib/cordova-android/bin/templates/cordova/log
+++ b/lib/cordova-android/bin/templates/cordova/log
@@ -1,4 +1,3 @@
-#!/bin/bash
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -16,8 +15,10 @@
 # specific language governing permissions and limitations
 # under the License.
 
+#!/bin/bash
+
 set -e
 
 CORDOVA_PATH=$( cd "$( dirname "$0" )/.." && pwd )
 
-bash "$CORDOVA_PATH"/cordova/lib/cordova log "$@"
+bash "$CORDOVA_PATH"/cordova/cordova log


Mime
View raw message