-
Notifications
You must be signed in to change notification settings - Fork 0
/
dmake
executable file
·58 lines (49 loc) · 1.17 KB
/
dmake
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
#!/bin/bash
TEXFILE=thesis
PUBLISH=false
log ()
{
CLR="\033[0m"
if [ "$2" = success ]; then
CLR="\033[32m"
fi
if [ "$2" = compile ]; then
CLR="\033[33m"
fi
echo -e "\033[0m\033[1mThesis: $CLR$1\033[0m"
}
for arg in $@
do
if test $arg = '--release'; then
TEXFILE=release
fi
if test $arg = '--debug'; then
TEXFILE=debug
fi
if test $arg = '--publish'; then
PUBLISH=true
fi
if test $arg = 'open'; then
open thesis.pdf
exit
fi
done
[ -d build ] || mkdir ./build
[ -d build/thesis ] || mkdir ./build/thesis
[ -d build/release ] || mkdir ./build/release
[ -d build/debug ] || mkdir ./build/debug
rm ./thesis.pdf
log "Compiling $TEXFILE.tex" compile
echo -e "\033[33m"
latexmk -xelatex -shell-escape -jobname=./build/${TEXFILE}/${TEXFILE} ./$TEXFILE.tex
log "$TEXFILE.tex was compiled successfully" success
log "Copying generated document to root directory" success
cp build/${TEXFILE}/${TEXFILE}.pdf ./thesis.pdf
#
# Publish the file to iCloud
if test $PUBLISH = 'true'; then
log "Publishing $TEXFILE.pdf to iCloud" compile
cp ./thesis.pdf ~/Library/Mobile\ Documents/com~apple~CloudDocs/Thesis/${TEXFILE}.pdf
log "Published successfully" success
fi
#open thesis.pdf