status-mobile/run-osx.sh

78 lines
1.6 KiB
Bash
Raw Normal View History

2016-04-24 11:38:49 +00:00
#!/bin/sh
[ `uname -s` != "Darwin" ] && return
function tab () {
local cmd=""
local cdto="$PWD"
local args="$@"
if [ -d "$1" ]; then
cdto=`cd "$1"; pwd`
args="${@:2}"
fi
if [ -n "$args" ]; then
cmd="; $args"
fi
osascript &>/dev/null <<EOF
tell application "iTerm2"
tell current window
set newTab to (create tab with default profile)
tell newTab
tell current session
write text "cd \"$cdto\"$cmd"
end tell
2016-04-24 11:38:49 +00:00
end tell
end tell
end tell
EOF
}
2016-04-27 08:06:56 +00:00
if [ ! -z $1 ]
then
device_type="$1"
else
device_type="genymotion"
fi
2016-07-18 13:22:32 +00:00
if [ ! -z $2 ]
then
cljs_build="$2"
else
cljs_build="android"
fi
2016-04-27 08:06:56 +00:00
if [ "$device_type" = "genymotion" ]
then
2016-04-24 11:38:49 +00:00
# Find Device based on Android version 6.0.0
device=$(/Applications/Genymotion\ Shell.app/Contents/MacOS/genyshell -c "devices list" | grep "6.0.0")
2016-04-27 08:06:56 +00:00
#echo ${device##*| }
2016-04-24 11:38:49 +00:00
# Launch device in Genymotion
open -a /Applications/Genymotion.app/Contents/MacOS/player.app --args --vm-name "${device##*| }"
2016-04-27 08:06:56 +00:00
fi
2016-04-24 11:38:49 +00:00
# Install deps, prepare for genymotion and figwheel
2016-05-09 11:31:59 +00:00
lein voom build-deps && re-natal deps && re-natal use-android-device "${device_type}" && re-natal use-figwheel
2016-04-24 11:38:49 +00:00
# open figwheel in new tab
2016-07-18 13:22:32 +00:00
tab "lein figwheel ${cljs_build}"
2016-04-24 11:38:49 +00:00
# open react-native package in new tab
tab "react-native start"
# echo "Press any key when emulator, figwheel and packager are ready" && read -n 1
sleep 10s
adb reverse tcp:8081 tcp:8081 && adb reverse tcp:3449 tcp:3449
2016-04-27 08:06:56 +00:00
react-native run-android
2016-05-26 16:05:10 +00:00
2016-07-18 13:22:32 +00:00
if [ ! -z $3 ]
2016-05-26 16:05:10 +00:00
then
tab "appium"
lein test
lein doo node test once
2016-07-18 13:22:32 +00:00
fi