-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·84 lines (63 loc) · 1.57 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
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
#!/usr/local/bin/bash
# ==============================================================================
# SET OPTIONS
# ==============================================================================
usage()
{
cat <<EOF
PURPOSE:
This script builds jekyll website.
USAGE:
$0 <arguments>
ARGUMENTS:
[-b] Suffix to go on _config*.yml and _site* directory
[-v] Build verbosely (optional flag)
EXAMPLE:
./build.sh -b _dev
DEFAULT VALUES:
b = <empty string>
v = 0 (knit/build quietly)
EOF
}
# defaults
b=""
v=0
build_q="--quiet"
while getopts "hb:v" opt;
do
case $opt in
h)
usage
exit 1
;;
b)
b=$OPTARG
;;
v)
v=1
;;
\?)
usage
exit 1
;;
esac
done
# change quiet options if verbose flag is chosen
if [[ $v == 1 ]]; then
build_q=""
fi
printf "\nBUILD JEKYLL SITE\n"
printf -- "----------------------------------\n"
# ==============================================================================
# BUILD
# ==============================================================================
printf "\n[ Building... ]\n\n"
jekyll build $build_q --config ./_config${b}.yml --destination ./_site${b}
printf " Built site ==>\n"
printf " config file: _config$b\n"
printf " location: _site$b\n"
# ==============================================================================
# BUILD
# ==============================================================================
printf "\n[ Finished! ]\n\n"
# ==============================================================================