-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathupdate_apidoc_refs.sh
executable file
·27 lines (24 loc) · 1.13 KB
/
update_apidoc_refs.sh
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
#! /bin/bash
# Small utility script used to update the links to the API documentation.
# The manual.rst file *must* be excluded, however, and updated manually.
#
# usage: update_apidoc_refs 2.0
#
# where the argument given, i.e., 2.0 in this example, is the current project version.
release=$1
if [ -z "${release}" ]; then
echo "No release version specified, e.g., 2.0!" 1>&2
exit 1
fi
[[ ${release} == 'latest' ]] || release=v${release}
if [[ `uname` == Darwin ]]; then
find doc -type f \( -name '*.rst' ! -name manual.rst \) -exec sed -i '' "s:/apidoc/v[0-9][0-9]*\.[0-9][0-9]*/:/apidoc/$release/:g;s:/apidoc/latest/:/apidoc/$release/:g" {} \;
for f in README.*; do
sed -i '' "s:/apidoc/v[0-9][0-9]*\.[0-9][0-9]*/:/apidoc/$release/:g;s:/apidoc/latest/:/apidoc/$release/:g" "${f}"
done
else
find doc -type f \( -name '*.rst' ! -name manual.rst \) -exec sed -i'' "s:/apidoc/v[0-9][0-9]*\.[0-9][0-9]*/:/apidoc/$release/:g;s:/apidoc/latest/:/apidoc/$release/:g" {} \;
for f in README.*; do
sed -i'' "s:/apidoc/v[0-9][0-9]*\.[0-9][0-9]*/:/apidoc/$release/:g;s:/apidoc/latest/:/apidoc/$release/:g" "${f}"
done
fi