-
Notifications
You must be signed in to change notification settings - Fork 90
/
build-documentation.sh
executable file
·36 lines (32 loc) · 1.11 KB
/
build-documentation.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
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
./mvnw --projects documentation -am clean compile
if [ $(uname -s) == "Linux" ]; then
URL="file://$DIR/documentation/target/generated-docs/core/manual/en_US/index.html"
echo "Goto: $URL"
if which xdg-open > /dev/null
then
xdg-open $URL
elif which gnome-open > /dev/null
then
gnome-open $URL
fi
elif [ $(uname) == "Darwin" ]; then
URL="file://$DIR/documentation/target/generated-docs/core/manual/en_US/index.html"
echo "Goto: $URL"
open $URL
else
if [[ "$DIR" =~ ^\/([a-zA-Z])\/(.*)$ ]];
then
DIR="/${BASH_REMATCH[1]}:/${BASH_REMATCH[2]}"
fi
URL="file://$DIR/documentation/target/generated-docs/core/manual/en_US/index.html"
echo "Goto: $URL"
start $URL
fi