.PHONY: install run test clean refresh

install:
	pip install -r requirements.txt
	pip install pytest pytest-cov

clean:
	find . -type d -name "__pycache__" -exec rm -r {} +
	find . -type f -name "*.pyc" -delete
	find . -type f -name "*.pyo" -delete
	find . -type f -name "*.pyd" -delete
	find . -type f -name ".coverage" -delete
	find . -type d -name "*.egg-info" -exec rm -r {} +
	find . -type d -name "*.egg" -exec rm -r {} +
	find . -type d -name ".pytest_cache" -exec rm -r {} +
	find . -type d -name "htmlcov" -exec rm -r {} +
	rm -rf ~/.local/share/controles/database.db*
	rm -f admin_qr.png

init-db: clean
	python init_db.py

seed: init-db
	python seed.py

run:
	python app.py

run-with-seed: seed run

reset-admin: clean
	python create_admin.py

test:
	pytest tests/ --cov=app --cov=functions --cov-report=term-missing

refresh: clean install test
	python app.py
