-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild-docs.sh
executable file
·87 lines (70 loc) · 1.83 KB
/
build-docs.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# import general info (e.g. input docs directory)
source common.config
# index file used to build docs
indexfile=
# output directory
OUTPUT=
# print help
if [ "$1" = "--help" ] ; then
echo "
SYNOPSIS
build-docs.sh {e, external | i, internal | a, all} [OPTION]
DESCRIPTION
This script allows you (and Travis) to build all internal and/or external documentation of the Monolith project. This script makes use of 'build-latex.sh' script and of 'common.config' file.
OPTION
-c \"path/to/other/index/file\" : Specify a custom index file.
EXAMPLES
build-internal-docs.sh i -> PDF: ./_travis-build/Interni/NormeDiProgetto.pdf, ./_travis-build/Interni/Verbale***.pdf
build-internal-docs.sh i -c \"only-verbale.config\" -> PDF: ./_travis-build/Interni/Verbale***.pdf"
exit 0
fi
function setupInternal {
indexfile="internal-docs.config"
OUTPUT=Interni
}
function setupExternal {
indexfile="external-docs.config"
OUTPUT=Esterni
}
function setupNonDefaultIndex {
# read from non-default index file
if [ "$2" = "-c" ] ; then
indexfile=$3
fi
}
function error {
echo "Invalid arguments. Please check how to use this script running it with '--help'"
}
function setupOutput {
outputFolder=$PDFROOT/$OUTPUT
if [ ! -d "$outputFolder" ]; then
mkdir -p "$outputFolder"
fi
}
function buildInternal {
setupInternal
setupNonDefaultIndex
setupOutput
# build LaTeX specified in file
buildFiles $indexfile $outputFolder
}
function buildExternal {
setupExternal
setupNonDefaultIndex
setupOutput
# build LaTeX specified in file
buildFiles $indexfile $outputFolder
}
# external or internal or both
if [ "$1" = "i" -o "$1" = "internal" ] ; then
buildInternal
elif [ "$1" = "e" -o "$1" = "external" ] ; then
buildExternal
elif [ "$1" = "a" -o "$1" = "all" ] ; then
buildInternal
buildExternal
else
error
exit 1
fi