forked from chaijs/chaijs.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
117 lines (92 loc) · 2.27 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
#
# Generate the docs and start the doc server
#
all: generated_data docs-server
#
# Generate the docs
#
generated_data: plugins releases api-docs chaijs
#
# Generate the api docs
#
api-docs: clean-api-docs
@mkdir -p _data
@npm install chai@4
@node ./node_modules/dox/bin/dox --raw < ./node_modules/chai/chai.js > _data/chai.json
#
# Generate the api docs
#
chaijs: ./node_modules/chai/chai.js
@@cp ./node_modules/chai/chai.js ./chai.js
#
# Generate the releases
#
releases: clean-releases
@mkdir -p _data
@curl -s $(shell [ -n "${GH_TOKEN}" ] && echo "-H \"Authorization: token ${GH_TOKEN}\"") "https://api.github.com/repos/chaijs/chai/releases" > _data/releases.json
#
# Generate plugins
#
plugins: clean-plugins
@mkdir -p _data/plugins
@node ./node_modules/npm-plugin-fetcher/index.js -b _scripts/banned_plugins.js -o _data/plugins chai-plugin
@xargs -n1 -I! sh -c 'echo ! && curl -s "https://registry.npmjs.com/!" > _data/plugins/!.json' < _legacy_plugins
@node _scripts/build-plugin-tags.js
@node _scripts/build-plugin-pages.js
#
# Install all dependencies
#
install:
@npm install
@bundle install
#
# Clean
#
clean: clean-plugins clean-api-docs clean-releases
#
# Clean the plugins
#
clean-plugins:
@rm -rf _data/plugins/ _data/plugin_keywords.json
#
# Clean the api- docs
#
clean-api-docs:
@rm -rf _data/chai.json
#
# Clean the releases
#
clean-releases:
@rm -rf _data/releases.json
#
# Start the doc server locally
#
docs-server:
@bundle exec jekyll serve
#
# Pages data build process
#
should_build = true
ifneq ($(TRAVIS_BRANCH), master)
should_build = false
endif
ifneq ($(TRAVIS_PULL_REQUEST), false)
should_build = false
endif
ifeq ($(should_build), false)
pages:
@echo "Cowardly refusing to build pages"
else
pages: install clean generated_data
@if [ -z "$$(git status --porcelain)" ]; then\
echo "Nothing to commit. Build complete";\
else\
echo "Comitting to master";\
git config user.name "ChaiJs Bot";\
git config user.email "[email protected]";\
git add -f chai.js _data plugins/*.md;\
git commit -m '(data): Auto build _data';\
git push "https://${GH_TOKEN}@github.com/chaijs/chaijs.github.io" HEAD:refs/heads/master;\
fi
endif
.PHONY: all api-docs releases plugins install clean-plugins clean-api-docs docs-server nightly chaijs