Skip to content

Commit f1c6d2a

Browse files
committed
build: enhance the run script
1 parent 05ebfb7 commit f1c6d2a

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

tools/run

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,49 @@
22
#
33
# Run jekyll serve and then launch the site
44

5-
bundle exec jekyll s -H 0.0.0.0 -l
5+
prod=false
6+
command="bundle exec jekyll s -l"
7+
host="127.0.0.1"
8+
9+
help() {
10+
echo "Usage:"
11+
echo
12+
echo " bash /path/to/run [options]"
13+
echo
14+
echo "Options:"
15+
echo " -H, --host [HOST] Host to bind to."
16+
echo " -p, --production Run Jekyll in 'production' mode."
17+
echo " -h, --help Print this help information."
18+
}
19+
20+
while (($#)); do
21+
opt="$1"
22+
case $opt in
23+
-H | --host)
24+
host="$2"
25+
shift 2
26+
;;
27+
-p | --production)
28+
prod=true
29+
shift
30+
;;
31+
-h | --help)
32+
help
33+
exit 0
34+
;;
35+
*)
36+
echo -e "> Unknown option: '$opt'\n"
37+
help
38+
exit 1
39+
;;
40+
esac
41+
done
42+
43+
command="$command -H $host"
44+
45+
if $prod; then
46+
command="JEKYLL_ENV=production $command"
47+
fi
48+
49+
echo -e "\n> $command\n"
50+
eval "$command"

0 commit comments

Comments
 (0)