Files: 59c0f9d88cdd78f718fca44638dffb31ada0c2a1 / Makefile
1346 bytesRaw
1 | .PHONY: lint clean check-publish publish serve |
2 | |
3 | output: $(shell find content static) .cache/generator .cache/lint |
4 | python generator/generate.py |
5 | touch $@ |
6 | |
7 | .cache/generator: $(shell find generator) .cache/deps |
8 | python -m black --experimental-string-processing . |
9 | touch $@ |
10 | |
11 | .cache/deps: Makefile |
12 | toolbox run pip install black |
13 | toolbox run pip install beautifulsoup4==4.9.3 |
14 | toolbox run pip install marko==1.1.0 |
15 | toolbox run pip install python-frontmatter==1.0.0 |
16 | mkdir -p .cache |
17 | touch $@ |
18 | |
19 | lint: .cache/lint |
20 | |
21 | .cache/lint: $(shell find static/style) |
22 | toolbox run npx -y prettier -w static/style/tarazed.css |
23 | touch $@ |
24 | |
25 | clean: .cache/clean |
26 | |
27 | .cache/clean: $(shell find output/*) |
28 | rm -r output |
29 | touch $@ |
30 | |
31 | check-publish: |
32 | ifeq "${SSHUSER}" "" |
33 | @echo "SSHUSER is undefined" |
34 | @exit 1 |
35 | else ifeq "${SSHPASS}" "" |
36 | @echo "SSHPASS is undefined" |
37 | @exit 1 |
38 | else ifeq "${SSHDIR}" "" |
39 | @echo "SSHDIR is undefined" |
40 | @exit 1 |
41 | else ifeq "${SSHPORT}" "" |
42 | @echo "SSHPORT is undefined" |
43 | @exit 1 |
44 | else ifneq "$(shell git status --porcelain)" "" |
45 | @echo "Uncommitted changes:" |
46 | @git status --porcelain |
47 | @exit 1 |
48 | endif |
49 | |
50 | publish: clean check-publish .cache/publish |
51 | |
52 | .cache/publish: output |
53 | echo -e "cd ${SSHDIR} \n put -r output/* \n exit" | \ |
54 | sshpass -e sftp -oBatchMode=no -b - sftp://${SSHUSER}@gkn.me.uk:${SSHPORT} |
55 | touch $@ |
56 | |
57 | serve: output |
58 | cd output && python -m http.server |
59 |
Built with git-ssb-web