Split API documentation generation into a separate make target that can be run independently of building the SDK.
33 lines
1005 B
Bash
Executable File
33 lines
1005 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
set -o pipefail
|
|
set -u
|
|
|
|
if [ -z `which jazzy` ]; then
|
|
step "Installing jazzy…"
|
|
gem install jazzy
|
|
if [ -z `which jazzy` ]; then
|
|
echo "Unable to install jazzy. See https://github.com/mapbox/mapbox-gl-native/blob/master/platform/ios/INSTALL.md"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
OUTPUT=${OUTPUT:-documentation}
|
|
README=${README:-README.md}
|
|
|
|
BRANCH=$( git describe --tags --match=ios-v*.*.* --abbrev=0 )
|
|
SHORT_VERSION=$( echo ${BRANCH} | sed 's/^ios-v//' )
|
|
RELEASE_VERSION=$( echo ${SHORT_VERSION} | sed -e 's/^ios-v//' -e 's/-.*//' )
|
|
|
|
jazzy \
|
|
--sdk iphonesimulator \
|
|
--github-file-prefix https://github.com/mapbox/mapbox-gl-native/tree/${BRANCH} \
|
|
--module-version ${SHORT_VERSION} \
|
|
--readme ${README} \
|
|
--root-url https://www.mapbox.com/ios-sdk/api/${RELEASE_VERSION}/ \
|
|
--output ${OUTPUT}
|
|
# https://github.com/realm/jazzy/issues/411
|
|
find ${OUTPUT} -name *.html -exec \
|
|
perl -pi -e 's/Mapbox\s+(Docs|Reference)/Mapbox iOS SDK $1/' {} \;
|