You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/07/14 02:09:58 UTC

ios commit: Improved debug and emulate scripts.

Updated Branches:
  refs/heads/master 1e4311a54 -> c0bc5d99a


Improved debug and emulate scripts.


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

Branch: refs/heads/master
Commit: c0bc5d99ac94f7b51f3a365e2c003edf1ed3108f
Parents: 1e4311a
Author: Shazron Abdullah <sh...@apache.org>
Authored: Fri Jul 13 17:09:45 2012 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Jul 13 17:09:45 2012 -0700

----------------------------------------------------------------------
 bin/templates/project/cordova/debug   |   21 +++++----------
 bin/templates/project/cordova/emulate |   39 +++++++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/c0bc5d99/bin/templates/project/cordova/debug
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/debug b/bin/templates/project/cordova/debug
index 659aa72..cadb2e9 100755
--- a/bin/templates/project/cordova/debug
+++ b/bin/templates/project/cordova/debug
@@ -26,29 +26,22 @@
 set -e
 
 CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
-
 PROJECT_PATH=$CORDOVA_PATH/..
 
-for file in *.xcodeproj; do
-  PRJ=$file
-  PROJECT_NAME=$(echo $file | awk -F.xcodeproj '{print $1}')
+for file in $PROJECT_PATH/*.xcodeproj; do
+  PROJECT_NAME=$(basename "$file" .xcodeproj)
 done;
 
-APP=build/Release-iphonesimulator/$PROJECT_NAME.app
-SDK=`xcodebuild -showsdks | grep Sim | tail -1 | awk '{print $6}'`
-
 cd $PROJECT_PATH
 
-xcodebuild -project $PRJ -sdk $SDK clean build VALID_ARCHS="i386"
+APP=build/Release-iphonesimulator/$PROJECT_NAME.app
+SDK=`xcodebuild -showsdks | grep Sim | tail -1 | awk '{print $6}'`
 
-# launch using ios-sim
+xcodebuild -project $PROJECT_NAME.xcodeproj -sdk $SDK clean build VALID_ARCHS="i386"
 
-if which ios-sim >/dev/null; then
-    ios-sim launch $APP --stderr console.log --stdout console.log &
-else
-    echo -e '\033[31mError: ios-sim was not found. Please download, build and install version 1.4 or greater from https://github.com/phonegap/ios-sim into your path. Or "brew install ios-sim" using homebrew: http://mxcl.github.com/homebrew/\033[m'; exit 1;
-fi
+# launch using emulate
 
+$CORDOVA_PATH/emulate $PROJECT_PATH/$APP
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/c0bc5d99/bin/templates/project/cordova/emulate
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/emulate b/bin/templates/project/cordova/emulate
index a952469..ac0f10c 100755
--- a/bin/templates/project/cordova/emulate
+++ b/bin/templates/project/cordova/emulate
@@ -18,4 +18,41 @@
 # under the License.
 #
 
-open `xcode-select -print-path`/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
\ No newline at end of file
+set -e
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
+PROJECT_PATH=$CORDOVA_PATH/..
+
+function getAppPath() {
+	for file in $PROJECT_PATH/*.xcodeproj; do
+	  PROJECT_NAME=$(basename "$file" .xcodeproj)
+	done;
+	APP=build/Release-iphonesimulator/$PROJECT_NAME.app
+	APP_PATH=$PROJECT_PATH/$APP
+}
+
+APP_PATH=$1
+
+if [ $# -lt 1 ]; then
+	getAppPath
+fi
+
+if [ ! -d "$APP_PATH" ]; then
+	read -p "Project '$APP_PATH' is not built. Build? [y/n]: " REPLY 
+	if [ "$REPLY" == "y" ]; then 
+		$CORDOVA_PATH/debug
+		exit 0
+	else 
+		echo "$APP_PATH not found to emulate."
+		exit 1
+	fi	
+fi
+
+# launch using ios-sim
+
+if which ios-sim >/dev/null; then
+    ios-sim launch $APP_PATH --stderr console.log --stdout console.log &
+else
+    echo -e '\033[31mError: ios-sim was not found. Please download, build and install version 1.4 or greater from https://github.com/phonegap/ios-sim into your path. Or "brew install ios-sim" using homebrew: http://mxcl.github.com/homebrew/\033[m'; exit 1;
+fi
+