forked from breizhcamp/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhugow
executable file
·48 lines (41 loc) · 1.01 KB
/
hugow
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
#!/usr/bin/env bash
# Hugo wrapper
set -eu -o pipefail
# MacOS lover's, I did not forget you ;)
PROJECT_ROOT="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
cd "$PROJECT_ROOT"
HUGO_VERSION=0.31
install_hugo() {
mkdir -p .hugo
case "`uname`" in
Darwin* )
curl -L "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_macOS-64bit.tar.gz" | \
zcat | (cd .hugo; tar -xf -)
;;
Linux* )
curl -L "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz" | \
(cd .hugo; tar xzf -)
;;
esac
if [[ ! -x "$HUGO" ]]; then
echo "Unable to install Hugo binary, exiting..."
exit 1
fi
}
not_found=0
HUGO=$(which hugo 2>/dev/null) || not_found=$?
if [[ $not_found -ne 0 ]]; then
case "`uname`" in
Darwin*)
HUGO=".hugo/hugo"
;;
Linux*)
HUGO=".hugo/hugo"
;;
*)
echo "No Unable to find Hugo binary, exiting..."
exit 1
esac
[[ ! -x "$HUGO" ]] && install_hugo
fi
"$HUGO" "$@"