forked from ocf/ocfweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (46 loc) · 1.52 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
BIN := virtualenv_run/bin
PYTHON := $(BIN)/python
SHELL := /bin/bash
RANDOM_PORT := $(shell expr $$(( 8000 + (`id -u` % 1000) )))
.PHONY: check dev venv clean lint test gunicorn
check: lint test
lint: venv
$(BIN)/pre-commit run --all-files
test: venv
$(BIN)/py.test -v tests/
dev: venv scss
@echo -e "\e[1m\e[93mRunning on http://$(shell hostname -f ):$(RANDOM_PORT)/\e[0m"
$(PYTHON) ./manage.py runserver 0.0.0.0:$(RANDOM_PORT)
venv:
python ./bin/venv-update -ppython3 virtualenv_run requirements.txt requirements-dev.txt
clean:
rm -rf *.egg-info
rm -rf virtualenv_run
# closer to prod
gunicorn: venv
@echo "Running on port $(RANDOM_PORT)"
$(BIN)/gunicorn -b 0.0.0.0:$(RANDOM_PORT) ocfweb.wsgi
scss: venv
$(PYTHON) setup.py build_sass
watch-scss: scss venv
while :; do \
find ocfweb/static -type f -name '*.scss' | \
inotifywait --fromfile - -e modify; \
$(PYTHON) setup.py build_sass; \
done
update-requirements:
$(eval TMP := $(shell mktemp -d))
virtualenv -p python3 $(TMP)
. $(TMP)/bin/activate && \
pip install --upgrade pip && \
pip install . && \
pip freeze | grep -v '^ocfweb==' | sed 's/^ocflib==.*/ocflib/' > requirements.txt
builddeb: autoversion
dpkg-buildpackage -us -uc -b
.PHONY: autoversion
autoversion:
date +%Y.%m.%d.%H.%M-git`git rev-list -n1 HEAD | cut -b1-8` > .version
rm -f debian/changelog
DEBFULLNAME="Open Computing Facility" DEBEMAIL="[email protected]" VISUAL=true \
dch -v `cat .version` -D stable --no-force-save-on-release \
--create --package "ocfweb" "Package for Debian."