This repository has been archived by the owner on Nov 24, 2023. It is now read-only.
forked from validatedpatterns/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (48 loc) · 2.23 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
HOMEPAGE_CONTAINER ?= quay.io/hybridcloudpatterns/homepage-container:latest
# Do not use selinux labeling when we are using nfs
FSTYPE=$(shell df -Th . | grep -v Type | awk '{ print $$2 }')
ifeq ($(FSTYPE), nfs)
ATTRS = "rw"
else ifeq ($(FSTYPE), nfs4)
ATTRS = "rw"
else
ATTRS = "rw,z"
endif
##@ Docs tasks
.PHONY: help
# No need to add a comment here as help is described in common/
help:
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^(\s|[a-zA-Z_0-9-])+:.*?##/ { printf " \033[36m%-16s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: test
test: spellcheck htmltest ## Runs tests
@echo "Ran all tests"
.PHONY: build
build: ## Build the website locally in the public/ folder
podman run -it --net=host -v $(PWD):/site:$(ATTRS) --entrypoint hugo $(HOMEPAGE_CONTAINER)
.PHONY: serve
serve: ## Build the website locally from a container and serve it
@echo "Serving via container. Browse to http://localhost:4000"
podman run -it --net=host -v $(PWD):/site:$(ATTRS) --entrypoint hugo $(HOMEPAGE_CONTAINER) server -p 4000
.PHONY: htmltest
htmltest: build ## Runs htmltest against the site to find broken links
@echo "Running html proof to check links"
podman run -it --net=host -v $(PWD):/site:$(ATTRS) --entrypoint htmltest $(HOMEPAGE_CONTAINER)
.PHONY: run
run: ## Runs the container interactively
@echo "Running html proof to check links"
podman run -it --net=host -v $(PWD):/site:$(ATTRS) $(HOMEPAGE_CONTAINER)
.PHONY: update-container
update-container: ## Updates the container used for local testing
podman pull $(HOMEPAGE_CONTAINER)
.PHONY: spellcheck
spellcheck: ## Runs a spellchecker on the content/ folder
@echo "Running spellchecking on the tree"
podman run -it -v $(PWD):/tmp:$(ATTRS) docker.io/jonasbn/github-action-spellcheck:latest
.PHONY: lintwordlist
lintwordlist: ## Sorts and removes duplicates from spellcheck exception file .wordlist.txt
@cp --preserve=all .wordlist.txt /tmp/.wordlist.txt
@sort .wordlist.txt | tr '[:upper:]' '[:lower:]' | uniq > /tmp/.wordlist.txt
@mv -v /tmp/.wordlist.txt .wordlist.txt
.PHONY: clean
clean: ## Removes any unneeded spurious files
@rm -rvf ./.jekyll-cache ./_site ./tmp super-linter.log dictionary.dic