-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassist
executable file
·69 lines (61 loc) · 1.41 KB
/
assist
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
HERE=`dirname $0`
LUAJIT="$HERE/deps/luajit-bin/luajit"
do_help () {
echo "Usage: assist <verb>"
echo "Verbs:"
echo " fetch"
echo " Download the version of dependencies indicated in lockfiles"
echo " upgrade"
echo " Figures out what the latest version of all dependencies is, upgrades"
echo " the lockfiles, and then does a fetch of them."
echo " run <url>"
echo " Runs your alloapp and connects it to <url>"
echo " serve"
echo " allows users to launch your app into places over a HTTP gateway."
echo " Read more at https://docs.alloverse.com/hosting"
exit
}
do_upgrade () {
echo "Upgrading allonet..."
mkdir -p "$HERE/lib"
$LUAJIT "$HERE/assist.lua" "$HERE" upgrade "${1-}"
}
do_fetch () {
echo "Fetching allonet..."
mkdir -p "$HERE/lib"
$LUAJIT "$HERE/assist.lua" "$HERE" fetch
}
do_run () {
$LUAJIT "$HERE/deps/alloui/lua/alloui/app_boot.lua" "$HERE/.." $*
}
do_serve () {
python3 "$HERE/serve.py" $*
}
if [ "$#" -lt 1 ]; then
do_help
exit
fi
case $1 in
upgrade )
do_upgrade ${2-}
;;
fetch )
do_fetch
;;
serve )
do_serve ${2-}
;;
run )
if [ "$#" -lt 2 ]; then
do_help
exit
fi
do_run "${@:2}"
;;
* )
do_help
;;
esac