-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
71 lines (62 loc) · 1.94 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
SHELL := bash
.PHONY: help
help:
@echo 'make build default target, builds the site into ./_site'
@echo 'make check-deps check to ensure needed dependencies are installed'
@echo 'make check check tools syntax using shellcheck'
@echo 'make serve serve site locally out of ./_site'
@echo 'make deploy deploy the site (using rsync)'
@echo 'make all build and deploy the site'
@echo 'make clean remove any generated files'
.PHONY: build
build: favicon.ico
mkdir -p _site
# copy static files
cat favicon.ico > _site/favicon.ico
cat style.css > _site/style.css
cat robots.txt > _site/robots.txt
# create json
./make-json episodes > _site/json
# create help page
cat <(./make-header) <(echo) <(./make-help) > _site/help
# create index ascii page for curl users
cat <(./make-header) <(echo) \
<(./make-ascii-table episodes) \
<(./make-footer) \
> _site/index.txt
# create nocolor version of that page
npx strip-ansi-cli < _site/index.txt > _site/nocolor
# create all pages for each video
./make-video-pages episodes _site/v
# create the main HTML page
cat <(./make-header) <(echo) \
<(./make-socials) <(echo) \
<(./make-ascii-table episodes) \
<(./make-footer) <(echo) \
<(./make-help) \
<(./make-donate) \
| sed -e 's/ /\ /g' \
| npx ansi-to-html \
| sed -e 's|http://[a-zA-Z0-9./-]*|<a href="&">&</a>|g' \
| sed -e 's|https://[a-zA-Z0-9./-]*|<a href="&">&</a>|g' \
| sed -e '/CONTENT/{r /dev/stdin' -e 'd;}' index.html.template > _site/index.html
favicon.ico:
curl -o $@ https://secure.gravatar.com/avatar/d6e53a055695ad6488b32a6ac4f6ee5d?s=32
.PHONY: all
all: build deploy
.PHONY: serve
serve:
python3 -mhttp.server -d _site
.PHONY: check-deps
check-deps:
./check-deps
.PHONY: check
check:
shellcheck -x make-* check-*
.PHONY: clean
clean:
rm -rf _site
rm -f favicon.ico
.PHONY: deploy
deploy:
rsync -avh --delete ./_site/ web:/var/www/ysap.sh/