-
Notifications
You must be signed in to change notification settings - Fork 2
/
act.sh
executable file
·59 lines (47 loc) · 1.22 KB
/
act.sh
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
#!/bin/bash
BAD='\u001b[1m\u001b[31m'
GOOD='\u001b[1m\u001b[32m'
OK='\u001b[0m'
help()
{
echo "Run \"./act.sh [keys]\" with following keys:"
echo "\"-h\" to see this message again"
echo "\"-i\" to check and/or install dependencies of the app"
echo "\"-b\" to build the app and prepare to launch"
echo "\"-d\" to launch in development mode"
echo "\"-p\" to launch in production mode"
echo "... or their combinations! (e.g. \"./act.sh -i -b -p\" for quick deploy)"
}
install()
{
{
python3 -m pip --version > /dev/null && echo -e "${GOOD}Python and pip are proved to be installed!${OK}"
} || {
echo -e "${BAD}Please, install python3 and pip to proceed!${OK}"
exit
}
xargs -I %s python3 -m pip install %s < ./dependencies
{
npm -v > /dev/null && echo -e "${GOOD}Node.js and npm are proved to be installed!${OK}"
} || {
echo -e "${BAD}Please, install Node.js and npm to proceed!${OK}"
exit
}
npm install -production=false
}
if [ $# -eq 0 ]
then
help
exit
fi
while getopts hibdp flag
do
case "${flag}" in
h) help;;
i) install;;
b) npm run build;;
d) ./venv/bin/python3 -m app.server -d;;
p) ./venv/bin/python3 -m app.server -p;;
*) help;;
esac
done