-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
97 lines (71 loc) · 2.68 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
94
95
96
97
HUGO=hugo
HUGO_CACHEDIR=~/hugo_cache
HUGO_FLAGS=--cleanDestinationDir
PRETTIER=pnpm prettier
RSYNC=rsync
RSYNC_FLAGS=
HUT=hut
GEMINI_DEST=~/public_gemini
GEMINI_DEST_BASE=public_gemini
HTML_DEST=~/public_html
DATA_BAK_DEST=pgs.sh:/site-data
UGLYURL_EXCLUDE=*not-used-anymore*
DEPLOY_HTML=home.hedy.dev
DEPLOY_HTML_REPO=/Users/hedy/projects/site-public
DEPLOY_GEMINI=gmi.hedy.dev
DEPLOY_GEMINI_DIST=gmi.tar.gz
.DEFAULT_GOAL := all
lint-css:
pnpm exec stylelint --config .config/stylelint.json --rd --rdd assets/main.css
lint-html-validate:
pnpm exec html-validate --config .config/htmlvalidate.json $(HTML_DEST)
lint-html-proofer:
htmlproofer $(HTML_DEST) --checks Links,Images,Scripts,Favicon,OpenGraph --no-allow-missing-href --no-ignore-empty-alt
lint: lint-css lint-html-validate lint-html-proofer
deploy-html:
$(RSYNC) -r --delete --exclude .git $(HTML_DEST)/ $(DEPLOY_HTML_REPO)
cd $(DEPLOY_HTML_REPO) && git add -A
cd $(DEPLOY_HTML_REPO) && git commit -m 'make deploy-html'
cd $(DEPLOY_HTML_REPO) && git push
$(RSYNC) -rv assets/data $(DATA_BAK_DEST)
deploy-gemini:
$(RSYNC) -rav ../spsrv/README.gmi $(GEMINI_DEST)/spsrv/index.gmi
tar -C $(GEMINI_DEST) -cvz . > $(DEPLOY_GEMINI_DIST)
$(HUT) pages publish --protocol GEMINI -d $(DEPLOY_GEMINI) $(DEPLOY_GEMINI_DIST)
rm $(DEPLOY_GEMINI_DIST)
deploy: deploy-html deploy-gemini
backup:
$(RSYNC) -ra $(GEMINI_DEST) $(GEMINI_DEST)-back --delete
$(RSYNC) -ra $(HTML_DEST) $(HTML_DEST)-back --delete
$(RSYNC) -ra assets/data $(HTML_DEST)-back/data
nonsymlink-clean:
# clean all non-symlink files
find $(GEMINI_DEST) -not -type l -type f -delete
gen:
rm -rf $(HUGO_CACHEDIR)/site/filecache/getresource
bin/getraindrop.sh
make hugo
hugo:
$(HUGO) $(HUGO_FLAGS) --cacheDir $(HUGO_CACHEDIR)
gemini:
$(RSYNC) -ra $(GEMINI_DEST) $(GEMINI_DEST)-back --delete
$(RSYNC) -ra public/gemini/ $(GEMINI_DEST)/ --exclude _index.gmi
$(RSYNC) -ra public/posts/gemini/* public/posts/*.gmi $(GEMINI_DEST)/posts --exclude _index.gmi
gemini-clean:
GEMINI_DEST=$(GEMINI_DEST) PUBLIC=public python3 bin/gemini-clean.py -n
html:
rm -rf public/tags/*/index.xml
$(RSYNC) --delete -ra public/ --exclude '*.gmi' --exclude gemini $(HTML_DEST)
@# Manually include gemini tag (because it was excluded above)
$(RSYNC) --delete -ra public/tags/gemini $(HTML_DEST)/tags/
html-prettify:
$(PRETTIER) --config .config/prettier.toml --write $(HTML_DEST)"/**/*.html"
finish-clean:
rm -rf $(GEMINI_DEST)-back $(HTML_DEST)-back
gen-gemini: backup gen gemini gemini-clean
gen-html: backup gen html
all: backup gen gemini html gemini-clean
full: nonsymlink-clean backup gen gemini html gemini-clean
# DO NOT USE THIS LOL
danger-all: all finish-clean
danger-full: full finish-clean