forked from ElisChet/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
task.sh
executable file
·66 lines (55 loc) · 1.4 KB
/
task.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
#!/bin/bash
MODE="$1"
case "$1" in
help)
echo "------ General development ------"
echo "Assuming you have docker installed ./run.sh develop"
echo "will download the required docker containers and start"
echo "a server at http://localhost:8000"
echo
exit 0
;;
develop|check|deploy|clean|ghci|update)
;;
*)
echo $"Usage: $0 {develop|check|deploy|clean|ghci|help}"
exit 1
esac
BASEDIR=$PWD
NOTHING=$(cd haskell && stack exec which -- ghc)
if [ "$?" != "0" ]; then
stack setup
fi
STACKLOCAL=$(cd haskell && stack path --local-install-root)
function hakyll {
cd $BASEDIR/haskell && stack build && cd ../content && $STACKLOCAL/bin/website $1
}
case "$MODE" in
develop)
cd $BASEDIR/content/stylesheets && find . -name \*.scss | \
entr -r scss dragonfly.scss dragonfly.css &
hakyll watch
;;
clean)
hakyll clean
cd $BASEDIR/haskell && stack clean
;;
ghci)
cd $BASEDIR/haskell && stack ghci
;;
deploy|check)
cd $BASEDIR/content/stylesheets && scss --sourcemap=none -t compressed dragonfly.scss dragonfly.css &&
hakyll build
if [ $? != 0 ]; then
hakyll clean &&
cd $BASEDIR/content/stylesheets && scss --sourcemap=none -t compressed dragonfly.scss dragonfly.css &&
hakyll build
if [ $? != 0 ]; then
exit 1
fi
fi
if [ "$MODE" == "check" ]; then
hakyll check
fi
;;
esac