-
Notifications
You must be signed in to change notification settings - Fork 3
/
start-dev
executable file
·56 lines (49 loc) · 1.35 KB
/
start-dev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env sh
## startup a development server
RUNNER_SCRIPT_DIR=$(cd ${0%/*} && pwd)
REL_DIR="$RUNNER_SCRIPT_DIR/release"
DEV_DIR="$RUNNER_SCRIPT_DIR/dev"
SYS="-sys $REL_DIR/setup/start"
BOOT="-boot $REL_DIR/setup/start"
CONFIG="-config $REL_DIR/files/app.config"
START_ARGS="$SYS $BOOT $CONFIG"
HOST=`hostname`
NAME="-name nw-dev@$HOST"
LIBS="$RUNNER_SCRIPT_DIR:$RUNNER_SCRIPT_DIR/lib:$ERL_LIBS"
export ERL_LIBS=$LIBS
if [ ! -d "$DEV_DIR" ]; then
echo "Setting up development environment for first time..."
mkdir -p "$DEV_DIR/etc/db"
mkdir -p "$DEV_DIR/log"
cd "$DEV_DIR"
SYS="-sys $REL_DIR/setup/install"
BOOT="-boot $REL_DIR/setup/install"
CONF="-config $REL_DIR/files/app.config"
eval "erl $NAME $SYS $BOOT -embedded $CONF"
fi
cd "$DEV_DIR"
for var in "$@"
do
case "$var" in
--help)
echo "$0 [options]"
echo "--kit = start with dxkit"
echo "--web = start with dxkit + webapp"
exit 0
;;
--kit)
START_ARGS="$START_ARGS -eval 'dxkit:start_dev()'"
;;
--web)
START_ARGS="$START_ARGS -eval 'dxweb:start_dev()'"
;;
--attach)
ATTACHED=""
;;
*)
echo "Ignoring $var"
esac
done
EXEC_CMD="erl $NAME -pa `pwd` $START_ARGS"
echo "$EXEC_CMD"
eval "$EXEC_CMD"