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 2014/04/24 22:37:38 UTC

mac commit: Fixing various project-helper scripts

Repository: cordova-osx
Updated Branches:
  refs/heads/master 1ff6f299b -> 04c6c0c97


Fixing various project-helper scripts

fixes:
* CB-2979 Add a ./cordova/lib/list-devices project-level helper script to OSX
* CB-2971 Add a ./cordova/lib/list-started-emulators as project-level helper script to OSX
* CB-2954 Add a ./cordova/lib/list-emulator-images project-level helper script to OSX
* CB-2987 Add a ./cordova/lib/install-emulator project-level helper script to OSX
* CB-2995 Add a ./cordova/lib/install-device project-level helper script to OSX
* CB-3003 Add a ./cordova/lib/start-emulator project-level helper script to OSX

Signed-off-by: Shazron Abdullah <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/04c6c0c9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/04c6c0c9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/04c6c0c9

Branch: refs/heads/master
Commit: 04c6c0c972bd398d9a898dc66e8f551ebc6d7777
Parents: 1ff6f29
Author: Tobias Bocanegra <tr...@adobe.com>
Authored: Wed Apr 23 16:15:56 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Apr 24 13:37:13 2014 -0700

----------------------------------------------------------------------
 templates/scripts/cordova/lib/install-device    |  42 +------
 templates/scripts/cordova/lib/install-emulator  | 109 +------------------
 templates/scripts/cordova/lib/list-devices      |   5 +-
 .../scripts/cordova/lib/list-emulator-images    |  23 +---
 .../scripts/cordova/lib/list-started-emulators  |  19 +---
 templates/scripts/cordova/lib/sim.applescript   |  31 ------
 templates/scripts/cordova/lib/start-emulator    |  18 +--
 7 files changed, 12 insertions(+), 235 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/04c6c0c9/templates/scripts/cordova/lib/install-device
----------------------------------------------------------------------
diff --git a/templates/scripts/cordova/lib/install-device b/templates/scripts/cordova/lib/install-device
index 34993bd..473060c 100755
--- a/templates/scripts/cordova/lib/install-device
+++ b/templates/scripts/cordova/lib/install-device
@@ -1,5 +1,4 @@
 #!/bin/bash
-
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
@@ -17,43 +16,6 @@
 #  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)"
-
-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"
-
-source "$CORDOVA_PATH/check_reqs"
-
-if [ ! -d "$DEVICE_APP_PATH" ]; then
-	echo "Project '$DEVIC_APP_PATH' is not built."
-    exit 1
-fi
-
-
-IOS_DEPLOY_MIN_VERSION="1.0.4"
-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
+echo "OSX does not support additional devices."
+exit 1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/04c6c0c9/templates/scripts/cordova/lib/install-emulator
----------------------------------------------------------------------
diff --git a/templates/scripts/cordova/lib/install-emulator b/templates/scripts/cordova/lib/install-emulator
index a55a5ba..4517cfe 100755
--- a/templates/scripts/cordova/lib/install-emulator
+++ b/templates/scripts/cordova/lib/install-emulator
@@ -16,111 +16,6 @@
 #  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"
-    ;;
-    # --64bit not supportted by ios-sim yet
-    #"iphone retina (4-inch 64-bit)")
-    #TARGET_FLAG="--family iphone --retina --tall --64bit"
-    #;;
-    "iphone")
-    TARGET_FLAG="--family iphone"
-    ;;
-    "ipad")
-    TARGET_FLAG="--family ipad"
-    ;;
-    "ipad (retina)")
-    TARGET_FLAG="--family ipad --retina"
-    ;;
-esac
-
-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"
-
-source "$CORDOVA_PATH/check_reqs"
-
-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
-
 
+echo "OSX does not need emulators."
+exit 1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/04c6c0c9/templates/scripts/cordova/lib/list-devices
----------------------------------------------------------------------
diff --git a/templates/scripts/cordova/lib/list-devices b/templates/scripts/cordova/lib/list-devices
index 183ee72..473060c 100755
--- a/templates/scripts/cordova/lib/list-devices
+++ b/templates/scripts/cordova/lib/list-devices
@@ -16,7 +16,6 @@
 #  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"}'
+echo "OSX does not support additional devices."
+exit 1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/04c6c0c9/templates/scripts/cordova/lib/list-emulator-images
----------------------------------------------------------------------
diff --git a/templates/scripts/cordova/lib/list-emulator-images b/templates/scripts/cordova/lib/list-emulator-images
index 0384147..4517cfe 100755
--- a/templates/scripts/cordova/lib/list-emulator-images
+++ b/templates/scripts/cordova/lib/list-emulator-images
@@ -16,25 +16,6 @@
 #  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)"\"
-
-# this assumes Xcode 5 minimum not supported by ios-sim yet
-# echo \""iPhone (Retina 4-inch 64-bit)"\"
-
-echo \""iPhone"\"
-echo \""iPad"\"
-echo \""iPad (Retina)"\"
-
-
 
+echo "OSX does not need emulators."
+exit 1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/04c6c0c9/templates/scripts/cordova/lib/list-started-emulators
----------------------------------------------------------------------
diff --git a/templates/scripts/cordova/lib/list-started-emulators b/templates/scripts/cordova/lib/list-started-emulators
index fe21c9a..f55f3b6 100755
--- a/templates/scripts/cordova/lib/list-started-emulators
+++ b/templates/scripts/cordova/lib/list-started-emulators
@@ -16,21 +16,6 @@
 #  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\"
+echo "OSX does not need emulators."
+exit 1

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/04c6c0c9/templates/scripts/cordova/lib/sim.applescript
----------------------------------------------------------------------
diff --git a/templates/scripts/cordova/lib/sim.applescript b/templates/scripts/cordova/lib/sim.applescript
deleted file mode 100755
index 8425625..0000000
--- a/templates/scripts/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-osx/blob/04c6c0c9/templates/scripts/cordova/lib/start-emulator
----------------------------------------------------------------------
diff --git a/templates/scripts/cordova/lib/start-emulator b/templates/scripts/cordova/lib/start-emulator
index e00c09c..04cf7c8 100755
--- a/templates/scripts/cordova/lib/start-emulator
+++ b/templates/scripts/cordova/lib/start-emulator
@@ -16,20 +16,6 @@
 #  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"
+echo "OSX does not have emulators."
+exit 1