A collection of classes and commands for automated command line scripting using Python.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.7 KiB

4 years ago
.PHONY: docs help tests
# The path to source code to be counted with cloc.
4 years ago
PACKAGE_NAME := scripttease
4 years ago
# The directory where test coverage is generated.
COVERAGE_PATH := docs/build/html/coverage
# Attempt to load a local makefile which may override any of the values above.
-include local.makefile
#> help - Show help.
help:
@echo ""
@echo "Management Commands"
@echo "------------------------------------------------------------------------------"
@cat Makefile | grep "^#>" | sed 's/\#\> //g';
@echo ""
4 years ago
#> dist - Create a distribution of the package.
dist:
cp DESCRIPTION.txt $(PACKAGE_NAME)/;
cp LICENSE.txt $(PACKAGE_NAME)/;
cp VERSION.txt $(PACKAGE_NAME)/;
@rm -Rf build/*;
@rm -Rf dist/*;
@rm -Rf *.egg-info;
python setup.py sdist bdist_wheel;
twine check dist/*;
rm $(PACKAGE_NAME)/*.txt;
4 years ago
#> docs - Generate documentation.
docs: lines
4 years ago
cd docs && make dirhtml;
4 years ago
cd docs && make html;
cd docs && make coverage;
open docs/build/coverage/python.txt;
open docs/build/html/index.html;
4 years ago
#> clean - Remove pyc files and documentation builds.
4 years ago
clean:
find . -name '*.pyc' -delete;
4 years ago
(cd docs && make clean);
4 years ago
# lines - Generate lines of code report.
lines:
rm -f docs/source/_data/cloc.csv;
echo "files,language,blank,comment,code" > docs/source/_data/cloc.csv;
4 years ago
cloc $(PACKAGE_NAME) --csv --quiet --unix --report-file=tmp.csv
4 years ago
tail -n +2 tmp.csv >> docs/source/_data/cloc.csv;
rm tmp.csv;
4 years ago
#> publish - Publish to PYPI.
publish:
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*;
4 years ago
#> tests - Run unit tests and generate coverage report.
tests:
coverage run --source=. -m pytest;
coverage html --directory=$(COVERAGE_PATH);
open $(COVERAGE_PATH)/index.html;