2021-12-08 19:23:42 +01:00
|
|
|
SHELL=/usr/bin/env bash
|
2019-07-13 15:25:32 +02:00
|
|
|
|
2022-02-07 22:27:59 +01:00
|
|
|
.DEFAULT_GOAL := run
|
2019-07-13 15:25:32 +02:00
|
|
|
|
2022-02-07 22:27:59 +01:00
|
|
|
.PHONY: run
|
|
|
|
run: setup
|
2022-02-08 14:47:16 +01:00
|
|
|
( \
|
|
|
|
find . -name __pycache__ -o -name "*.pyc" -delete; \
|
2022-03-29 21:14:33 +02:00
|
|
|
sudo iptables -I INPUT -p tcp --dport 8000 -j ACCEPT; \
|
2022-11-27 18:06:17 +01:00
|
|
|
cd src/; \
|
2022-03-27 16:12:56 +02:00
|
|
|
python manage.py runserver 0.0.0.0:8000; \
|
2022-02-08 14:47:16 +01:00
|
|
|
)
|
2020-07-04 11:55:55 +02:00
|
|
|
|
2022-02-07 22:27:59 +01:00
|
|
|
.PHONY: setup
|
2022-03-01 09:49:56 +01:00
|
|
|
setup:
|
2019-08-10 15:14:36 +02:00
|
|
|
( \
|
2022-02-07 22:27:59 +01:00
|
|
|
docker-compose -f docker-compose-development.yml up -d; \
|
2022-11-27 18:06:17 +01:00
|
|
|
cd src/; \
|
2022-02-07 22:27:59 +01:00
|
|
|
if [ -f .second_run ]; then \
|
|
|
|
sleep 2; \
|
|
|
|
python manage.py collectstatic --noinput; \
|
|
|
|
python manage.py makemigrations; \
|
|
|
|
python manage.py migrate; \
|
|
|
|
else \
|
|
|
|
python manage.py collectstatic --noinput; \
|
|
|
|
python manage.py makemigrations backups; \
|
|
|
|
python manage.py makemigrations computers; \
|
|
|
|
python manage.py makemigrations core; \
|
|
|
|
python manage.py makemigrations customers; \
|
|
|
|
python manage.py makemigrations devices; \
|
|
|
|
python manage.py makemigrations licenses; \
|
|
|
|
python manage.py makemigrations nets; \
|
|
|
|
python manage.py makemigrations softwares; \
|
|
|
|
python manage.py makemigrations users; \
|
|
|
|
python manage.py makemigrations; \
|
|
|
|
python manage.py migrate; \
|
|
|
|
python manage.py loaddata backups; \
|
|
|
|
python manage.py loaddata computers; \
|
|
|
|
python manage.py loaddata core; \
|
|
|
|
python manage.py loaddata devices; \
|
|
|
|
python manage.py loaddata nets; \
|
|
|
|
python manage.py loaddata softwares; \
|
|
|
|
python manage.py shell -c "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@example.com', 'password')"; \
|
|
|
|
touch .second_run; \
|
|
|
|
fi; \
|
2019-08-10 15:14:36 +02:00
|
|
|
)
|
2019-07-13 15:25:32 +02:00
|
|
|
|
2022-11-19 16:20:46 +01:00
|
|
|
.PHONY: venv
|
2022-03-01 09:49:56 +01:00
|
|
|
venv:
|
|
|
|
nix build .#venv -o venv
|
|
|
|
|
2020-04-20 15:53:17 +02:00
|
|
|
|
2022-02-07 22:27:59 +01:00
|
|
|
.PHONY: clean
|
2019-08-10 15:08:52 +02:00
|
|
|
clean:
|
2020-07-04 13:00:34 +02:00
|
|
|
docker-compose -f docker-compose-development.yml down -v
|
2022-02-07 22:27:59 +01:00
|
|
|
find . \( -name __pycache__ -o -name "*.pyc" \) -delete
|
|
|
|
rm -rf htmlcov/
|
|
|
|
rm -f */migrations/0*.py
|
|
|
|
rm .second_run
|
2020-01-12 14:00:56 +01:00
|
|
|
|
2022-02-07 22:27:59 +01:00
|
|
|
.PHONY: cleanall
|
|
|
|
cleanall: clean
|
2020-07-04 13:00:34 +02:00
|
|
|
docker-compose -f docker-compose-development.yml down -v --rmi local
|
2022-11-16 21:33:30 +01:00
|
|
|
rm -r .venv
|
2022-02-07 22:27:59 +01:00
|
|
|
|
|
|
|
.PHONY: init
|
|
|
|
init:
|
2022-02-08 14:43:51 +01:00
|
|
|
( \
|
2022-02-08 14:51:14 +01:00
|
|
|
python manage.py loaddata network_inventory.yaml; \
|
2022-02-08 14:43:51 +01:00
|
|
|
)
|
2022-02-07 22:27:59 +01:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test:
|
2022-02-08 14:43:51 +01:00
|
|
|
( \
|
2022-11-27 18:06:17 +01:00
|
|
|
pytest --ds=network_inventory.settings.ram_test -nauto --nomigrations --cov=./src --cov-report=html ./src; \
|
2022-02-08 14:43:51 +01:00
|
|
|
)
|
2022-02-07 22:27:59 +01:00
|
|
|
|
|
|
|
.PHONY: debug
|
|
|
|
debug:
|
2022-02-08 14:43:51 +01:00
|
|
|
( \
|
2022-02-08 14:51:14 +01:00
|
|
|
pytest --pdb --nomigrations --cov=. --cov-report=html; \
|
2022-02-08 14:43:51 +01:00
|
|
|
)
|