forked from Normation/rudder-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (51 loc) · 2.39 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
VERSIONS = 5.0 5.1
VERSION_DOCS = $(addprefix doc-, $(VERSIONS))
VERSION_ARCHIVES = $(addsuffix .archive, $(VERSIONS))
GENERIC_DOCS = site site-dev site-local
SITES = $(GENERIC_DOCS) $(VERSIONS)
.PHONY: prepare rudder-theme/build/ui-bundle.zip optipng doc-build build/sites/site/.htaccess build/history/5.0/.htaccess build/files $(SITES)
.DEFAULT_GOAL := local
all: $(GENERIC_DOCS) $(VERSION_ARCHIVES) build/sites/site/.htaccess build/history/5.0/.htaccess build/files test
online: site site-dev $(VERSION_ARCHIVES) build/sites/site/.htaccess build/history/5.0/.htaccess build/files test
local: site-local test
rudder-theme/build/ui-bundle.zip:
cd rudder-theme && yarn install
cd rudder-theme && gulp pack
# Ugly workaround until we can use custom generators in antora
doc-build:
[ -d $@ ] || git clone https://github.com/Normation/rudder-doc.git $@
cd $@ && git checkout branches/rudder/5.0 && git pull
cd $@/src/reference && make
cd $@ && git add -f src/reference && git commit --allow-empty -m "Build 5.0"
cd $@ && git clean -fd
cd $@ && git checkout master && git pull
cd $@/src/reference && make
cd $@ && git add -f src/reference && git commit --allow-empty -m "Build master"
# Prepare everything, even if not needed
prepare: doc-build
cd src/reference && make
$(SITES): prepare rudder-theme/build/ui-bundle.zip
antora --ui-bundle-url ./rudder-theme/build/ui-bundle.zip [email protected]
%.archive: %
mkdir -p build/archives
cd build/history && cp -r $< doc-$< && tar -cvzf doc-$<.tar.gz doc-$< && rm -r doc-$<
mv build/history/doc-$<.tar.gz build/archives/
# Generate apache conf for current redirection to latest release
build/sites/site/.htaccess:
# once 5.0 is relased, should be https://www.rudder-project.org/release-info/rudder/versions/latest
echo 'Redirect /reference/current/ /reference/5.0/' > $@
build/history/5.0/.htaccess:
# once 5.0 is relased, should be https://www.rudder-project.org/release-info/rudder/versions/latest
echo 'Redirect /reference/current/ /reference/5.0/' > $@
# Download documentation files
build/files:
mkdir -p build/files
curl -o build/files/rudder-cheatsheet-advanced.pdf "https://raw.githubusercontent.com/Normation/rudder-tools/master/documents/cheatsheet-advanced/rudder-cheatsheet-advanced.pdf"
test:
./tests/check_broken_links.sh
optipng:
find src -name "*.png" -exec optipng {} \;
clean:
cd src/reference && make clean
rm -rf build rudder-theme/build
rm -rf doc-build