forked from salesforce/policy_sentry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (78 loc) · 3.89 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
70
71
72
73
74
75
76
77
78
79
80
81
SHELL:=/bin/bash
PROJECT := policy-sentry
PROJECT_UNDERSCORE := policy_sentry
# ---------------------------------------------------------------------------------------------------------------------
# Environment setup and management
# ---------------------------------------------------------------------------------------------------------------------
virtualenv:
python3 -m venv ./venv && source venv/bin/activate
setup-env: virtualenv
python3 -m pip install -r requirements.txt
setup-dev: setup-env
python3 -m pip install -r requirements-dev.txt
# ---------------------------------------------------------------------------------------------------------------------
# Documentation
# ---------------------------------------------------------------------------------------------------------------------
build-docs: clean virtualenv
python3 -m pip install -r docs/requirements.txt
mkdocs build --clean --site-dir _build/html --config-file mkdocs.yml
serve-docs: clean virtualenv
python3 -m pip install -r docs/requirements.txt
mkdocs serve --dev-addr "127.0.0.1:8001"
# ---------------------------------------------------------------------------------------------------------------------
# Installation etc.
# ---------------------------------------------------------------------------------------------------------------------
build: setup-env clean
python3 -m pip install --upgrade setuptools wheel
python3 -m setup -q sdist bdist_wheel
install: build
python3 -m pip install -q ./dist/${PROJECT}*.tar.gz
${PROJECT} --help
uninstall:
python3 -m pip uninstall ${PROJECT} -y
python3 -m pip uninstall -r requirements.txt -y
python3 -m pip uninstall -r requirements-dev.txt -y
python3 -m pip freeze | xargs python3 -m pip uninstall -y
clean:
rm -rf dist/
rm -rf build/
rm -rf _build/
rm -rf *.egg-info
find . -name '*.pyc' -delete
find . -name '*.pyo' -delete
find . -name '*.egg-link' -delete
find . -name '*.pyc' -exec rm --force {} +
find . -name '*.pyo' -exec rm --force {} +
# ---------------------------------------------------------------------------------------------------------------------
# Testing
# ---------------------------------------------------------------------------------------------------------------------
test: setup-dev
python3 -m coverage run -m pytest -v
security-test: setup-dev
bandit -r ./${PROJECT_UNDERSCORE}/
# ---------------------------------------------------------------------------------------------------------------------
# Linting and formatting
# ---------------------------------------------------------------------------------------------------------------------
fmt: setup-dev
black ${PROJECT_UNDERSCORE}/
lint: setup-dev
pylint ${PROJECT_UNDERSCORE}/
# ---------------------------------------------------------------------------------------------------------------------
# Package publishing
# ---------------------------------------------------------------------------------------------------------------------
publish: build
python3 -m pip install --upgrade twine
python3 -m twine upload dist/*
python3 -m pip install ${PROJECT}
# ---------------------------------------------------------------------------------------------------------------------
# Miscellaneous
# ---------------------------------------------------------------------------------------------------------------------
count-loc:
echo "If you don't have tokei installed, you can install it with 'brew install tokei'"
echo "Website: https://github.com/XAMPPRocky/tokei#installation'"
tokei ./* --exclude --exclude '**/*.html' --exclude '**/*.json' --exclude "docs/*" --exclude "examples/*" --exclude "test/*"
# ---------------------------------------------------------------------------------------------------------------------
# Project specific scripts
# ---------------------------------------------------------------------------------------------------------------------
update-iam-data: setup-dev
python3 ./utils/download_docs.py