summaryrefslogtreecommitdiffstats
path: root/gendocs.sh
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-06-20 09:47:53 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-06-20 09:48:38 +0200
commit345940889ad4bbd6dd4d4f1a441c283c96ab2364 (patch)
tree89fc3d77da63fcad6510ebad95eb36d54aac9d38 /gendocs.sh
parent6f71c875ef2a7259290f98fd7712a1b2042dd7f7 (diff)
Auto generate cover from book.json fields.
Change-Id: I8203040b759289b08d5311a74e6df557fe8250bd Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'gendocs.sh')
-rwxr-xr-xgendocs.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/gendocs.sh b/gendocs.sh
index d96802c..4657607 100755
--- a/gendocs.sh
+++ b/gendocs.sh
@@ -1,9 +1,13 @@
#!/bin/bash
-OUTFILENAME="Application-Framework-Service"
+OUTFILENAME="Application-Framework-Service-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]
@@ -59,6 +63,10 @@ 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
+
+ # 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"