3 OUTFILENAME="Application-Framework-Service-Guide"
5 SCRIPT=$(basename $BASH_SOURCE)
7 VERSION=$(grep '"version":' $(dirname $BASH_SOURCE)/book.json | cut -d'"' -f 4)
8 [ "$VERSION" != "" ] && OUTFILENAME="${OUTFILENAME}_${VERSION}"
13 Usage: $SCRIPT [options] [pdf|serve|doxygen]
17 enable debug when generating pdf or html documentation
40 [[ $? != 0 ]] && usage
41 while [ $# -gt 0 ]; do
43 --debug) DEBUG_FLAG="--log=debug --debug";;
46 pdf | serve | doxygen) DO_ACTION=$1;;
55 # Create out dir if needed
56 [ -d $OUT_DIR ] || mkdir -p $OUT_DIR
58 if [ "$DO_ACTION" = "pdf" -o "$DO_ACTION" = "serve" ]; then
59 GITBOOK=`which gitbook`
60 [ "$?" = "1" ] && { echo "You must install gitbook first, using: sudo npm install -g gitbook-cli"; exit 1; }
62 EBCONV=`which ebook-convert`
63 [ "$?" = "1" ] && { echo "You must install calibre first, using: 'sudo apt install calibre' or refer to https://calibre-ebook.com/download"; exit 1; }
65 if [ "$DO_ACTION" = "pdf" ]; then
67 # Update cover when book.json has been changed
68 [[ $ROOTDIR/book.json -nt $ROOTDIR/docs/cover.jpg ]] && { echo "Update cover files"; $ROOTDIR/docs/resources/make_cover.sh || exit 1; }
70 OUTFILE=$OUT_DIR/$OUTFILENAME.pdf
71 $DRY $GITBOOK pdf $ROOTDIR $OUTFILE $DEBUG_FLAG
72 [ "$?" = "0" ] && echo "PDF has been successfully generated in $OUTFILE"
74 $DRY $GITBOOK serve $DEBUG_FLAG
77 elif [ "$DO_ACTION" = "doxygen" ]; then
78 $DRY cd $OUT_DIR && cmake .. && make doxygen $ROOTDIR/Doxyfile
81 echo "Unknown action !"