You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2013/09/05 20:58:23 UTC

ios commit: [CB-4654] Exclude platform scripts from template directory; copy those separately

Updated Branches:
  refs/heads/master 437568128 -> 8ac56a1b9


[CB-4654] Exclude platform scripts from template directory; copy those separately


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/8ac56a1b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/8ac56a1b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/8ac56a1b

Branch: refs/heads/master
Commit: 8ac56a1b9a0e4fa2e774b2b3d73ac3b2229693d6
Parents: 4375681
Author: Ian Clelland <ic...@chromium.org>
Authored: Thu Sep 5 14:57:59 2013 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Thu Sep 5 14:57:59 2013 -0400

----------------------------------------------------------------------
 bin/create                                      |   6 +-
 bin/templates/project/cordova/build             |  59 -------
 bin/templates/project/cordova/build.xcconfig    |   5 -
 bin/templates/project/cordova/clean             |  46 ------
 bin/templates/project/cordova/emulate           |  65 --------
 .../project/cordova/lib/install-device          |  64 --------
 .../project/cordova/lib/install-emulator        | 128 ----------------
 bin/templates/project/cordova/lib/list-devices  |  22 ---
 .../project/cordova/lib/list-emulator-images    |  34 -----
 .../project/cordova/lib/list-started-emulators  |  36 -----
 .../project/cordova/lib/sim.applescript         |  31 ----
 .../project/cordova/lib/start-emulator          |  35 -----
 bin/templates/project/cordova/log               |  23 ---
 bin/templates/project/cordova/run               | 153 -------------------
 bin/templates/project/cordova/version           |  40 -----
 bin/templates/scripts/build                     |  59 +++++++
 bin/templates/scripts/build.xcconfig            |   5 +
 bin/templates/scripts/clean                     |  46 ++++++
 bin/templates/scripts/emulate                   |  65 ++++++++
 bin/templates/scripts/lib/install-device        |  64 ++++++++
 bin/templates/scripts/lib/install-emulator      | 128 ++++++++++++++++
 bin/templates/scripts/lib/list-devices          |  22 +++
 bin/templates/scripts/lib/list-emulator-images  |  34 +++++
 .../scripts/lib/list-started-emulators          |  36 +++++
 bin/templates/scripts/lib/sim.applescript       |  31 ++++
 bin/templates/scripts/lib/start-emulator        |  35 +++++
 bin/templates/scripts/log                       |  23 +++
 bin/templates/scripts/run                       | 153 +++++++++++++++++++
 bin/templates/scripts/version                   |  40 +++++
 29 files changed, 746 insertions(+), 742 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/create
----------------------------------------------------------------------
diff --git a/bin/create b/bin/create
index 244c8a9..0c539ac 100755
--- a/bin/create
+++ b/bin/create
@@ -72,7 +72,8 @@ PROJECT_PATH=$1
 PACKAGE=$2
 PROJECT_NAME=$3
 PROJECT_PARENT=$(dirname "$PROJECT_PATH")
-PROJECT_TEMPLATE_DIR=${4:-"$BINDIR/templates/project"};
+PROJECT_TEMPLATE_DIR=${4:-"$BINDIR/templates/project"}
+SCRIPT_TEMPLATE_DIR=$BINDIR/templates/scripts
 
 
 # check whether the project path exists and is not empty
@@ -153,3 +154,6 @@ fi
 if [[ $USE_ARC = 1 ]]; then
     /usr/bin/sed -i '' 's/CLANG_ENABLE_OBJC_ARC = NO/CLANG_ENABLE_OBJC_ARC = YES/' "$R.xcodeproj/project.pbxproj" > /dev/null
 fi
+
+# Finally copy the scripts
+cp -r "$SCRIPT_TEMPLATE_DIR" "$PROJECT_PATH/cordova"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/build
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/build b/bin/templates/project/cordova/build
deleted file mode 100755
index b16e950..0000000
--- a/bin/templates/project/cordova/build
+++ /dev/null
@@ -1,59 +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.
-#
-
-#
-# compile and launch a Cordova/iOS project to the simulator
-#
-
-XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
-XCODE_MIN_VERSION="4.6"
-
-if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
-	echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
-	exit 1
-fi
-
-CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
-PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
-XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj  )
-PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
-
-cd "$PROJECT_PATH"
-
-APP=build/$PROJECT_NAME.app
-
-FLAG=${1:---debug}
-OTHER_FLAGS=$2
-CONFIGURATION=Debug
-
-if [ "$FLAG" == "--release" ]; then
-	CONFIGURATION=Release
-fi
-
-if [ "$OTHER_FLAGS" != "" ]; then
-	echo "More than one flag provided, specify either --debug or --release only"
-	exit 2
-fi
-
-"$CORDOVA_PATH/clean"
-xcodebuild -xcconfig "$CORDOVA_PATH/build.xcconfig" -project "$PROJECT_NAME.xcodeproj" ARCHS="armv7 armv7s" -target "$PROJECT_NAME" -configuration $CONFIGURATION -sdk iphoneos build VALID_ARCHS="armv7 armv7s" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/device"
-xcodebuild -project "$PROJECT_NAME.xcodeproj" -arch i386 -target "$PROJECT_NAME" -configuration $CONFIGURATION -sdk iphonesimulator build VALID_ARCHS="i386" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/emulator"
-

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/build.xcconfig
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/build.xcconfig b/bin/templates/project/cordova/build.xcconfig
deleted file mode 100644
index b2febfe..0000000
--- a/bin/templates/project/cordova/build.xcconfig
+++ /dev/null
@@ -1,5 +0,0 @@
-// to list all installed iOS identities, run:
-//     security find-identity |  sed -n 's/.*\("[^"]*"\).*/\1/p' | grep 'iPhone'
-
-// generic 'iPhone Developer' (no quotes) will match the right Identity with the right Provisioning Profile plus Certificate, based on the app bundle id
-CODE_SIGN_IDENTITY = iPhone Developer
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/clean
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/clean b/bin/templates/project/cordova/clean
deleted file mode 100755
index af8143c..0000000
--- a/bin/templates/project/cordova/clean
+++ /dev/null
@@ -1,46 +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.
-#
-
-#
-# Clean a Cordova/iOS project
-#
-
-set -e
-
-XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
-XCODE_MIN_VERSION="4.6"
-
-if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
-	echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
-	exit 1
-fi
-
-CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
-PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
-XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj  )
-PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
-
-cd "$PROJECT_PATH"
-
-xcodebuild -project "$PROJECT_NAME.xcodeproj" -configuration Debug -alltargets clean
-xcodebuild -project "$PROJECT_NAME.xcodeproj" -configuration Release -alltargets clean
-
-rm -rf "build"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/emulate
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/emulate b/bin/templates/project/cordova/emulate
deleted file mode 100755
index 0f79b4b..0000000
--- a/bin/templates/project/cordova/emulate
+++ /dev/null
@@ -1,65 +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.
-#
-
-XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
-XCODE_MIN_VERSION="4.6"
-
-if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
-	echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
-	exit 1
-fi
-
-SDK=`xcodebuild -showsdks | grep Sim | tail -1 | awk '{print $6}'`
-
-CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
-PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
-XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj  )
-PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
-
-APP_PATH=${1:-$PROJECT_PATH/build/emulator/$(xcodebuild -project "$PROJECT_PATH/$PROJECT_NAME.xcodeproj" -arch i386 -target "$PROJECT_NAME" -configuration Debug -sdk $SDK -showBuildSettings | grep FULL_PRODUCT_NAME | awk -F ' = ' '{print $2}')}
-
-DEVICE_FAMILY=${2:-${DEVICE_FAMILY:-iphone}}
-
-if [ ! -d "$APP_PATH" ]; then
-	echo "Project '$APP_PATH' is not built. Building."
-    "$CORDOVA_PATH/build" || exit $?
-fi
-
-if [ ! -d "$APP_PATH" ]; then
-	echo "$APP_PATH not found to emulate."
-	exit 1
-fi
-
-IOS_SIM_MIN_VERSION="1.7"
-IOS_SIM_LOCATION=$(which ios-sim)
-if [ $? != 0 ]; then
-    echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m"; exit 1;
-	exit 1
-fi
-
-IOS_SIM_VERSION=$(ios-sim --version)
-
-if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then
-	echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION."
-	exit 1
-fi
-
-# launch using ios-sim
-ios-sim launch "$APP_PATH" --family "$DEVICE_FAMILY" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" &

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/lib/install-device
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/lib/install-device b/bin/templates/project/cordova/lib/install-device
deleted file mode 100755
index e16c283..0000000
--- a/bin/templates/project/cordova/lib/install-device
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env 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.
-#
-# Valid values for "--target" (case insensitive):
-#     "iPhone (Retina 3.5-inch)" (default)
-#     "iPhone (Retina 4-inch)"
-#     "iPhone"
-#     "iPad"
-#     "iPad (Retina)"
-
-XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
-XCODE_MIN_VERSION="4.6"
-
-if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
-	echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
-	exit 1
-fi
-
-LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P)
-CORDOVA_PATH="$(dirname "$LIB_PATH")"
-PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
-XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj  )
-PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
-
-DEVICE_APP_PATH="$PROJECT_PATH/build/device/$PROJECT_NAME.app"
-
-if [ ! -d "$DEVICE_APP_PATH" ]; then
-	echo "Project '$DEVIC_APP_PATH' is not built."
-    exit 1
-fi
-
-
-IOS_DEPLOY_MIN_VERSION="1.0.2"
-IOS_DEPLOY_LOCATION=$(which ios-deploy)
-if [ $? != 0 ]; then
-    echo -e "\033[31mError: ios-deploy was not found. Please download, build and install version $IOS_DEPLOY_MIN_VERSION or greater from https://github.com/phonegap/ios-deploy into your path. Or 'npm install -g ios-deploy' using node.js: http://nodejs.org/\033[m"; exit 1;
-	exit 1
-fi
-
-IOS_DEPLOY_VERSION=$(ios-deploy --version)
-if [[ "$IOS_DEPLOY_VERSION" < "$IOS_DEPLOY_MIN_VERSION" ]]; then
-	echo "Cordova needs ios-deploy version $IOS_DEPLOY_MIN_VERSION or greater, you have version $IOS_DEPLOY_VERSION."
-	exit 1
-fi
-
-# if we got here, we can deploy the app, then exit success
-ios-deploy -b "$DEVICE_APP_PATH"
-exit 0

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/lib/install-emulator
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/lib/install-emulator b/bin/templates/project/cordova/lib/install-emulator
deleted file mode 100755
index 43e1713..0000000
--- a/bin/templates/project/cordova/lib/install-emulator
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/env 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.
-#
-# Valid values for "--target" (case insensitive):
-#     "iPhone (Retina 3.5-inch)" (default)
-#     "iPhone (Retina 4-inch)"
-#     "iPhone"
-#     "iPad"
-#     "iPad (Retina)"
-
-OPTION_RESULT=()
-TARGET="iPhone (Retina 3.5-inch)"
-TARGET_FLAG='--family iphone --retina'
-
-# separates "key=value", sets an array with 0th index as key, 1st index as value
-_parseOption() 
-{
-    local ARG=$@
-    OIFS=$IFS
-    IFS='='
-
-    OPTION_RESULT=()
-    for i in ${ARG[@]}
-    do
-      OPTION_RESULT+=($i)
-    done
-
-    IFS=$OIFS
-}
-
-# parses key=value arguments
-_parseArgs()
-{
-  for arg in "$@"
-  do
-    _parseOption ${arg}
-    case "${OPTION_RESULT[0]}" in
-      "--target")
-        TARGET=${OPTION_RESULT[1]}
-        ;;
-    esac
-  done
-}
-
-_parseArgs "$@"
-
-# lowercase the target string
-TARGET_LC=`echo $TARGET | tr '[:upper:]' '[:lower:]'` 
-
-# remember the comparison is lowercase
-case "$TARGET_LC" in
-  "iphone (retina 3.5-inch)")
-    TARGET_FLAG="--family iphone --retina"
-    ;;
-    "iphone (retina 4-inch)")
-    TARGET_FLAG="--family iphone --retina --tall"
-    ;;
-    "iphone")
-    TARGET_FLAG="--family iphone"
-    ;;
-    "ipad")
-    TARGET_FLAG="--family ipad"
-    ;;
-    "ipad (retina)")
-    TARGET_FLAG="--family ipad --retina"
-    ;;
-esac
-
-XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
-XCODE_MIN_VERSION="4.6"
-
-if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
-	echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
-	exit 1
-fi
-
-LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P)
-CORDOVA_PATH="$(dirname "$LIB_PATH")"
-PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
-XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj  )
-PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
-
-SIMULATOR_APP_PATH="$PROJECT_PATH/build/emulator/$PROJECT_NAME.app"
-
-if [ ! -d "$SIMULATOR_APP_PATH" ]; then
-	echo "Project '$SIMULATOR_APP_PATH' is not built."
-    exit 1
-fi
-
-if [ ! -d "$SIMULATOR_APP_PATH" ]; then
-	echo "$SIMULATOR_APP_PATH not found to emulate."
-	exit 1
-fi
-
-IOS_SIM_MIN_VERSION="1.7"
-IOS_SIM_LOCATION=$(which ios-sim)
-if [ $? != 0 ]; then
-    echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m"; exit 1;
-	exit 1
-fi
-
-IOS_SIM_VERSION=$(ios-sim --version)
-
-if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then
-	echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION."
-	exit 1
-fi
-
-# launch using ios-sim
-ios-sim launch "$SIMULATOR_APP_PATH" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" $TARGET_FLAG --exit
-
-

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/lib/list-devices
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/lib/list-devices b/bin/templates/project/cordova/lib/list-devices
deleted file mode 100755
index 80dd3b8..0000000
--- a/bin/templates/project/cordova/lib/list-devices
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env 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.
-#
-
-system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2 " iPad"}'
-system_profiler SPUSBDataType | sed -n -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2 " iPhone"}'

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/lib/list-emulator-images
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/lib/list-emulator-images b/bin/templates/project/cordova/lib/list-emulator-images
deleted file mode 100755
index 4df5315..0000000
--- a/bin/templates/project/cordova/lib/list-emulator-images
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env 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.
-#
-# Valid values for "--target" (case insensitive):
-#     "iPhone (Retina 3.5-inch)" (default)
-#     "iPhone (Retina 4-inch)"
-#     "iPhone"
-#     "iPad"
-#     "iPad (Retina)"
-
-set -e
-
-echo \""iPhone (Retina 3.5-inch)"\"
-echo \""iPhone (Retina 4-inch)"\"
-echo \""iPhone"\"
-echo \""iPad"\"
-echo \""iPad (Retina)"\"
-

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/lib/list-started-emulators
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/lib/list-started-emulators b/bin/templates/project/cordova/lib/list-started-emulators
deleted file mode 100755
index cfafe67..0000000
--- a/bin/templates/project/cordova/lib/list-started-emulators
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env 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.
-#
-# Valid values for "--target" (case insensitive):
-#     "iPhone (Retina 3.5-inch)" (default)
-#     "iPhone (Retina 4-inch)"
-#     "iPhone"
-#     "iPad"
-#     "iPad (Retina)"
-
-set -e
-
-SIM_RUNNING=$(ps aux | grep -i "[i]Phone Simulator" | wc -l)
-if [ $SIM_RUNNING == 0 ]; then
-    echo "No emulators are running."
-    exit 1
-fi
-
-SIM_ID=`defaults read com.apple.iphonesimulator "SimulateDevice"`
-echo \"$SIM_ID\"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/lib/sim.applescript
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/lib/sim.applescript b/bin/templates/project/cordova/lib/sim.applescript
deleted file mode 100755
index 8425625..0000000
--- a/bin/templates/project/cordova/lib/sim.applescript
+++ /dev/null
@@ -1,31 +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.
-
-tell application "System Events"
-	set UI elements enabled to true
-end tell
-
-tell application "iPhone Simulator"
-    activate
-end tell
-
-tell application "System Events"
-    tell process "iPhone Simulator"
-    click menu item "$DEVICE_NAME" of menu 1 of menu item "Device" of menu 1 of menu bar item "Hardware" of menu bar 1
-    click menu item "Home" of menu 1 of menu bar item "Hardware" of menu bar 1
-    end tell
-end tell

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/lib/start-emulator
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/lib/start-emulator b/bin/templates/project/cordova/lib/start-emulator
deleted file mode 100755
index 16eb3ce..0000000
--- a/bin/templates/project/cordova/lib/start-emulator
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env 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.
-#
-# Valid values for "--target" (case insensitive):
-#     "iPhone (Retina 3.5-inch)" (default)
-#     "iPhone (Retina 4-inch)"
-#     "iPhone"
-#     "iPad"
-#     "iPad (Retina)"
-
-set -e
-
-
-DEFAULT_TARGET="iPhone (Retina 3.5-inch)"
-TARGET=${1:-$DEFAULT_TARGET}
-LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P)
-
-SCPT=`sed -e "s/\\$DEVICE_NAME/$TARGET/g" "$LIB_PATH/sim.applescript"`
-osascript -e "$SCPT"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/log
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/log b/bin/templates/project/cordova/log
deleted file mode 100755
index b235b09..0000000
--- a/bin/templates/project/cordova/log
+++ /dev/null
@@ -1,23 +0,0 @@
-#! /bin/sh 
-#
-# 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.
-#
-
-CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
-
-tail -f "$CORDOVA_PATH/console.log"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/run
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/run b/bin/templates/project/cordova/run
deleted file mode 100755
index a96666e..0000000
--- a/bin/templates/project/cordova/run
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/usr/bin/env 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.
-#
-# Valid values for "--target" (case insensitive):
-#     "iPhone (Retina 3.5-inch)" (default)
-#     "iPhone (Retina 4-inch)"
-#     "iPhone"
-#     "iPad"
-#     "iPad (Retina)"
-
-OPTION_RESULT=()
-TARGET="iPhone (Retina 3.5-inch)"
-TARGET_FLAG='--family iphone --retina'
-
-# separates "key=value", sets an array with 0th index as key, 1st index as value
-_parseOption() 
-{
-    local ARG=$@
-    OIFS=$IFS
-    IFS='='
-
-    OPTION_RESULT=()
-    for i in ${ARG[@]}
-    do
-      OPTION_RESULT+=($i)
-    done
-
-    IFS=$OIFS
-}
-
-# parses key=value arguments
-_parseArgs()
-{
-  for arg in "$@"
-  do
-    _parseOption ${arg}
-    case "${OPTION_RESULT[0]}" in
-      "--target")
-        TARGET=${OPTION_RESULT[1]}
-        ;;
-    "--device")
-      echo "Targeting a device is not supported currently."
-      exit 1
-      ;;
-    esac
-  done
-}
-
-_parseArgs "$@"
-
-# "iPhone (Retina 3.5-inch)" -> --family iphone --retina
-# "iPhone (Retina 4-inch)" -> --family iphone --retina --tall
-# "iPhone" -> --family iphone
-# "iPad" -> --family ipad
-# "iPad (Retina)" -> --family ipad --retina
-
-# lowercase the target string
-TARGET_LC=`echo $TARGET | tr '[:upper:]' '[:lower:]'` 
-
-# remember the comparison is lowercase
-case "$TARGET_LC" in
-  "iphone (retina 3.5-inch)")
-    TARGET_FLAG="--family iphone --retina"
-    ;;
-    "iphone (retina 4-inch)")
-    TARGET_FLAG="--family iphone --retina --tall"
-    ;;
-    "iphone")
-    TARGET_FLAG="--family iphone"
-    ;;
-    "ipad")
-    TARGET_FLAG="--family ipad"
-    ;;
-    "ipad (retina)")
-    TARGET_FLAG="--family ipad --retina"
-    ;;
-esac
-
-XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
-XCODE_MIN_VERSION="4.6"
-
-if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
-	echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
-	exit 1
-fi
-
-CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
-PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
-XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj  )
-PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
-
-SIMULATOR_APP_PATH="$PROJECT_PATH/build/emulator/$PROJECT_NAME.app"
-DEVICE_APP_PATH="$PROJECT_PATH/build/device/$PROJECT_NAME.app"
-
-"$CORDOVA_PATH/build" || exit $?
-
-# if device build found, run it first
-if [ -d "$DEVICE_APP_PATH" ]; then
-    IOS_DEPLOY_MIN_VERSION="1.0.2"
-    IOS_DEPLOY_LOCATION=$(which ios-deploy)
-    if [ $? != 0 ]; then
-        echo -e "\033[31mError: ios-deploy was not found. Please download, build and install version $IOS_DEPLOY_MIN_VERSION or greater from https://github.com/phonegap/ios-deploy into your path. Or 'npm install -g ios-deploy' using node.js: http://nodejs.org/\033[m"; exit 1;
-    	exit 1
-    fi
-
-    IOS_DEPLOY_VERSION=$(ios-deploy --version)
-    if [[ "$IOS_DEPLOY_VERSION" < "$IOS_DEPLOY_MIN_VERSION" ]]; then
-    	echo "Cordova needs ios-deploy version $IOS_DEPLOY_MIN_VERSION or greater, you have version $IOS_DEPLOY_VERSION."
-    	exit 1
-    fi
-    
-    # if we got here, we can deploy the app, then exit success
-    ios-deploy -d -b "$DEVICE_APP_PATH"
-	exit 0
-fi
-
-if [ ! -d "$SIMULATOR_APP_PATH" ]; then
-	echo "$SIMULATOR_APP_PATH not found to emulate."
-	exit 1
-fi
-
-IOS_SIM_MIN_VERSION="1.7"
-IOS_SIM_LOCATION=$(which ios-sim)
-if [ $? != 0 ]; then
-    echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m"; exit 1;
-	exit 1
-fi
-
-IOS_SIM_VERSION=$(ios-sim --version)
-
-if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then
-	echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION."
-	exit 1
-fi
-
-# launch using ios-sim
-ios-sim launch "$SIMULATOR_APP_PATH" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" $TARGET_FLAG &

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/project/cordova/version
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/version b/bin/templates/project/cordova/version
deleted file mode 100755
index 6a9261c..0000000
--- a/bin/templates/project/cordova/version
+++ /dev/null
@@ -1,40 +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.
-#
-
-#
-# Returns the VERSION of CordovaLib used. 
-# Note: it does not work if the --shared option was used to create the project.
-#
-
-set -e
-
-CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
-PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
-
-VERSION_FILE_PATH="$PROJECT_PATH/CordovaLib/VERSION"
-VERSION=$(<"$VERSION_FILE_PATH")
-
-if [ -f "$VERSION_FILE_PATH" ]; then
-  echo $VERSION 
-else
-  echo "The file \"$VERSION_FILE_PATH\" does not exist."
-  exit 1
-fi
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/build
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/build b/bin/templates/scripts/build
new file mode 100755
index 0000000..b16e950
--- /dev/null
+++ b/bin/templates/scripts/build
@@ -0,0 +1,59 @@
+#!/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.
+#
+
+#
+# compile and launch a Cordova/iOS project to the simulator
+#
+
+XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
+XCODE_MIN_VERSION="4.6"
+
+if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
+	echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
+	exit 1
+fi
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
+PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
+XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj  )
+PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
+
+cd "$PROJECT_PATH"
+
+APP=build/$PROJECT_NAME.app
+
+FLAG=${1:---debug}
+OTHER_FLAGS=$2
+CONFIGURATION=Debug
+
+if [ "$FLAG" == "--release" ]; then
+	CONFIGURATION=Release
+fi
+
+if [ "$OTHER_FLAGS" != "" ]; then
+	echo "More than one flag provided, specify either --debug or --release only"
+	exit 2
+fi
+
+"$CORDOVA_PATH/clean"
+xcodebuild -xcconfig "$CORDOVA_PATH/build.xcconfig" -project "$PROJECT_NAME.xcodeproj" ARCHS="armv7 armv7s" -target "$PROJECT_NAME" -configuration $CONFIGURATION -sdk iphoneos build VALID_ARCHS="armv7 armv7s" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/device"
+xcodebuild -project "$PROJECT_NAME.xcodeproj" -arch i386 -target "$PROJECT_NAME" -configuration $CONFIGURATION -sdk iphonesimulator build VALID_ARCHS="i386" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/emulator"
+

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/build.xcconfig
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/build.xcconfig b/bin/templates/scripts/build.xcconfig
new file mode 100644
index 0000000..b2febfe
--- /dev/null
+++ b/bin/templates/scripts/build.xcconfig
@@ -0,0 +1,5 @@
+// to list all installed iOS identities, run:
+//     security find-identity |  sed -n 's/.*\("[^"]*"\).*/\1/p' | grep 'iPhone'
+
+// generic 'iPhone Developer' (no quotes) will match the right Identity with the right Provisioning Profile plus Certificate, based on the app bundle id
+CODE_SIGN_IDENTITY = iPhone Developer
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/clean
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/clean b/bin/templates/scripts/clean
new file mode 100755
index 0000000..af8143c
--- /dev/null
+++ b/bin/templates/scripts/clean
@@ -0,0 +1,46 @@
+#!/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.
+#
+
+#
+# Clean a Cordova/iOS project
+#
+
+set -e
+
+XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
+XCODE_MIN_VERSION="4.6"
+
+if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
+	echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
+	exit 1
+fi
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
+PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
+XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj  )
+PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
+
+cd "$PROJECT_PATH"
+
+xcodebuild -project "$PROJECT_NAME.xcodeproj" -configuration Debug -alltargets clean
+xcodebuild -project "$PROJECT_NAME.xcodeproj" -configuration Release -alltargets clean
+
+rm -rf "build"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/emulate
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/emulate b/bin/templates/scripts/emulate
new file mode 100755
index 0000000..0f79b4b
--- /dev/null
+++ b/bin/templates/scripts/emulate
@@ -0,0 +1,65 @@
+#! /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.
+#
+
+XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
+XCODE_MIN_VERSION="4.6"
+
+if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
+	echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
+	exit 1
+fi
+
+SDK=`xcodebuild -showsdks | grep Sim | tail -1 | awk '{print $6}'`
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
+PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
+XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj  )
+PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
+
+APP_PATH=${1:-$PROJECT_PATH/build/emulator/$(xcodebuild -project "$PROJECT_PATH/$PROJECT_NAME.xcodeproj" -arch i386 -target "$PROJECT_NAME" -configuration Debug -sdk $SDK -showBuildSettings | grep FULL_PRODUCT_NAME | awk -F ' = ' '{print $2}')}
+
+DEVICE_FAMILY=${2:-${DEVICE_FAMILY:-iphone}}
+
+if [ ! -d "$APP_PATH" ]; then
+	echo "Project '$APP_PATH' is not built. Building."
+    "$CORDOVA_PATH/build" || exit $?
+fi
+
+if [ ! -d "$APP_PATH" ]; then
+	echo "$APP_PATH not found to emulate."
+	exit 1
+fi
+
+IOS_SIM_MIN_VERSION="1.7"
+IOS_SIM_LOCATION=$(which ios-sim)
+if [ $? != 0 ]; then
+    echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m"; exit 1;
+	exit 1
+fi
+
+IOS_SIM_VERSION=$(ios-sim --version)
+
+if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then
+	echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION."
+	exit 1
+fi
+
+# launch using ios-sim
+ios-sim launch "$APP_PATH" --family "$DEVICE_FAMILY" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" &

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/lib/install-device
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/lib/install-device b/bin/templates/scripts/lib/install-device
new file mode 100755
index 0000000..e16c283
--- /dev/null
+++ b/bin/templates/scripts/lib/install-device
@@ -0,0 +1,64 @@
+#!/usr/bin/env 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.
+#
+# Valid values for "--target" (case insensitive):
+#     "iPhone (Retina 3.5-inch)" (default)
+#     "iPhone (Retina 4-inch)"
+#     "iPhone"
+#     "iPad"
+#     "iPad (Retina)"
+
+XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
+XCODE_MIN_VERSION="4.6"
+
+if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
+	echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
+	exit 1
+fi
+
+LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P)
+CORDOVA_PATH="$(dirname "$LIB_PATH")"
+PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
+XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj  )
+PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
+
+DEVICE_APP_PATH="$PROJECT_PATH/build/device/$PROJECT_NAME.app"
+
+if [ ! -d "$DEVICE_APP_PATH" ]; then
+	echo "Project '$DEVIC_APP_PATH' is not built."
+    exit 1
+fi
+
+
+IOS_DEPLOY_MIN_VERSION="1.0.2"
+IOS_DEPLOY_LOCATION=$(which ios-deploy)
+if [ $? != 0 ]; then
+    echo -e "\033[31mError: ios-deploy was not found. Please download, build and install version $IOS_DEPLOY_MIN_VERSION or greater from https://github.com/phonegap/ios-deploy into your path. Or 'npm install -g ios-deploy' using node.js: http://nodejs.org/\033[m"; exit 1;
+	exit 1
+fi
+
+IOS_DEPLOY_VERSION=$(ios-deploy --version)
+if [[ "$IOS_DEPLOY_VERSION" < "$IOS_DEPLOY_MIN_VERSION" ]]; then
+	echo "Cordova needs ios-deploy version $IOS_DEPLOY_MIN_VERSION or greater, you have version $IOS_DEPLOY_VERSION."
+	exit 1
+fi
+
+# if we got here, we can deploy the app, then exit success
+ios-deploy -b "$DEVICE_APP_PATH"
+exit 0

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/lib/install-emulator
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/lib/install-emulator b/bin/templates/scripts/lib/install-emulator
new file mode 100755
index 0000000..43e1713
--- /dev/null
+++ b/bin/templates/scripts/lib/install-emulator
@@ -0,0 +1,128 @@
+#!/usr/bin/env 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.
+#
+# Valid values for "--target" (case insensitive):
+#     "iPhone (Retina 3.5-inch)" (default)
+#     "iPhone (Retina 4-inch)"
+#     "iPhone"
+#     "iPad"
+#     "iPad (Retina)"
+
+OPTION_RESULT=()
+TARGET="iPhone (Retina 3.5-inch)"
+TARGET_FLAG='--family iphone --retina'
+
+# separates "key=value", sets an array with 0th index as key, 1st index as value
+_parseOption() 
+{
+    local ARG=$@
+    OIFS=$IFS
+    IFS='='
+
+    OPTION_RESULT=()
+    for i in ${ARG[@]}
+    do
+      OPTION_RESULT+=($i)
+    done
+
+    IFS=$OIFS
+}
+
+# parses key=value arguments
+_parseArgs()
+{
+  for arg in "$@"
+  do
+    _parseOption ${arg}
+    case "${OPTION_RESULT[0]}" in
+      "--target")
+        TARGET=${OPTION_RESULT[1]}
+        ;;
+    esac
+  done
+}
+
+_parseArgs "$@"
+
+# lowercase the target string
+TARGET_LC=`echo $TARGET | tr '[:upper:]' '[:lower:]'` 
+
+# remember the comparison is lowercase
+case "$TARGET_LC" in
+  "iphone (retina 3.5-inch)")
+    TARGET_FLAG="--family iphone --retina"
+    ;;
+    "iphone (retina 4-inch)")
+    TARGET_FLAG="--family iphone --retina --tall"
+    ;;
+    "iphone")
+    TARGET_FLAG="--family iphone"
+    ;;
+    "ipad")
+    TARGET_FLAG="--family ipad"
+    ;;
+    "ipad (retina)")
+    TARGET_FLAG="--family ipad --retina"
+    ;;
+esac
+
+XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
+XCODE_MIN_VERSION="4.6"
+
+if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
+	echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
+	exit 1
+fi
+
+LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P)
+CORDOVA_PATH="$(dirname "$LIB_PATH")"
+PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
+XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj  )
+PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
+
+SIMULATOR_APP_PATH="$PROJECT_PATH/build/emulator/$PROJECT_NAME.app"
+
+if [ ! -d "$SIMULATOR_APP_PATH" ]; then
+	echo "Project '$SIMULATOR_APP_PATH' is not built."
+    exit 1
+fi
+
+if [ ! -d "$SIMULATOR_APP_PATH" ]; then
+	echo "$SIMULATOR_APP_PATH not found to emulate."
+	exit 1
+fi
+
+IOS_SIM_MIN_VERSION="1.7"
+IOS_SIM_LOCATION=$(which ios-sim)
+if [ $? != 0 ]; then
+    echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m"; exit 1;
+	exit 1
+fi
+
+IOS_SIM_VERSION=$(ios-sim --version)
+
+if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then
+	echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION."
+	exit 1
+fi
+
+# launch using ios-sim
+ios-sim launch "$SIMULATOR_APP_PATH" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" $TARGET_FLAG --exit
+
+

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/lib/list-devices
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/lib/list-devices b/bin/templates/scripts/lib/list-devices
new file mode 100755
index 0000000..80dd3b8
--- /dev/null
+++ b/bin/templates/scripts/lib/list-devices
@@ -0,0 +1,22 @@
+#!/usr/bin/env 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.
+#
+
+system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2 " iPad"}'
+system_profiler SPUSBDataType | sed -n -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2 " iPhone"}'

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/lib/list-emulator-images
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/lib/list-emulator-images b/bin/templates/scripts/lib/list-emulator-images
new file mode 100755
index 0000000..4df5315
--- /dev/null
+++ b/bin/templates/scripts/lib/list-emulator-images
@@ -0,0 +1,34 @@
+#!/usr/bin/env 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.
+#
+# Valid values for "--target" (case insensitive):
+#     "iPhone (Retina 3.5-inch)" (default)
+#     "iPhone (Retina 4-inch)"
+#     "iPhone"
+#     "iPad"
+#     "iPad (Retina)"
+
+set -e
+
+echo \""iPhone (Retina 3.5-inch)"\"
+echo \""iPhone (Retina 4-inch)"\"
+echo \""iPhone"\"
+echo \""iPad"\"
+echo \""iPad (Retina)"\"
+

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/lib/list-started-emulators
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/lib/list-started-emulators b/bin/templates/scripts/lib/list-started-emulators
new file mode 100755
index 0000000..cfafe67
--- /dev/null
+++ b/bin/templates/scripts/lib/list-started-emulators
@@ -0,0 +1,36 @@
+#!/usr/bin/env 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.
+#
+# Valid values for "--target" (case insensitive):
+#     "iPhone (Retina 3.5-inch)" (default)
+#     "iPhone (Retina 4-inch)"
+#     "iPhone"
+#     "iPad"
+#     "iPad (Retina)"
+
+set -e
+
+SIM_RUNNING=$(ps aux | grep -i "[i]Phone Simulator" | wc -l)
+if [ $SIM_RUNNING == 0 ]; then
+    echo "No emulators are running."
+    exit 1
+fi
+
+SIM_ID=`defaults read com.apple.iphonesimulator "SimulateDevice"`
+echo \"$SIM_ID\"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/lib/sim.applescript
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/lib/sim.applescript b/bin/templates/scripts/lib/sim.applescript
new file mode 100755
index 0000000..8425625
--- /dev/null
+++ b/bin/templates/scripts/lib/sim.applescript
@@ -0,0 +1,31 @@
+# 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.
+
+tell application "System Events"
+	set UI elements enabled to true
+end tell
+
+tell application "iPhone Simulator"
+    activate
+end tell
+
+tell application "System Events"
+    tell process "iPhone Simulator"
+    click menu item "$DEVICE_NAME" of menu 1 of menu item "Device" of menu 1 of menu bar item "Hardware" of menu bar 1
+    click menu item "Home" of menu 1 of menu bar item "Hardware" of menu bar 1
+    end tell
+end tell

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/lib/start-emulator
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/lib/start-emulator b/bin/templates/scripts/lib/start-emulator
new file mode 100755
index 0000000..16eb3ce
--- /dev/null
+++ b/bin/templates/scripts/lib/start-emulator
@@ -0,0 +1,35 @@
+#!/usr/bin/env 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.
+#
+# Valid values for "--target" (case insensitive):
+#     "iPhone (Retina 3.5-inch)" (default)
+#     "iPhone (Retina 4-inch)"
+#     "iPhone"
+#     "iPad"
+#     "iPad (Retina)"
+
+set -e
+
+
+DEFAULT_TARGET="iPhone (Retina 3.5-inch)"
+TARGET=${1:-$DEFAULT_TARGET}
+LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P)
+
+SCPT=`sed -e "s/\\$DEVICE_NAME/$TARGET/g" "$LIB_PATH/sim.applescript"`
+osascript -e "$SCPT"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/log
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/log b/bin/templates/scripts/log
new file mode 100755
index 0000000..b235b09
--- /dev/null
+++ b/bin/templates/scripts/log
@@ -0,0 +1,23 @@
+#! /bin/sh 
+#
+# 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.
+#
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
+
+tail -f "$CORDOVA_PATH/console.log"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/run
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/run b/bin/templates/scripts/run
new file mode 100755
index 0000000..a96666e
--- /dev/null
+++ b/bin/templates/scripts/run
@@ -0,0 +1,153 @@
+#!/usr/bin/env 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.
+#
+# Valid values for "--target" (case insensitive):
+#     "iPhone (Retina 3.5-inch)" (default)
+#     "iPhone (Retina 4-inch)"
+#     "iPhone"
+#     "iPad"
+#     "iPad (Retina)"
+
+OPTION_RESULT=()
+TARGET="iPhone (Retina 3.5-inch)"
+TARGET_FLAG='--family iphone --retina'
+
+# separates "key=value", sets an array with 0th index as key, 1st index as value
+_parseOption() 
+{
+    local ARG=$@
+    OIFS=$IFS
+    IFS='='
+
+    OPTION_RESULT=()
+    for i in ${ARG[@]}
+    do
+      OPTION_RESULT+=($i)
+    done
+
+    IFS=$OIFS
+}
+
+# parses key=value arguments
+_parseArgs()
+{
+  for arg in "$@"
+  do
+    _parseOption ${arg}
+    case "${OPTION_RESULT[0]}" in
+      "--target")
+        TARGET=${OPTION_RESULT[1]}
+        ;;
+    "--device")
+      echo "Targeting a device is not supported currently."
+      exit 1
+      ;;
+    esac
+  done
+}
+
+_parseArgs "$@"
+
+# "iPhone (Retina 3.5-inch)" -> --family iphone --retina
+# "iPhone (Retina 4-inch)" -> --family iphone --retina --tall
+# "iPhone" -> --family iphone
+# "iPad" -> --family ipad
+# "iPad (Retina)" -> --family ipad --retina
+
+# lowercase the target string
+TARGET_LC=`echo $TARGET | tr '[:upper:]' '[:lower:]'` 
+
+# remember the comparison is lowercase
+case "$TARGET_LC" in
+  "iphone (retina 3.5-inch)")
+    TARGET_FLAG="--family iphone --retina"
+    ;;
+    "iphone (retina 4-inch)")
+    TARGET_FLAG="--family iphone --retina --tall"
+    ;;
+    "iphone")
+    TARGET_FLAG="--family iphone"
+    ;;
+    "ipad")
+    TARGET_FLAG="--family ipad"
+    ;;
+    "ipad (retina)")
+    TARGET_FLAG="--family ipad --retina"
+    ;;
+esac
+
+XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
+XCODE_MIN_VERSION="4.6"
+
+if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
+	echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
+	exit 1
+fi
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
+PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
+XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj  )
+PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
+
+SIMULATOR_APP_PATH="$PROJECT_PATH/build/emulator/$PROJECT_NAME.app"
+DEVICE_APP_PATH="$PROJECT_PATH/build/device/$PROJECT_NAME.app"
+
+"$CORDOVA_PATH/build" || exit $?
+
+# if device build found, run it first
+if [ -d "$DEVICE_APP_PATH" ]; then
+    IOS_DEPLOY_MIN_VERSION="1.0.2"
+    IOS_DEPLOY_LOCATION=$(which ios-deploy)
+    if [ $? != 0 ]; then
+        echo -e "\033[31mError: ios-deploy was not found. Please download, build and install version $IOS_DEPLOY_MIN_VERSION or greater from https://github.com/phonegap/ios-deploy into your path. Or 'npm install -g ios-deploy' using node.js: http://nodejs.org/\033[m"; exit 1;
+    	exit 1
+    fi
+
+    IOS_DEPLOY_VERSION=$(ios-deploy --version)
+    if [[ "$IOS_DEPLOY_VERSION" < "$IOS_DEPLOY_MIN_VERSION" ]]; then
+    	echo "Cordova needs ios-deploy version $IOS_DEPLOY_MIN_VERSION or greater, you have version $IOS_DEPLOY_VERSION."
+    	exit 1
+    fi
+    
+    # if we got here, we can deploy the app, then exit success
+    ios-deploy -d -b "$DEVICE_APP_PATH"
+	exit 0
+fi
+
+if [ ! -d "$SIMULATOR_APP_PATH" ]; then
+	echo "$SIMULATOR_APP_PATH not found to emulate."
+	exit 1
+fi
+
+IOS_SIM_MIN_VERSION="1.7"
+IOS_SIM_LOCATION=$(which ios-sim)
+if [ $? != 0 ]; then
+    echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m"; exit 1;
+	exit 1
+fi
+
+IOS_SIM_VERSION=$(ios-sim --version)
+
+if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then
+	echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION."
+	exit 1
+fi
+
+# launch using ios-sim
+ios-sim launch "$SIMULATOR_APP_PATH" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" $TARGET_FLAG &

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8ac56a1b/bin/templates/scripts/version
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/version b/bin/templates/scripts/version
new file mode 100755
index 0000000..6a9261c
--- /dev/null
+++ b/bin/templates/scripts/version
@@ -0,0 +1,40 @@
+#!/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.
+#
+
+#
+# Returns the VERSION of CordovaLib used. 
+# Note: it does not work if the --shared option was used to create the project.
+#
+
+set -e
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
+PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
+
+VERSION_FILE_PATH="$PROJECT_PATH/CordovaLib/VERSION"
+VERSION=$(<"$VERSION_FILE_PATH")
+
+if [ -f "$VERSION_FILE_PATH" ]; then
+  echo $VERSION 
+else
+  echo "The file \"$VERSION_FILE_PATH\" does not exist."
+  exit 1
+fi
\ No newline at end of file