-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathMakefile
47 lines (39 loc) · 1.32 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
.DEFAULT_GOAL := help
ifdef VERBOSE
VERBOSE_FLAG:=--verbose
endif
LINKCHECKER := linkchecker --no-warnings --ignore-url=^mailto: -f ./.linkchecker.rc $(VERBOSE_FLAG)
SERVER_PORT?=4567
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: dependencies
dependencies: ## Install dependencies
pip install -r requirements.txt
bundle install
.PHONY: build
build: ## Builds the project
@echo "Run middleman..."
bundle exec middleman build $(VERBOSE_FLAG)
@echo "Copy additional files..."
cp googlec7239f490e1990a5.html build
cp security.txt.html build
cp security.txt.html build/.well-known
.PHONY: test
test: test-filesystem test-local-http ## Runs the tests
.PHONY: test-filesystem
test-filesystem: build ## checks links against the build dir directly
$(LINKCHECKER) ./build/
.PHONY: test-local-http
test-local-http: build ## checks links against the build dir over HTTP
ruby \
-run \
-ehttpd \
./build/ \
-p$(SERVER_PORT) \
>/dev/null 2>&1 & SERVER_PID=$$! ; \
while ! curl -s -o /dev/null "localhost:$(SERVER_PORT)"; do echo "waiting for web server to start"; sleep 3; done; \
$(LINKCHECKER) http://localhost:$(SERVER_PORT) ; \
LINKCHECKER_STATUS=$$? ; \
kill $${SERVER_PID} ; \
exit $${LINKCHECKER_STATUS}