-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
102 lines (89 loc) · 3 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
98
99
100
101
102
.PHONY: run
run:
hugo server --config=config.dev.yaml
.PHONY: docs
docs: hugo-tools
$(HUGO_TOOLS) docs-aggregator
find ./data -name "*.json" -exec sed -i 's/https:\/\/cdn.appscode.com\/images/\/assets\/images/g' {} \;
rm -rf static/files/cluster-api
rm -rf static/files/cluster-api-provider-aws
rm -rf static/files/cluster-api-provider-azure
rm -rf static/files/cluster-api-provider-gcp
rm -rf static/files/products/appscode/aws-marketplace
rm -rf static/files/products/appscode/azure-marketplace
rm -rf static/files/products/appscode/gcp-marketplace
.PHONY: docs-skip-assets
docs-skip-assets: hugo-tools
$(HUGO_TOOLS) docs-aggregator --skip-assets
find ./data -name "*.json" -exec sed -i 's/https:\/\/cdn.appscode.com\/images/\/assets\/images/g' {} \;
.PHONY: assets
assets: hugo-tools
$(HUGO_TOOLS) docs-aggregator --only-assets
find ./data -name "*.json" -exec sed -i 's/https:\/\/cdn.appscode.com\/images/\/assets\/images/g' {} \;
rm -rf static/files/cluster-api
rm -rf static/files/cluster-api-provider-aws
rm -rf static/files/cluster-api-provider-azure
rm -rf static/files/cluster-api-provider-gcp
rm -rf static/files/products/appscode/aws-marketplace
rm -rf static/files/products/appscode/azure-marketplace
rm -rf static/files/products/appscode/gcp-marketplace
.PHONY: gen
gen:
rm -rf public
hugo --config=config.dev.yaml
.PHONY: qa
qa: gen
firebase use default
firebase deploy
.PHONY: gen-prod
gen-prod:
rm -rf public
hugo --minify --config=config.yaml
.PHONY: release
release: gen-prod
firebase use prod
firebase deploy
firebase use default
.PHONY: check-links
check-links:
liche -r public -d http://localhost:1313 -c 10 -p -l -x '^http://localhost:9090$$'
VERSION ?=
# https://stackoverflow.com/a/38982011/244009
.PHONY: set-version
set-version:
@mv firebase.json firebase.bk.json
@jq '(.hosting[] | .redirects[] | .destination) |= sub("\/docs\/.*\/"; "/docs/$(VERSION)/"; "l")' firebase.bk.json > firebase.json
ASSETS_REPO_URL ?=
.PHONY: set-assets-repo
set-assets-repo:
@mv data/config.json data/config.bk.json
@jq '(.assets | .repoURL) |= "$(ASSETS_REPO_URL)"' data/config.bk.json > data/config.json
@rm -rf data/config.bk.json
HUGO_TOOLS = $(shell pwd)/bin/hugo-tools
.PHONY: hugo-tools
hugo-tools: ## Download hugo-tools locally if necessary.
$(call go-get-tool,$(HUGO_TOOLS),appscodelabs/hugo-tools)
# go-get-tool will 'curl' binary from GH repo $2 with version $3 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
@[ -f $(1) ] || { \
set -e ;\
OS=$$(echo `uname`|tr '[:upper:]' '[:lower:]'); \
ARCH=$$(uname -m); \
case $$ARCH in \
armv5*) ARCH="armv5";; \
armv6*) ARCH="armv6";; \
armv7*) ARCH="arm";; \
aarch64) ARCH="arm64";; \
x86) ARCH="386";; \
x86_64) ARCH="amd64";; \
i686) ARCH="386";; \
i386) ARCH="386";; \
esac; \
bin=hugo-tools-$${OS}-$${ARCH}; \
echo "Downloading $${bin}" ;\
mkdir -p $(PROJECT_DIR)/bin; \
curl -fsSL -o $(1) https://github.com/$(2)/releases/latest/download/$${bin}; \
chmod +x $(1); \
}
endef