-
Notifications
You must be signed in to change notification settings - Fork 2
/
do
executable file
·99 lines (90 loc) · 2.26 KB
/
do
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
. ./scripts/variables.sh
. ./scripts/do-args.sh
. ./scripts/docker.sh
. ./scripts/setup.sh
. ./scripts/help.sh
. ./scripts/database.sh
. ./scripts/oc.sh
. ./scripts/npm.sh
. ./scripts/services.sh
action=${1-"help"}
if [ "$action" = "help" ]; then
do_help
elif [ "$action" = "setup" ]; then
gen_env ${2-}
elif [ "$action" = "init" ]; then
s='' # Clear service argument
gen_env ${2-}
docker_up database
db-migration
docker_up
# Docker
elif [ "$action" = "up" ]; then
docker_up
elif [ "$action" = "build" ]; then
docker_build
elif [ "$action" = "stop" ]; then
docker_stop
elif [ "$action" = "down" ]; then
docker_down
elif [ "$action" = "restart" ]; then
docker_restart $s
elif [ "$action" = "refresh" ]; then
docker_refresh $s
elif [ "$action" = "remove" ]; then
docker_remove $s
elif [ "$action" = "nuke" ]; then
docker_nuke
elif [ "$action" = "ssh" ]; then
docker exec -it "hsb-$2" sh
# Database
elif [ "$action" = "tool-update" ]; then
tool-update $s
elif [ "$action" = "db-migration" ]; then
db-migration $s
elif [ "$action" = "db-migrations" ]; then
db-migrations $s
elif [ "$action" = "db-add" ]; then
db-add $s
elif [ "$action" = "db-update" ]; then
db-update $s
elif [ "$action" = "db-rollback" ]; then
db-rollback $s
elif [ "$action" = "db-remove" ]; then
db-remove $s
elif [ "$action" = "db-drop" ]; then
db-drop $s
elif [ "$action" = "db-refresh" ]; then
db-refresh $s
elif [ "$action" = "db-redo" ]; then
db-redo $s
# Openshift
elif [ "$action" = "db-connect" ]; then
db-connect ${2-prod} ${3-} ${4-}
elif [ "$action" = "oc-build" ]; then
oc-build ${2-} ${3-}
elif [ "$action" = "oc-push" ]; then
oc-push ${2-} ${3-}
elif [ "$action" = "oc-deploy" ]; then
oc-deploy ${2-} ${3-} ${4-} ${5-}
elif [ "$action" = "oc-run" ]; then
oc-run ${2-} ${3-} ${4-}
# Services
elif [ "$action" = "data-service" ]; then
data-service $@
# NPM
elif [ "$action" = "npm-install" ]; then
npm-install $@
# Other
elif [ "$action" = "go" ]; then
if [[ "$OSTYPE" == "darwin"* ]]; then # Macos
open http://localhost:30080
elif [[ "$OSTYPE" == "win32" ]] || [[ "$OSTYPE" == "msys" ]]; then # Windows
start http://localhost:30080
else
xdg-open http://localhost:30080
fi
else
echo "Invalid action '$action', refer to help."
fi