-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·49 lines (40 loc) · 975 Bytes
/
run.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
#!/bin/sh
run_processing() {
echo "Running _processing.sh"
if ./scripts/_processing.sh $1; then
echo "_processing.sh succeeded"
echo ""
else
echo "_processing.sh failed. Exiting the script."
exit 1
fi
}
check_git_status(){
output=$(git diff-index --quiet HEAD --)
exit_status=$?
# Check if there are uncommitted changes or files
if [ $exit_status -ne 0 ]; then
echo "Warning: There are uncommitted changes or files."
if [ $PRODUCTION ]; then
exit 1
fi
fi
}
export_from_env(){
var_value=$(grep "^$1=" .env | cut -d '=' -f2-)
echo "Exporting \$$1=$var_value"
export $1="$var_value"
}
echo "Run: PREPARING"
export_from_env VENV_DIR
echo "Run: START"
cat README.md
echo "Run: PROCESSING"
lang=${1:-en}
run_processing "$lang"
check_git_status
echo "Run: APPLICATION"
. ./scripts/fn_activate_venv.sh
activate_venv
python -m src.run $1
echo "Run: END/DONE"