-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_api_docs.sh
executable file
·77 lines (66 loc) · 1.41 KB
/
generate_api_docs.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
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
#!/usr/bin/env bash
API_DOCS_LANGUAGE=$1
case ${API_DOCS_LANGUAGE} in
java)
./go javadocs || exit
;;
py)
tox -c py/tox.ini -e docs || exit
;;
rb)
cd rb || exit
bundle install || exit
cd ..
bazel run //rb:docs || exit
git checkout rb/Gemfile.lock || true
;;
*)
echo "Selenium API docs generation"
echo "ERROR: unknown parameter \"$API_DOCS_LANGUAGE\""
echo "Usage:"
echo ""
echo "./generate_api_docs.sh java|rb|py"
echo -e "\t Example:"
echo -e "\t Genrating API docs for the Ruby bindings"
echo -e "\t ./generate_api_docs.sh rb"
exit 1
;;
esac
# switch to gh-pages and copy the files
git checkout gh-pages || exit
# make sure that our local version is up to date.
git pull || exit
case ${API_DOCS_LANGUAGE} in
java)
rm -rf docs/api/java
mv build/javadoc docs/api/java
;;
py)
rm -rf docs/api/py
mv build/docs/api/py docs/api/py
;;
rb)
rm -rf docs/api/rb
mv bazel-bin/rb/docs.runfiles/selenium/docs/api/rb docs/api/rb
;;
*)
echo "ERROR: unknown parameter \"$API_DOCS_LANGUAGE\""
exit 1
;;
esac
git add -A docs/api
read -p "Do you want to commit the changes? (Y/n):" changes </dev/tty
if [ -z $changes ]; then
changes=Y
fi
case "$changes" in
Y | y) echo "" ;;
N | n) exit ;;
*) exit ;;
esac
echo "Committing changes"
git commit -am "updating API docs"
echo "pushing to origin gh-pages"
git push origin gh-pages
echo "switching back to trunk branch"
git checkout trunk