2016-04-24 18:38:49 +07: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
|
|
|
|
|
2017-07-03 12:03:01 +03:00
|
|
|
iterm_exists=`osascript -e "id of application \"iterm2\""`
|
|
|
|
if [ ! -z iterm_exists ]; then
|
2016-04-24 18:38:49 +07:00
|
|
|
osascript &>/dev/null <<EOF
|
2016-06-02 11:51:44 +02:00
|
|
|
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 18:38:49 +07:00
|
|
|
end tell
|
|
|
|
end tell
|
|
|
|
end tell
|
|
|
|
EOF
|
2017-07-03 12:03:01 +03:00
|
|
|
else
|
|
|
|
osascript &>/dev/null <<END
|
|
|
|
tell app "Terminal" to do script "cd \"$cdto\"$cmd"
|
|
|
|
END
|
|
|
|
fi
|
2016-04-24 18:38:49 +07:00
|
|
|
}
|
|
|
|
|
2016-04-27 11:06:56 +03:00
|
|
|
if [ ! -z $1 ]
|
|
|
|
then
|
|
|
|
device_type="$1"
|
|
|
|
else
|
|
|
|
device_type="genymotion"
|
|
|
|
fi
|
|
|
|
|
2016-07-18 16:22:32 +03:00
|
|
|
if [ ! -z $2 ]
|
|
|
|
then
|
|
|
|
cljs_build="$2"
|
|
|
|
else
|
|
|
|
cljs_build="android"
|
|
|
|
fi
|
|
|
|
|
2016-04-27 11:06:56 +03:00
|
|
|
if [ "$device_type" = "genymotion" ]
|
|
|
|
then
|
2016-04-24 18:38:49 +07:00
|
|
|
# Find Device based on Android version 6.0.0
|
2017-08-21 17:49:31 +03:00
|
|
|
device=$(/Applications/Genymotion\ Shell.app/Contents/MacOS/genyshell -c "devices list" | grep "6.0.0\|7.0.0")
|
2016-04-27 11:06:56 +03:00
|
|
|
#echo ${device##*| }
|
2016-04-24 18:38:49 +07:00
|
|
|
# Launch device in Genymotion
|
|
|
|
open -a /Applications/Genymotion.app/Contents/MacOS/player.app --args --vm-name "${device##*| }"
|
2016-04-27 11:06:56 +03:00
|
|
|
fi
|
2016-04-24 18:38:49 +07:00
|
|
|
|
2018-07-17 17:59:18 +02:00
|
|
|
# Install deps
|
2018-11-28 19:02:20 +01:00
|
|
|
yarn install --frozen-lockfile
|
2018-06-28 13:50:17 +03:00
|
|
|
|
|
|
|
cd android && ./gradlew react-native-android:installArchives && cd ../
|
2016-04-24 18:38:49 +07:00
|
|
|
|
|
|
|
# open figwheel in new tab
|
2018-07-17 17:59:18 +02:00
|
|
|
tab "clj -R:repl build.clj figwheel --platform ${cljs_build} --ios-device ${device_type}"
|
2016-04-24 18:38:49 +07: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
|
|
|
|
|
2018-06-29 12:29:14 +03:00
|
|
|
make run-android
|
2016-05-26 18:05:10 +02:00
|
|
|
|
2016-07-18 16:22:32 +03:00
|
|
|
if [ ! -z $3 ]
|
2016-05-26 18:05:10 +02:00
|
|
|
then
|
|
|
|
tab "appium"
|
|
|
|
lein test
|
2016-06-02 11:51:44 +02:00
|
|
|
lein doo node test once
|
2016-07-18 16:22:32 +03:00
|
|
|
fi
|