forked from etcd-io/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (31 loc) · 1.1 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
DOCKER_IMG = klakegg/hugo:ext-alpine
DRAFT_ARGS = --buildDrafts --buildFuture --buildExpired
HTMLTEST?=htmltest # Specify as make arg if different
HTMLTEST_ARGS?=--skip-external
HTMLTEST_DIR=tmp
# Use $(HTMLTEST) in PATH, if available; otherwise, we'll get a copy
ifeq (, $(shell which $(HTMLTEST)))
override HTMLTEST=$(HTMLTEST_DIR)/bin/htmltest
ifeq (, $(shell which $(HTMLTEST)))
GET_LINK_CHECKER_IF_NEEDED=get-link-checker
endif
endif
check-links: $(GET_LINK_CHECKER_IF_NEEDED)
$(HTMLTEST) $(HTMLTEST_ARGS)
docker-serve:
docker run --rm -it -v $(PWD):/src -p 1313:1313 $(DOCKER_IMG) server $(DRAFT_ARGS)
# Until htmltext >0.14.x is released, get and build our own from source:
get-link-checker:
rm -Rf $(HTMLTEST_DIR)
mkdir -p $(HTMLTEST_DIR)/bin && \
cd $(HTMLTEST_DIR) && \
git clone --depth=1 https://github.com/wjdp/htmltest.git && \
( \
cd htmltest && \
./build.sh && \
cp bin/htmltest ../bin \
)
# Once htmltext >0.14.x is released, replace the get-and-build code above with this:
# get-link-checker:
# rm -Rf $(HTMLTEST_DIR)/bin
# curl https://htmltest.wjdp.uk | bash -s -- -b $(HTMLTEST_DIR)/bin