3 OUTFILENAME="Gitbook-Iotbzh-template"
5 SCRIPT=$(basename $BASH_SOURCE)
9 Usage: $SCRIPT [options] [pdf|serve|doxygen]
13 enable debug when generating pdf or html documentation
36 [[ $? != 0 ]] && usage
37 while [ $# -gt 0 ]; do
39 --debug) DEBUG_FLAG="--log=debug --debug";;
42 pdf | serve | doxygen) DO_ACTION=$1;;
51 # Create out dir if needed
52 [ -d $OUT_DIR ] || mkdir -p $OUT_DIR
54 if [ "$DO_ACTION" = "pdf" -o "$DO_ACTION" = "serve" ]; then
55 GITBOOK=`which gitbook`
56 [ "$?" = "1" ] && { echo "You must install gitbook first, using: sudo npm install -g gitbook-cli"; exit 1; }
58 EBCONV=`which ebook-convert`
59 [ "$?" = "1" ] && { echo "You must install calibre first, using: 'sudo apt install calibre' or refer to https://calibre-ebook.com/download"; exit 1; }
61 if [ "$DO_ACTION" = "pdf" ]; then
63 # Update cover when book.json has been changed
64 [[ $ROOTDIR/book.json -nt $ROOTDIR/docs/cover.jpg ]] && { echo "Update cover files"; $ROOTDIR/docs/resources/make_cover.sh || exit 1; }
66 OUTFILE=$OUT_DIR/$OUTFILENAME.pdf
67 $DRY $GITBOOK pdf $ROOTDIR $OUTFILE $DEBUG_FLAG
68 [ "$?" = "0" ] && echo "PDF has been successfully generated in $OUTFILE"
70 $DRY $GITBOOK serve $DEBUG_FLAG
73 elif [ "$DO_ACTION" = "doxygen" ]; then
74 $DRY cd $OUT_DIR && cmake .. && make doxygen $ROOTDIR/Doxyfile
77 echo "Unknown action !"