forked from segmentio/segment-docs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·273 lines (239 loc) · 5.89 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
BIN := ./node_modules/.bin
# Core...
JEKYLL_ENV = 'development'
ifeq ('${BUILDKITE_BRANCH}','master')
JEKYLL_ENV := 'production'
endif
ifeq ('${BUILDKITE_BRANCH}','staging')
JEKYLL_ENV := 'staging'
endif
# Laura's convenience command because Reasons
docs: dev
.PHONY: dev
dev: node_modules vendor/bundle
@$(BIN)/concurrently --raw --kill-others -n webpack,jekyll \
"$(BIN)/webpack --mode=development --watch" \
"bundle exec jekyll clean && bundle exec jekyll serve --force_polling --trace --incremental -H 0.0.0.0 -V"
.PHONY: intialize-work-dir
intialize-work-dir:
@mkdir -p _site
@chmod -R 777 _site/
@mkdir vendor
@chmod -R 777 vendor/
@bundle install --path=vendor
.PHONY: build
build: node_modules vendor/bundle
@$(BIN)/concurrently --raw --kill-others -n webpack,jekyll \
"$(BIN)/webpack --mode=development --watch" \
"bundle exec jekyll clean && bundle exec jekyll build -V"
# .PHONY: build
# build: node_modules vendor/bundle
# @echo "Jekyll env: ${JEKYLL_ENV}"
# @chown -R jekyll /workdir
# @chmod -R 777 /workdir
# @echo "env: ${JEKYLL_ENV}"
# @$(BIN)/webpack --mode=production
# @JEKYLL_ENV=${JEKYLL_ENV} bundle exec jekyll build --trace
# @if [ '${BUILDKITE_BRANCH}' == 'staging' ]; then echo "updating sitemap.xml..." && sed -i -r 's/segment.com/segment.build/g' ./_site/sitemap.xml; fi;
.PHONY: upload-docs
upload-docs:
@scripts/upload-docs
.PHONY: package
package: build
@docker build . -t segment-docs:latest
.PHONY: serve
serve: package
@docker run -p 4000:80 segment-docs:latest
catalog:
@node scripts/catalog/index.js
# make the list of beta connections
.PHONY: beta
beta:
@node scripts/beta.js
.PHONY: changelog
changelog: vendor/bundle
@node scripts/changelog.js
.PHONY: sidenav
sidenav: vendor/bundle
@node scripts/nav.js
# check internal links
.PHONY: linkcheck-internal
linkcheck-internal:
@node scripts/checklinks-internal.js
# check external links
.PHONY: linkcheck-external
linkcheck-external:
@node scripts/checklinks-external.js
.PHONY: zip-artifacts
zip-artifacts:
@tar czf build_package.tar.gz _site
.PHONY: unzip-artifacts
unzip-artifacts:
@tar -xzf build_package.tar.gz _site
.PHONY: typewriter
typewriter: npx typewriter
.PHONY: deps
deps: node_modules vendor/bundle
.PHONY: env
env:
@sh scripts/env.sh
.PHONY: clean
clean:
@rm -Rf _site
@rm -Rf .sass-cache
@rm -Rf .jekyll-cache
@rm -Rf src/.jekyll-metadata
@rm -f assets/docs.bundle.js
.PHONY: clean-deps
clean-deps:
@rm -Rf vendor
@rm -Rf node_modules
.PHONY: seed
seed:
@cp templates/destinations.example.yml src/_data/catalog/destinations.yml
@cp templates/sources.example.yml src/_data/catalog/sources.yml
.PHONY: node_modules
node_modules: package.json yarn.lock
yarn --immutable
.PHONY: vendor/bundle
vendor/bundle:
@export BUNDLE_PATH="vendor/bundle"
@mkdir -p vendor && mkdir -p vendor/bundle
@chmod -R 777 vendor/ Gemfile.lock
@bundle config set --local path 'vendor/bundle'
@bundle install
.PHONY: update
update:
@node scripts/update.js
.PHONY: add-id
add-id:
@node scripts/add_id.js
.PHONY: lint
lint: node_modules
@echo "Checking yml files..."
@npx yamllint src/_data/**/*.yml
# @echo "Checking markdown files..."
# @npx remark ./src --use preset-lint-markdown-style-guide
.PHONY: test
test: lint
.PHONY: check-spelling
check-spelling:
@echo 'Check spelling in markdown files..."
@npx mdspell 'src/**/*.md' -r --en-us -h
.PHONY: docker-dev
docker-dev:
$(DOCKER_TTY) make dev
.PHONY: docker-build
docker-build:
@$(DOCKER_TTY) make build
bundle install --path=vevendor
.PHONY: private-destination
private_destination:
@node scripts/catalog/addPrivateDestination.js
#.PHONY: docs
#docs: node_modules
# $(BIN)/webpack --mode=production
# make seed && \
# make build && \
# docker build . -t segment-docs:latest && \
# echo "Running segment docs at http://localhost:4000/docs/" && \
# docker run -p 4000:80 segment-docs:latest
#
#.PHONY: build
#build: node_modules
# echo "Building site for ${JEKYLL_ENV}"
# docker run -it \
# --volume="$(PWD):/srv/jekyll" \
# jekyll/jekyll \
# bundle package && \
# make deps && \
# make catalog && \
# JEKYLL_ENV=${JEKYLL_ENV} bundle exec jekyll build
#
## Helper commands...
#
#.PHONY: nav
#nav:
# bundle exec rake nav:update
#
#.PHONY: catalog
#catalog:
# bundle exec rake catalog:update
#
# old env command
#.PHONY: env
#env:
# gem install bundler
# cp -i .env.example .env | true
# echo "Environment configured"
#
#.PHONY: clean
#clean:
# bundle exec jekyll clean
#
#.PHONY: deps
#deps:
# bundle install
#
#.PHONY: dev
#dev: node_modules
# make clean && \
# $(BIN)/concurrently --raw --kill-others -n webpack,jekyll \
# "$(BIN)/webpack --mode=development --watch" \
# "bundle exec jekyll serve --trace --incremental -H 0.0.0.0 -V"
#
#
#.PHONE: trace
#trace:
# bundle exec jekyll build --trace
#
## Docker-based commands...
#
#.PHONY: docker-serve
#docker-serve: node_modules
# $(BIN)/webpack --mode=development
# docker run --rm \
# -e "JEKYLL_ENV=development" \
# -p 127.0.0.1:4000:4000/tcp \
# --volume="$(PWD):/srv/jekyll" \
# -it jekyll/jekyll \
# jekyll serve --trace --incremental -H 0.0.0.0 -V
#
#.PHONY: docker-clean
#docker-clean:
# docker run -it \
# --volume="$(PWD):/srv/jekyll" \
# jekyll/jekyll \
# jekyll clean
#
#.PHONY: docker-deps
#docker-deps:
# docker run -it \
# --volume="$(PWD):/srv/jekyll" \
# jekyll/jekyll \
# bundle install
#
#.PHONY: docker-dev
#docker-dev: node_modules
# docker run -it \
# -p 4000:4000 \
# --volume="$(PWD):/srv/jekyll" \
# jekyll/jekyll \
# $(BIN)/concurrently --raw --kill-others -n webpack,jekyll \
# "$(BIN)/webpack --mode=development --watch" \
# "jekyll serve --incremental -H 0.0.0.0"
#
#.PHONY: docker-nav
#docker-nav:
# docker run -it \
# --volume="$(PWD):/srv/jekyll" \
# jekyll/jekyll \
# bundle exec rake nav:update
#
#.PHONY: docker-catalog
#docker-catalog:
# docker run -it \
# --volume="$(PWD):/srv/jekyll" \
# jekyll/jekyll \
# bundle install && \
# bundle exec rake catalog:update