-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
152 lines (128 loc) · 6.11 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
# Source doc tarballs
TANGRAM = https://github.com/tangrams/tangram-docs/archive/gh-pages.tar.gz
EXTRACTS = https://github.com/mapzen/metro-extracts/archive/master.tar.gz
VALHALLA = https://github.com/valhalla/valhalla-docs/archive/master.tar.gz
VECTOR_TILES = https://api.github.com/repos/tilezen/vector-datasource/releases/latest
TERRAIN_TILES = https://api.github.com/repos/tilezen/joerd/releases/latest
SEARCH = https://github.com/pelias/pelias-doc/archive/master.tar.gz
ANDROID = https://github.com/mapzen/android/archive/master.tar.gz
IOS = https://github.com/mapzen/ios/archive/master.tar.gz
MAPZENJS = https://mapzen.com/js/docs.tar.gz
LIBPOSTAL = https://github.com/whosonfirst/go-whosonfirst-libpostal/archive/master.tar.gz
CARTOGRAPHY = https://github.com/tangrams/cartography-docs/archive/master.tar.gz
PLACES = https://github.com/whosonfirst/whosonfirst-www-api/archive/mapzen.tar.gz
SHELL := /bin/bash # required for OSX
PYTHONPATH := packages:$(PYTHONPATH)
all: dist
clean:
rm -rf dist theme/fragments
rm -rf src-android src-ios src-elevation src-mapzen-js src-metro-extracts \
src-mobility src-search src-tangram src-terrain-tiles \
src-vector-tiles src-libpostal src-cartography
rm -rf dist-android dist-ios dist-elevation dist-index dist-mapzen-js \
dist-metro-extracts dist-mobility dist-search dist-tangram \
dist-terrain-tiles dist-vector-tiles dist-libpostal dist-cartography
rm -rf dist-android-mkdocs.yml dist-ios-mkdocs.yml dist-elevation-mkdocs.yml \
dist-index-mkdocs.yml dist-mapzen-js-mkdocs.yml \
dist-metro-extracts-mkdocs.yml dist-mobility-mkdocs.yml \
dist-search-mkdocs.yml dist-tangram-mkdocs.yml \
dist-terrain-tiles-mkdocs.yml dist-vector-tiles-mkdocs.yml \
dist-libpostal-mkdocs.yml dist-cartography-mkdocs.yml \
dist-places-mkdocs.yml
# Get individual sources docs
src-tangram:
mkdir src-tangram
curl -sL $(TANGRAM) | tar -zxv -C src-tangram --strip-components=2 tangram-docs-gh-pages/pages
src-metro-extracts:
mkdir src-metro-extracts
curl -sL $(EXTRACTS) | tar -zxv -C src-metro-extracts --strip-components=2 metro-extracts-master/docs
src-vector-tiles:
mkdir src-vector-tiles
# Try with --wildcards for GNU tar, but fall back to BSD tar syntax for Mac.
curl -sL $(VECTOR_TILES) \
| ./extract-tarball-url.py \
| xargs curl -sL | ( \
tar -zxv -C src-vector-tiles --strip-components=2 --exclude=README.md --wildcards '*/docs/' \
|| tar -zxv -C src-vector-tiles --strip-components=2 --exclude=README.md '*/docs/' \
)
src-terrain-tiles:
mkdir src-terrain-tiles
# Try with --wildcards for GNU tar, but fall back to BSD tar syntax for Mac.
curl -sL $(TERRAIN_TILES) \
| ./extract-tarball-url.py \
| xargs curl -sL | ( \
tar -zxv -C src-terrain-tiles --strip-components=2 --exclude=README.md --wildcards '*/docs/' \
|| tar -zxv -C src-terrain-tiles --strip-components=2 --exclude=README.md '*/docs/' \
)
src-elevation:
mkdir src-elevation
curl -sL $(VALHALLA) | tar -zxv -C src-elevation --strip-components=2 valhalla-docs-master/elevation
src-mobility:
mkdir src-mobility
curl -sL $(VALHALLA) | tar -zxv -C src-mobility --strip-components=1 valhalla-docs-master
src-search:
mkdir src-search
curl -sL $(SEARCH) | tar -zxv -C src-search --strip-components=1 pelias-doc-master
src-android:
mkdir src-android
curl -sL $(ANDROID) | tar -zxv -C src-android --strip-components=2 android-master/docs
src-ios:
mkdir src-ios
curl -sL $(IOS) | tar -zxv -C src-ios --strip-components=2 ios-master/docs
src-mapzen-js:
mkdir src-mapzen-js
curl -sL $(MAPZENJS) | tar -zxv -C src-mapzen-js --strip-components=1 docs
src-libpostal:
mkdir src-libpostal
curl -sL $(LIBPOSTAL) | tar -zxv -C src-libpostal --strip-components=2 go-whosonfirst-libpostal-master/docs
src-places:
mkdir src-places
curl -sL $(PLACES) | tar -zxv -C src-places --strip-components=2 whosonfirst-www-api-mapzen/docs
src-cartography:
mkdir src-cartography
curl -sL $(CARTOGRAPHY) | tar -zxv -C src-cartography --strip-components=1 cartography-docs-master
src-overview:
cp -r docs/overview src-overview
src-guides:
cp -r docs/guides src-guides
# Retrieve style guide
theme/fragments:
mkdir -p theme/fragments
curl -sL 'https://mapzen.com/site-fragments/navbar.html' -o theme/fragments/global-nav.html
curl -sL 'https://mapzen.com/site-fragments/footer.html' -o theme/fragments/global-footer.html
# Build Tangram, Metro Extracts, Vector Tiles, Elevation, Search, Mobility,
# Android, iOS, Mapzen JS, Terrain Tiles, Who's On First and Overview docs.
# Uses GNU Make pattern rules:
# https://www.gnu.org/software/make/manual/html_node/Pattern-Examples.html
dist-%: src-% theme/fragments
anyconfig_cli ./config/default.yml ./config/$*.yml --merge=merge_dicts --output=./dist-$*-mkdocs.yml
./setup-renames.py ./dist-$*-mkdocs.yml
mkdocs build --config-file ./dist-$*-mkdocs.yml --clean
./setup-redirects.py ./dist-$*-mkdocs.yml /documentation/$*/
# Build index page
dist-index: theme/fragments
anyconfig_cli ./config/default.yml ./config/index.yml --merge=merge_dicts --output=./dist-index-mkdocs.yml
mkdocs build --config-file ./dist-index-mkdocs.yml --clean
./setup-redirects.py ./dist-index-mkdocs.yml /documentation/
cp dist-index/index.html dist-index/next.html
dist: dist-tangram dist-metro-extracts dist-vector-tiles dist-search dist-elevation dist-android dist-ios dist-mapzen-js dist-overview dist-guides dist-index dist-mobility dist-terrain-tiles dist-libpostal dist-places dist-cartography
mkdir dist
ln -s ../dist-tangram dist/tangram
ln -s ../dist-metro-extracts dist/metro-extracts
ln -s ../dist-vector-tiles dist/vector-tiles
ln -s ../dist-terrain-tiles dist/terrain-tiles
ln -s ../dist-search dist/search
ln -s ../dist-elevation dist/elevation
ln -s ../dist-mobility dist/mobility
ln -s ../dist-android dist/android
ln -s ../dist-ios dist/ios
ln -s ../dist-mapzen-js dist/mapzen-js
ln -s ../dist-overview dist/overview
ln -s ../dist-guides dist/guides
ln -s ../dist-libpostal dist/libpostal
ln -s ../dist-cartography dist/cartography
ln -s ../dist-places dist/places
rsync -urv --ignore-existing dist-index/ dist/
serve:
@mkdocs serve
.PHONY: all clean serve