diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-09-20 11:12:09 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-09-20 11:41:32 +0200 |
commit | 1dcedd671f892f07d7805c88352661007b88800d (patch) | |
tree | 416cc67fc276c1a6277a8171aba46a7553017182 /gendocs.sh | |
parent | b25e8b11aacd927adfb0278756fb800f879904c5 (diff) |
Docs - autogenerate cover
Change-Id: Ia0a8a6b19ce7b173189d73cdc5c0bbba77b2b71f
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'gendocs.sh')
-rwxr-xr-x | gendocs.sh | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1,7 +1,13 @@ #!/bin/bash +OUTFILENAME="LowLevelCanBinding_Guide" + SCRIPT=$(basename $BASH_SOURCE) +VERSION=$(grep '"version":' $(dirname $BASH_SOURCE)/book.json | cut -d'"' -f 4) +[ "$VERSION" != "" ] && OUTFILENAME="${OUTFILENAME}_${VERSION}" + + function usage() { cat <<EOF >&2 Usage: $SCRIPT [options] [pdf|serve|doxygen] @@ -57,7 +63,11 @@ if [ "$DO_ACTION" = "pdf" -o "$DO_ACTION" = "serve" ]; then [ "$?" = "1" ] && { echo "You must install calibre first, using: 'sudo apt install calibre' or refer to https://calibre-ebook.com/download"; exit 1; } if [ "$DO_ACTION" = "pdf" ]; then - OUTFILE=$OUT_DIR/LowLevelCanBinding_Guide.pdf + + # Update cover when book.json has been changed + [[ $ROOTDIR/book.json -nt $ROOTDIR/docs/cover.jpg ]] && { echo "Update cover files"; $ROOTDIR/docs/resources/make_cover.sh || exit 1; } + + OUTFILE=$OUT_DIR/$OUTFILENAME.pdf $DRY $GITBOOK pdf $ROOTDIR $OUTFILE $DEBUG_FLAG [ "$?" = "0" ] && echo "PDF has been successfully generated in $OUTFILE" else |