Moved source file from other repo

This commit is contained in:
Jef Roosens 2020-08-25 17:07:27 +02:00
parent fda5e1b3d7
commit e8ee438d65
19 changed files with 487 additions and 102 deletions

44
Makefile Executable file → Normal file
View file

@ -1,11 +1,9 @@
# =====CONFIG=====
# File to run when make run is called
MAIN=main.py
# Source directory
SRC=frank
# Directory name of the venv
# Don't put spaces in the VENV name, make does not like spaces
# Run make clean first if you do this after already having created a venv
# Run make clean first if you change this after already having created a venv
VENV=venv
# Docs directory
DOCS=docs
@ -13,40 +11,18 @@ DOCS=docs
TESTS=tests
# Interpreter to create venv with
INTERPRETER=python3.8
# Docker image name:tag
IMAGE='chewingbever/frank:latest'
all: run
# Re-create venv when needed
$(VENV)/bin/activate: requirements.txt
$(VENV)/bin/activate: requirements.txt requirements-dev.txt
@ echo "Rebuilding venv..."
@ [ ! -e "$(VENV)" ] || rm -rf "$(VENV)"
@ "$(INTERPRETER)" -m venv "$(VENV)"
@ "$(VENV)/bin/pip" install -r requirements.txt
@ "$(VENV)/bin/pip" install -r requirements.txt -r requirements-dev.txt
build: $(VENV)/bin/activate
# Run script
run: build
@ "$(VENV)/bin/python" "$(MAIN)"
# =====DOCKER=====
# Build docker image
dbuild: docker/Dockerfile
@ docker build -f docker/Dockerfile -t $(IMAGE) .
# Run docker
drun: dbuild docker/docker-compose.yml
@ docker-compose -f docker/docker-compose.yml up
# run docker as daemon
drund: dbuild docker/docker-compose.yml
@ docker-compose -f docker/docker-compose.yml up -d
dpush: dbuild
@ docker push $(IMAGE)
build-venv: $(VENV)/bin/activate
# =====CLEANING=====
clean: clean-venv clean-cache clean-docs
@ -69,7 +45,7 @@ clean-docs:
# =====DOCS=====
$(VENV)/bin/sphinx-build: build
$(VENV)/bin/sphinx-build: build-venv
@ echo "Installing sphinx..."
@ "$(VENV)/bin/pip" install --quiet sphinx
@ -79,11 +55,11 @@ docs: $(VENV)/bin/sphinx-build
# =====TESTS=====
$(VENV)/bin/pytest: build
$(VENV)/bin/pytest: build-venv
@ echo "Installing pytest..."
@ "$(VENV)/bin/pip" install --quiet pytest
test: pytest.ini build
test: pytest.ini $(VENV)/bin/pytest
@ "$(VENV)/bin/pytest" --color=yes
@ -98,5 +74,5 @@ package: README.md LICENSE setup.py test
# Publish will also come here someday
.PHONY: all run clean clean-venv clean-cache clean-docs test package docs \
build dbuild drun dpush drund
.PHONY: all clean clean-venv clean-cache clean-docs test package docs \
build-venv run-venv