-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackend
executable file
·55 lines (46 loc) · 1.08 KB
/
backend
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
#!/bin/bash
BACKEND_PATH=`pwd`
MVN_PATH=$(cd ../movie-info-tools/maven; pwd)
COMMAND=$1
ARGS=${@:2}
function main() {
case "$COMMAND" in
build) build $ARGS
;;
run) run $ARGS
;;
test) integrationTest $ARGS
;;
migrate) migrate $ARGS
;;
dropDb) dropDb $ARGS
;;
*) echo "invalid command: build.sh build|run|test|migrate"
;;
esac
}
# build project
function build() {
${MVN_PATH}/bin/mvn clean install ${@:1}
}
# set up database
function migrate() {
cd ${BACKEND_PATH}/movie-info-migrations
${MVN_PATH}/bin/mvn liquibase:update ${@:1}
}
function dropDb() {
cd ${BACKEND_PATH}/movie-info-migrations
${MVN_PATH}/bin/mvn liquibase:dropAll ${@:1}
}
# start tomcat using maven plugin
function run() {
${MVN_PATH}/bin/mvn clean install ${@:1}
cd ${BACKEND_PATH}/movie-info-rest-api
${MVN_PATH}/bin/mvn tomcat7:run ${@:1}
}
# run integration tests
function integrationTest() {
cd ${BACKEND_PATH}/movie-info-integration
${MVN_PATH}/bin/mvn clean test ${@:1}
}
main