forked from DarrenOfficial/dpaste
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (58 loc) · 2.12 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
#
# Makefile that handles all the static file compilation and
# adds some helper tools for daily development.
#
SHELL=/bin/bash -eu -o pipefail
define N # newline
endef
.PHONY: test
test: ## Run Django tests
docker-compose run --rm app pytest dpaste/
.PHONY: code-cleanup
code-cleanup: ## Black and isort the Python codebase
autoflake --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables \
--in-place --exclude "**/migrations/*,dpaste/settings/local.py" -r dpaste
isort -rc dpaste
black --exclude='/(migrations)/' dpaste
.PHONY: docs
docs: ## Compile the documentation
docker-compose run --rm app sphinx-build docs docs/_build/html
.PHONY: docs-watch
docs-watch: ## Compile the documentation and watch for changes
docker-compose run -p 8000:8000 --rm app sphinx-autobuild --host 0 --port 8000 docs docs/_build/html
.PHONY: css
css: ## Compile SCSS files
npx sass --no-source-map --style=compressed client/scss/dpaste.scss:dpaste/static/dpaste.css
.PHONY: css-watch
css-watch: ## Compile JS files
npx sass --watch client/scss/dpaste.scss:dpaste/static/dpaste.css
.PHONY: js
js: ## Compile JS files
npx uglifyjs --compress="drop_console=true,ecma=6" --mangle="toplevel" --output=dpaste/static/dpaste.js client/js/dpaste.js
.PHONY: release-docker
release-docker:
set -ex
rm -f .coverage
pip-compile --dry-run setup.py
docker build --build-arg BUILD_EXTRAS=production -t barttc/dpaste:latest .
docker run --rm barttc/dpaste:latest pytest dpaste/
@echo -e "\n\n💫 All fine. Now do: docker push barttc/dpaste:latest"
.PHONY: release-pypi
release-pypi:
set -ex
rm -f .coverage
pip-compile --dry-run setup.py
docker-compose build
docker-compose run --rm app pytest dpaste/
rm -rf ./node_modules
npm ci
make css
make js
python setup.py sdist && python setup.py bdist_wheel --universal
@echo -e "\n\n💫 All fine. Now do: twine upload dist/* --sign"
.PHONY: help
help:
@echo -e "Available make commands:"
@echo -e ""
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sort | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
.DEFAULT_GOAL := start