forked from enertech-ch/eapp-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ldo
74 lines (60 loc) · 1.1 KB
/
ldo
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
#!/bin/sh
export HUGO_SRC="./src"
export HUGO_DEST="../public"
export HUGO_URL="http://localhost:1313/"
APPS="hugo"
usage() {
# command help:
echo "
### Lexdocs Application Simple Commands ###
$0 up
start applications
$0 down
end applications
$0 build
builds assets for production
$0 update
updates dependencies
";
} # => usage()
up() {
# command up:
docker-compose up -d $APPS
} # => up()
down() {
# command down:
docker-compose down
} # => down()
build_assets() {
# command build_assets:
docker-compose run --rm hugo -b ${HUGO_URL} -s ${HUGO_SRC} -d ${HUGO_DEST} "$@"
} # => build_assets()
update() {
# command down:
git submodule foreach git pull
} # => update()
# get command name
cmd="$1"
# determine how we were called, then hand off to the function responsible
[ -n "$1" ] && shift # scrape off command
case "$cmd" in
up)
up "$@"
;;
down)
down "$@"
;;
build)
build_assets "$@"
;;
update)
update "$@"
;;
""|help|-h|--help|--usage)
usage "$1"
exit 0
;;
*)
echo "Unknown command '$cmd'. Run without commands for usage help."
;;
esac