-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (64 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
YARN := $(shell command -v yarn 2> /dev/null)
ASCIIDOCTOR := $(shell command -v asciidoctor 2> /dev/null)
# The default target.
all: setup book
# Declare our phony targets.
.PHONY: book clean test spell proof css js tidy debug _debug setup \
setup_yarn setup_gitbook setup_asciidoctor setup_javascript
# Install everything needed to start authoring in GitBook
setup: setup_yarn setup_gitbook setup_asciidoctor
# Yarn setup
setup_yarn:
@echo "Checking for yarn..."
ifndef YARN
$(error "yarn is required for managing node dependencies.")
endif
yarn
# GitBook setup
setup_gitbook:
./node_modules/.bin/gitbook install
# Asciidoctor setup
setup_asciidoctor:
@echo "Checking for asciidoctor..."
ifndef ASCIIDOCTOR
echo "Asciidoctor is required to build this documentation. Installing..."
bundle install
endif
# Build the main artifacts.
book: clean _book tidy
_book:
./node_modules/.bin/gitbook build
# Remove all built artifacts.
clean:
rm -rf _book
# Remove artifacts that shouldn't be published.
tidy:
rm -rf _book/CNAME _book/Gemfile _book/Gemfile.lock _book/Makefile _book/_common _book/_dicts _book/deploy.py _book/npm-debug.log _book/package.json _book/package-lock.json _book/rewrites.csv _book/yarn.lock
# 'test' the artifacts
test: spell proof missed
# Spell check the source files.
spell:
@command -v hunspell >/dev/null 2>&1 || { echo >&2 "hunspell required for spell testing."; exit 1; }
@_tools/spellcheck.pl -d . -D _dicts
# Run htmlproofer on the artifacts to catch bad images, links, etc.
proof: all
@command -v htmlproofer >/dev/null 2>&1 || { echo >&2 "htmlproofer required for link testing."; exit 1; }
htmlproofer --url-ignore="#" --disable-external _book
# Run htmlproofer, with external checks
proofx: all
@command -v htmlproofer >/dev/null 2>&1 || { echo >&2 "htmlproofer required for link testing."; exit 1; }
htmlproofer --url-ignore="#" _book
# Check for unconverted topics in output folder; means they're missing
# from the TOC.
missed: _book
@echo "Checking for topics missing from the TOC..."
@find _book -name '*.adoc' | grep . && exit 1 || exit 0;
css:
cp _css/* _book/_css/
js:
rm -rf _book/_js
cp -a _js _book/
# Build the main artifacts with debugging output enabled.
debug: clean _debug tidy
_debug:
./node_modules/.bin/gitbook build --log=debug --debug