From 15276b425e422952a296c7e7842c56898cf44979 Mon Sep 17 00:00:00 2001 From: "nilscarstensen@live.com" Date: Mon, 24 May 2021 18:41:41 +0200 Subject: [PATCH] Add: venv,clean,tests,lint,format and help --- Makefile | 53 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index c83d901..8b1fb8d 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,57 @@ -.PHONY: help prepare-dev run-dev .DEFAULT: help VENV_NAME?=venv VENV_ACTIVATE=. $(VENV_NAME)/bin/activate PYTHON=${VENV_NAME}/bin/python3 +.PHONY: help help: -# TODO add help + @echo 'Makefile for "Auto README for Terraform"' + @echo '' + @echo ' prepare-dev - Installs required Python packages via Pip.' + @echo ' run - Run main.py' + @echo ' create-venv - Create virtual environment.' + @echo ' remove-venv - Remove the virutal environment.' + @echo ' lint - Run flake8 to lint your Python code.' + @echo ' format - Run autopep8 to format Python code.' + @echo ' all-tests - Run all tests in test files.' + @echo ' clean - Clean Python cache files.' + +.PHONY: prepare-dev prepare-dev: -# TODO add prepare-dev -run-dev: + pip3 install flake8 + pip3 install autopep8 + pip3 install virtualenv + +.PHONY: create-venv +create-venv: + virtualenv $(VENV_NAME) + source $(VENV_ACTIVATE) + pip3 install -r src/requirements.txt + +.PHONY: remove-venv +remove-venv: + rm -rf $(VENV_NAME) + +.PHONY: run-dev +run: cd src; \ - python3 main.py --path "../module" \ No newline at end of file + python3 main.py --path "../tests/" + +.PHONY: lint +lint: + flake8 src/ --ignore=E501,W504,E128 + +.PHONY: format +format: + autopep8 --in-place --aggressive --aggressive . + +.PHONY: all-tests +all-tests: + cd src; \ + pytest + +.PHONY: clean +clean: + find -type d -name ".pytest_cache" -exec rm -rf {} + + find -type d -name "__pycache__" -exec rm -rf {} + \ No newline at end of file