forked from chriskuehl/fluffy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (73 loc) · 2.27 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
82
83
84
85
86
87
88
89
90
91
92
93
VENV := venv
BIN := $(VENV)/bin
DOCKER_TAG := ckuehl/fluffy-server
export FLUFFY_SETTINGS := $(CURDIR)/settings.py
.PHONY: minimal
minimal: $(VENV) assets settings.py install-hooks
$(VENV): setup.py cli/setup.py requirements.txt requirements-dev.txt
rm -rf $@
virtualenv -ppython3 $@
$@/bin/pip install -r requirements.txt -r requirements-dev.txt -e cli -e .[guesslang]
fluffy/static/app.css: $(VENV) $(wildcard fluffy/static/scss/*.scss)
$(BIN)/pysassc fluffy/static/scss/app.scss $@
fluffy/static/pygments.css: $(VENV) fluffy/component/styles.py
$(BIN)/python -m fluffy.component.styles > $@
ASSET_FILES := $(shell find fluffy/static -type f -not -name '*.hash')
ASSET_HASHES := $(addsuffix .hash,$(ASSET_FILES))
fluffy/static/%.hash: fluffy/static/%
sha256sum $^ | awk '{print $$1}' > $@
.PHONY: assets
assets: fluffy/static/app.css.hash fluffy/static/pygments.css.hash $(ASSET_HASHES)
.PHONY: upload-assets
upload-assets: assets $(VENV)
$(BIN)/fluffy-upload-assets
settings.py:
ln -fs settings/dev_files.py settings.py
.PHONY: watch-assets
watch-assets:
while :; do \
find fluffy/static -type f | \
inotifywait --fromfile - -e modify; \
make assets; \
done
.PHONY: dev
dev: $(VENV) fluffy/static/app.css
$(BIN)/python -m fluffy.run
.PHONY: test
test: $(VENV)
$(BIN)/coverage erase
COVERAGE_PROCESS_START=$(CURDIR)/.coveragerc \
$(BIN)/py.test -vv tests/
$(BIN)/coverage combine
$(BIN)/coverage report
.PHONY: install-hooks
install-hooks: $(VENV)
$(BIN)/pre-commit install -f --install-hooks
.PHONY: pre-commit
pre-commit: $(VENV)
$(BIN)/pre-commit run --all-files
.PHONY: docker-image
docker-image: assets
docker build -t $(DOCKER_TAG) .
@echo 'Maybe you want to run:'
@echo -e ' \033[1mdocker push ckuehl/fluffy-server\033[0m'
.PHONY: docker-run
docker-run: docker-image
docker run -p 8000 $(DOCKER_TAG)
.PHONY: clean
clean:
rm -rf $(VENV)
.PHONY: release
release: $(VENV) assets
# server
$(BIN)/python setup.py sdist
$(BIN)/python setup.py bdist_wheel
$(BIN)/twine upload --skip-existing dist/*
# cli
cd cli && ../$(BIN)/python setup.py sdist
cd cli && ../$(BIN)/python setup.py bdist_wheel
cd cli && ../$(BIN)/twine upload --skip-existing dist/*
cd cli && debuild -us -uc -b
.PHONY: upgrade-requirements
upgrade-requirements: venv
upgrade-requirements