forked from openpracticelibrary/openpracticelibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·51 lines (44 loc) · 1.03 KB
/
build.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
# This file is to be used for adding build steps of the static content on Open Practice Library
#!/bin/bash
# set -o xtrace
# set -e
#util functions for build scripts
_printBuildStep(){
echo ""
echo ""
echo "##################################################"
echo ""
echo " START BUILD STEP: $@"
echo ""
echo "##################################################"
sh -c "${@}"
rc=$?
response=FAILURE
if [[ ${rc} == 0 ]];then
response=SUCCESS
fi
echo ""
echo "\n##################################################\n" &&\
echo " BUILD STEP ${response}: $@" &&\
echo "\n##################################################\n"
if [[ ${rc} != 0 ]];then
exit ${rc}
fi
}
clean(){
_printBuildStep "rm -rvf public"
}
test(){
_printBuildStep "echo test-command"
}
build(){
_printBuildStep "npm i"
_printBuildStep "./node_modules/.bin/grunt lunr-index"
_printBuildStep "hugo"
}
if [ $# -eq 0 ];then
echo "No arguments supplied - running all"
clean && test && build
else
$@
fi