-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·107 lines (88 loc) · 2.49 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# Load nvm for use in shell
[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh
# Tells the script to exit if a command fails instead of continuing
set -e
if [ "$1" == "api" ]; then
echo "Starting backend API..."
echo "./api/dev.sh $2"
./api/dev.sh "$2"
elif [ "$1" == "app" ]; then
echo "Starting frontend app..."
echo "./app/dev.sh ${@:2}"
./app/dev.sh "${@:2}"
elif [ "$1" == "db" ]; then
echo "Making uncompressed database..."
# Drop any local changes to the compressed database
git restore pipeline/compressed/*
source .venv/bin/activate
cd pipeline
make uncompressed
elif [ "$1" == "pipeline-load" ]; then
echo "Running offline pipeline, only load steps..."
source .venv/bin/activate
cd pipeline
make reload
elif [ "$1" == "pipeline-quick" ]; then
echo "Running offline pipeline, without remaking large files..."
source .venv/bin/activate
cd pipeline
make clean-except
make
elif [ "$1" == "pipeline-all" ]; then
echo "Running offline pipeline, remaking all steps..."
source .venv/bin/activate
cd pipeline
make clean
make
elif [ "$1" == "make" ]; then
echo "make ${@:2}"
source .venv/bin/activate
cd pipeline
make "${@:2}"
elif [ "$1" == "sqlite3" ]; then
echo "sqlite3 ${@:2}"
source .venv/bin/activate
sqlite3 "${@:2}"
elif [ "$1" == "pytest" ]; then
echo "pytest ${@:2}"
source .venv/bin/activate
pytest "${@:2}"
elif [ "$1" == "tests" ]; then
echo "Running tests..."
source .venv/bin/activate
pytest -vvl
elif [ "$1" == "test" ]; then
echo "Did you mean 'run tests' ?"
elif [ "$1" == "update" ]; then
echo "Updating dependencies..."
cd app
# Activate Node v14
nvm install 14
nvm use 14
# Install app dependencies
npm install --global yarn
yarn install
cd ..
# Install backend dependencies
source .venv/bin/activate
pip3 install -r requirements.txt
elif [ "$1" == "notebooks" ]; then
echo "Starting Jupyter notebook server..."
echo "./notebooks/start.sh $2"
./notebooks/start.sh "$2"
elif [ "$1" == "notebook" ]; then
echo "Did you mean 'run notebooks' ?"
elif [ "$1" == "sqlite" ]; then
echo "Starting SQLite command line interface..."
# If in the pipeline folder, go back up
# So that this command can be run from either transithealth/ or pipeline/
CURRENT_DIR=$(basename $(pwd))
if [ "$CURRENT_DIR" == "pipeline" ]; then
cd ..
fi
sqlite3 pipeline/database.db -header --column
else
echo "No run shortcut found for: $1"
echo "Did you pull the latest version?"
fi