Scripts/run-demo.sh (1549B)
1
2
3
4
5
6
7
8
9
10
11
12set -euo pipefail
13
14SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
15source "${SCRIPT_DIR}/demo-simulator.sh"
16
17
18
19open_simulator_app() {
20 open -b com.apple.dt.Devices 2>/dev/null \
21 || open -b com.apple.iphonesimulator
22}
23
24DELETE=false
25MAJOR=27
26for arg in "$@"; do
27 case "$arg" in
28 --delete) DELETE=true ;;
29 [0-9]*) MAJOR="$arg" ;;
30 *) echo "Unknown argument: $arg" >&2; exit 1 ;;
31 esac
32done
33
34if [ "$DELETE" = true ]; then
35 UDID=$(demo_udid)
36 if [ -n "$UDID" ]; then
37 xcrun simctl shutdown "$UDID" 2>/dev/null || true
38 xcrun simctl delete "$UDID"
39 echo "Deleted '${DEMO_NAME}' (${UDID})."
40 else
41 echo "No '${DEMO_NAME}' simulator to delete."
42 fi
43 exit 0
44fi
45
46open_simulator_app
47demo_simulator "$MAJOR"
48demo_install
49demo_launch
50open_simulator_app
51
52echo ""
53echo "Launched ${BUNDLE_ID} with --reportage-seed-demo on '${DEMO_NAME}' (${UDID})."