-
Notifications
You must be signed in to change notification settings - Fork 3
/
init-env.sh
executable file
·47 lines (40 loc) · 1.75 KB
/
init-env.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
#!/bin/bash
# Fetch all submodules if the a-plus directory is empty
if [ -z "$(ls -A a-plus)" ]; then
git submodule update --init --recursive
fi
if ! [ -d ".venv" ]; then
# Create and activate virtual environment if it doesn't exist yet
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install setuptools pyyaml -r a-plus/requirements.txt -r a-plus/requirements_testing.txt
playwright install
else
# Activate virtual environment if it exists already
source .venv/bin/activate
fi
# Move to aplus-manual directory and build the course if it hasn't been built yet
if ! [ -d aplus-manual/_build ]; then
cd aplus-manual
./docker-compile.sh
cd ..
fi
# Create a-plus/aplus/local_settings.py if it doesn't exist yet
if [ -z "$APLUS_LOCAL_SETTINGS" ] && ! [ -f "a-plus/aplus/local_settings.py" ]; then
echo "Creating 'a-plus/aplus/local_settings.py' from 'a-plus/aplus/local_settings.example.py' since it does not exist yet..."
cp a-plus/aplus/local_settings.example.py a-plus/aplus/local_settings.py
fi
# Create docker-compose.yml if it doesn't exist yet
if [ -z "$COMPOSE_FILE" ] && ! [ -f "docker-compose.yml" ]; then
OS=$(uname -s)
if [ "$OS" = 'Darwin' ]; then
echo "Creating 'docker-compose.yml' from 'docker-compose.macOS.example.yml' since it does not exist yet..."
cp docker-compose.macOS.example.yml docker-compose.yml
else
echo "Creating 'docker-compose.yml' from 'docker-compose.example.yml' since it does not exist yet..."
cp docker-compose.example.yml docker-compose.yml
fi
fi
# Compile all translations (a-plus, mooc-grader, gitmanager, mooc-jutut)
APLUS_SECRET_KEY_FILE=a-plus/aplus/secret_key.py python3 a-plus/manage.py compilemessages --ignore=.venv
echo "Done!"