| 1 | #!/usr/bin/env bash |
| 2 | # A simple configuration file for my vim session |
| 3 | # This file sets up the Makefile and the ENV vars for my vim config. |
| 4 | |
| 5 | # Fake `realpath` when it doesn't exist. This only really happens on |
| 6 | # GitHub actions' MacOS runner, since the system does not come with |
| 7 | # a realpath implementation by default, though it can be installed |
| 8 | # using `brew`. |
| 9 | if ! command -v realpath &> /dev/null |
| 10 | then |
| 11 | realpath() { |
| 12 | echo $PWD |
| 13 | } |
| 14 | fi |
| 15 | |
| 16 | generate_makefile() { |
| 17 | echo "\ |
| 18 | # This file is generated by \`. project-config\`. Any changes made here are overwritten. |
| 19 | |
| 20 | .PHONY: all test cover |
| 21 | PROJECT = $VIM_PROJNAME |
| 22 | |
| 23 | install: |
| 24 | pip3 install -e . |
| 25 | |
| 26 | all: |
| 27 | make install format lint list-todo |
| 28 | |
| 29 | format: |
| 30 | isort \$(PROJECT) && black \$(PROJECT) |
| 31 | |
| 32 | lint: |
| 33 | pylint \$(PROJECT) |
| 34 | |
| 35 | lint-prose: |
| 36 | python3 utils/lint_prose.py |
| 37 | |
| 38 | type: |
| 39 | mypy \$(PROJECT) |
| 40 | |
| 41 | list-todo: |
| 42 | python3 utils/list_todos.py \"\`grep -rnw . -e '# TODO'\`\" |
| 43 | |
| 44 | test: |
| 45 | pytest --cov='./pytermgui' |
| 46 | |
| 47 | cover: |
| 48 | coverage html |
| 49 | |
| 50 | test-cov: |
| 51 | make test cover |
| 52 | |
| 53 | docs: |
| 54 | pdoc --logo https://github.com/bczsalba/pytermgui/blob/master/assets/title.png?raw=true --docformat google -o docs pytermgui" > $VIM_PROJPATH/Makefile |
| 55 | |
| 56 | } |
| 57 | |
| 58 | export VIM_PROJNAME="pytermgui" |
| 59 | export VIM_PROJPATH="$(realpath `dirname $BASH_SOURCE`)" |
| 60 | # export VIM_COMMAND="python3 $VIM_PROJPATH/sandbox/.py" |
| 61 | # export VIM_NOTES="$VIM_PROJPATH/notes.md" |
| 62 | |
| 63 | generate_makefile |
| 64 | echo "Set up project \"$VIM_PROJNAME\" at path \"$VIM_PROJPATH\"." |