forked from hashicorp/terraform-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
122 lines (113 loc) · 3.64 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
VERSION?="0.3.43"
MKFILE_PATH=$(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
DEPLOY_ENV?="development"
build:
@echo "==> Starting build in Docker..."
@mkdir -p content/build
@docker run \
--interactive \
--rm \
--tty \
--volume "$(shell pwd)/ext:/ext" \
--volume "$(shell pwd)/content:/website" \
--volume "$(shell pwd)/content/build:/website/build" \
-e "DEPLOY_ENV=${DEPLOY_ENV}" \
hashicorp/middleman-hashicorp:${VERSION} \
bundle exec middleman build --verbose --clean
website:
@echo "==> Starting website in Docker..."
@docker run \
--interactive \
--rm \
--tty \
--publish "4567:4567" \
--publish "35729:35729" \
-e "DEPLOY_ENV=${DEPLOY_ENV}" \
--volume "$(shell pwd)/ext:/ext" \
--volume "$(shell pwd)/content:/website" \
hashicorp/middleman-hashicorp:${VERSION}
website-test:
@echo "==> Testing website in Docker..."
-@docker stop "tf-website-temp"
@docker run \
--detach \
--rm \
--name "tf-website-temp" \
--publish "4567:4567" \
--volume "$(shell pwd)/ext:/ext" \
--volume "$(shell pwd)/content:/website" \
hashicorp/middleman-hashicorp:${VERSION}
until curl -sS http://localhost:4567/ > /dev/null; do sleep 1; done
$(MKFILE_PATH)/content/scripts/check-links.sh "http://127.0.0.1:4567" "/"
@docker stop "tf-website-temp"
website-provider:
ifeq ($(PROVIDER_PATH),)
@echo 'Please set PROVIDER_PATH'
exit 1
endif
ifeq ($(PROVIDER_NAME),)
@echo 'Please set PROVIDER_NAME'
exit 1
endif
ifeq ($(PROVIDER_SLUG),)
$(eval PROVIDER_SLUG := $(PROVIDER_NAME))
endif
@echo "==> Starting $(PROVIDER_SLUG) provider website in Docker..."
@docker run \
--interactive \
--rm \
--tty \
--publish "4567:4567" \
--publish "35729:35729" \
--volume "$(PROVIDER_PATH)/website:/website" \
--volume "$(PROVIDER_PATH)/website:/ext/providers/$(PROVIDER_NAME)/website" \
--volume "$(shell pwd)/content:/terraform-website" \
--volume "$(shell pwd)/content/source/assets:/website/docs/assets" \
--volume "$(shell pwd)/content/source/layouts:/website/docs/layouts" \
--workdir /terraform-website \
-e PROVIDER_SLUG=$(PROVIDER_SLUG) \
hashicorp/middleman-hashicorp:${VERSION}
website-provider-test:
ifeq ($(PROVIDER_PATH),)
@echo 'Please set PROVIDER_PATH'
exit 1
endif
ifeq ($(PROVIDER_NAME),)
@echo 'Please set PROVIDER_NAME'
exit 1
endif
ifeq ($(PROVIDER_SLUG),)
$(eval PROVIDER_SLUG := $(PROVIDER_NAME))
endif
@echo "==> Testing $(PROVIDER_NAME) provider website in Docker..."
-@docker stop "tf-website-$(PROVIDER_NAME)-temp"
@docker run \
--detach \
--rm \
--name "tf-website-$(PROVIDER_NAME)-temp" \
--publish "4567:4567" \
--volume "$(PROVIDER_PATH)/website:/website" \
--volume "$(PROVIDER_PATH)/website:/ext/providers/$(PROVIDER_NAME)/website" \
--volume "$(shell pwd)/content:/terraform-website" \
--volume "$(shell pwd)/content/source/assets:/website/docs/assets" \
--volume "$(shell pwd)/content/source/layouts:/website/docs/layouts" \
--workdir /terraform-website \
hashicorp/middleman-hashicorp:${VERSION}
until curl -sS http://localhost:4567/ > /dev/null; do sleep 1; done
$(MKFILE_PATH)/content/scripts/check-links.sh "http://127.0.0.1:4567/docs/providers/$(PROVIDER_SLUG)/"
@docker stop "tf-website-$(PROVIDER_NAME)-temp"
sync:
@echo "==> Syncing submodules for upstream changes"
@git submodule update --init --remote
deinit:
@echo "==> Deinitializing submodules"
@git submodule deinit --all -f
spellcheck:
@echo "==> Spell checking website and running fixes..."
@find content/ -type f | xargs docker run \
-v $(CURDIR):/scripts \
--workdir=/scripts \
nickg/misspell:latest \
misspell -w -source=text
@echo "==> Spell check complete"
.PHONY: build website sync