-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (50 loc) · 1.6 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
APP_VERSION=0.1.9
APP_PATH=simplepcap
APP_TEST_PATH=tests
# COLORED OUTPUT XD
ccerror = $(shell tput setaf 1)
ccok = $(shell tput setaf 2)
ccwarn = $(shell tput setaf 3)
cctarget= $(shell tput setaf 4)
ccinfo = $(shell tput setaf 6)
ccreset = $(shell tput sgr0)
INFO = $(ccinfo)[INFO] |$(ccreset)
WARN = $(ccwarn)[WARN] |$(ccreset)
ERROR = $(ccerror)[ERROR]|$(ccreset)
OK = $(ccok)[OK] |$(ccreset)
.PHONY: help
# Show this help.
help:
@awk '/^#/{c=substr($$0,3);next}c&&/^[[:alpha:]][[:alnum:]_-]+:/{print "$(cctarget)" substr($$1,1,index($$1,":")) "$(ccreset)",c}1{c=0}' $(MAKEFILE_LIST) | column -s: -t
# Build the project
install-dev:
@echo "$(INFO) Installing dev dependencies..."
@pip install .[dev]
# Run linters
lint:
@echo "$(INFO) Running linters..."
@flake8 ./$(APP_PATH)
# Run tests
test:
@echo "$(INFO) Running tests..."
@pytest -v ./$(APP_TEST_PATH)
# Build Docs
build-docs:
@echo "$(INFO) Building docs..."
@mkdocs build --clean
# Run Docs Server
run-docs:
@echo "$(INFO) Running docs server..."
@mkdocs serve
# Update App Version in pyproject.toml, simplepcap/__init__.py
update-version:
@echo "$(INFO) Updating app version..."
@sed -i 's/version = "[0-9]\.[0-9]\.[0-9]"/version = "$(APP_VERSION)"/g' pyproject.toml
@sed -i 's/__version__ = "[0-9]\.[0-9]\.[0-9]"/__version__ = "$(APP_VERSION)"/g' simplepcap/__init__.py
@echo "$(OK) App version updated to $(APP_VERSION)"
# Tag the current version
tag-version:
@echo "$(INFO) Tagging version..."
@git tag -a v$(APP_VERSION) -m "Version $(APP_VERSION)"
@git push origin v$(APP_VERSION)
@echo "$(OK) Version $(APP_VERSION) tagged"