|
| 1 | +.PHONY: clean-pyc clean-build clean docs |
| 2 | +UNAME := $(shell uname) |
| 3 | + |
| 4 | +SPHINX_BUILDARGS= |
| 5 | +# Note that these are keys generated by the docker rsconnect service, so are |
| 6 | +# not really secrets. They are saved to json to make it easy to use rsconnect |
| 7 | +# as multiple users from the tests |
| 8 | +RSC_API_KEYS=vetiver/tests/rsconnect_api_keys.json |
| 9 | + |
| 10 | +ifeq ($(UNAME), Darwin) |
| 11 | + BROWSER := open |
| 12 | +else |
| 13 | + BROWSER := python -mwebbrowser |
| 14 | +endif |
| 15 | + |
| 16 | +help: |
| 17 | + @echo "clean - remove all build, test, coverage and Python artifacts" |
| 18 | + @echo "clean-build - remove build artifacts" |
| 19 | + @echo "clean-pyc - remove Python file artifacts" |
| 20 | + @echo "clean-test - remove test and coverage artifacts" |
| 21 | + @echo "lint - check style with flake8" |
| 22 | + @echo "test - run tests quickly with the default Python" |
| 23 | + @echo "coverage - check code coverage quickly with the default Python" |
| 24 | + @echo "docs - generate Sphinx HTML documentation, including API docs" |
| 25 | + @echo "cdocs - cleanout previous build & generate Sphinx HTML documentation, including API docs" |
| 26 | + @echo "release - package and upload a release" |
| 27 | + @echo "dist - package" |
| 28 | + @echo "install - install the package to the active Python's site-packages" |
| 29 | + @echo "dev - generate RStudio Connect API keys" |
| 30 | + @echo "dev-start - start up development RStudio Connect in Docker" |
| 31 | + @echo "dev-stop - stop RStudio Connect dev container" |
| 32 | + |
| 33 | +clean: clean-build clean-pyc clean-test docs-clean |
| 34 | + |
| 35 | +clean-build: |
| 36 | + rm -fr build/ |
| 37 | + rm -fr dist/ |
| 38 | + rm -fr .eggs/ |
| 39 | + find . -name '*.egg-info' -exec rm -fr {} + |
| 40 | + find . -name '*.egg' -exec rm -f {} + |
| 41 | + |
| 42 | +clean-pyc: |
| 43 | + find . -name '*.pyc' -exec rm -f {} + |
| 44 | + find . -name '*.pyo' -exec rm -f {} + |
| 45 | + find . -name '*~' -exec rm -f {} + |
| 46 | + find . -name '__pycache__' -exec rm -fr {} + |
| 47 | + |
| 48 | +clean-test: |
| 49 | + rm -f .coverage |
| 50 | + rm -f coverage.xml |
| 51 | + rm -fr htmlcov/ |
| 52 | + |
| 53 | +lint: |
| 54 | + flake8 vetiver |
| 55 | + |
| 56 | +test: clean-test |
| 57 | + pytest |
| 58 | + |
| 59 | +coverage: |
| 60 | + coverage report -m |
| 61 | + coverage html |
| 62 | + $(BROWSER) htmlcov/index.html |
| 63 | + |
| 64 | +cdocs cdoc cdocumentation: docs-clean docs |
| 65 | + |
| 66 | +docs-clean: |
| 67 | + $(MAKE) -C docs clean |
| 68 | + |
| 69 | +docs doc documentation: |
| 70 | + $(MAKE) -C docs html |
| 71 | + $(BROWSER) docs/_build/html/index.html |
| 72 | + |
| 73 | +release: dist |
| 74 | + twine upload dist/* |
| 75 | + |
| 76 | +dist: clean |
| 77 | + python setup.py sdist |
| 78 | + |
| 79 | +install: clean |
| 80 | + python setup.py install |
| 81 | + |
| 82 | +develop: clean-pyc |
| 83 | + python setup.py develop |
| 84 | + |
| 85 | +dev: vetiver/tests/rsconnect_api_keys.json |
| 86 | + |
| 87 | +dev-start: |
| 88 | + docker-compose up -d |
| 89 | + docker-compose exec -T rsconnect bash < script/setup-rsconnect/add-users.sh |
| 90 | + # curl fails with error 52 without a short sleep.... |
| 91 | + sleep 5 |
| 92 | + curl -s --retry 10 --retry-connrefused http://localhost:3939 |
| 93 | + |
| 94 | +dev-stop: |
| 95 | + docker-compose down |
| 96 | + rm -f $(RSC_API_KEYS) |
| 97 | + |
| 98 | +$(RSC_API_KEYS): dev-start |
| 99 | + python script/setup-rsconnect/dump_api_keys.py $@ |
0 commit comments