1 | #!/bin/bash |
---|
2 | |
---|
3 | ASSETDIR=src/main/resources/assets |
---|
4 | LIBDIR=$ASSETDIR/lib |
---|
5 | FONTDIR=$ASSETDIR/fonts |
---|
6 | JSDIR=$ASSETDIR/js |
---|
7 | |
---|
8 | RUN_BOWER= |
---|
9 | BUILD_JSX=1 |
---|
10 | BUILD_JAR= |
---|
11 | BUILD_GO= |
---|
12 | RUN_JAR= |
---|
13 | RUN_JAR_PRODUCTION= |
---|
14 | |
---|
15 | while [[ $# > 0 ]] |
---|
16 | do |
---|
17 | key="$1" |
---|
18 | # echo $# " :" $key |
---|
19 | case $key in |
---|
20 | --bower) |
---|
21 | RUN_BOWER=1 |
---|
22 | ;; |
---|
23 | --jsx) |
---|
24 | BUILD_JSX=1 |
---|
25 | ;; |
---|
26 | --jar) |
---|
27 | BUILD_JAR=1 |
---|
28 | ;; |
---|
29 | --run) |
---|
30 | RUN_JAR=1 |
---|
31 | ;; |
---|
32 | --run-production) |
---|
33 | RUN_JAR_PRODUCTION=1 |
---|
34 | ;; |
---|
35 | *) |
---|
36 | echo "Unknown option:" $1 |
---|
37 | exit 1 |
---|
38 | ;; |
---|
39 | esac |
---|
40 | shift |
---|
41 | done |
---|
42 | |
---|
43 | if [ $RUN_BOWER ] |
---|
44 | then |
---|
45 | mkdir -p $LIBDIR |
---|
46 | mkdir -p $FONTDIR |
---|
47 | mkdir -p $JSDIR |
---|
48 | |
---|
49 | npm install bower react-tools |
---|
50 | node_modules/bower/bin/bower install jquery bootstrap react react-addons font-awesome |
---|
51 | |
---|
52 | cp bower_components/bootstrap/dist/css/bootstrap.min.css $LIBDIR/ |
---|
53 | cp bower_components/bootstrap/dist/js/bootstrap.min.js $LIBDIR/ |
---|
54 | cp bower_components/jquery/dist/jquery.min.js $LIBDIR/ |
---|
55 | cp bower_components/jquery/dist/jquery.min.map $LIBDIR/ |
---|
56 | cp bower_components/react/react-with-addons.js $LIBDIR/ |
---|
57 | cp bower_components/react/react-with-addons.min.js $LIBDIR/ |
---|
58 | cp bower_components/font-awesome/css/font-awesome.min.css $LIBDIR/ |
---|
59 | |
---|
60 | cp bower_components/bootstrap/fonts/* $FONTDIR/ |
---|
61 | cp bower_components/font-awesome/fonts/* $FONTDIR/ |
---|
62 | fi |
---|
63 | |
---|
64 | if [ $BUILD_JSX ] |
---|
65 | then |
---|
66 | echo; echo "---- jsx" |
---|
67 | for f in $JSDIR/*.jsx; do |
---|
68 | cp -v $f $JSDIR/`basename $f .jsx`.js; |
---|
69 | done |
---|
70 | node_modules/react-tools/bin/jsx --no-cache-dir $JSDIR $JSDIR |
---|
71 | fi |
---|
72 | |
---|
73 | if [ $BUILD_JAR ] |
---|
74 | then |
---|
75 | echo; echo "---- mvn clean package" |
---|
76 | mvn -q clean package |
---|
77 | fi |
---|
78 | |
---|
79 | if [ $RUN_JAR ] |
---|
80 | then |
---|
81 | echo; echo "---- run devel" |
---|
82 | JAR=`find target -iname 'aggregator-*.jar'` |
---|
83 | echo java -cp src/main/resources:$JAR eu.clarin.sru.fcs.aggregator.app.Aggregator server aggregator_devel.yml |
---|
84 | java -cp src/main/resources:$JAR eu.clarin.sru.fcs.aggregator.app.Aggregator server aggregator_devel.yml |
---|
85 | fi |
---|
86 | |
---|
87 | if [ $RUN_JAR_PRODUCTION ] |
---|
88 | then |
---|
89 | echo; echo "---- run production" |
---|
90 | JAR=`find target -iname 'aggregator-*.jar'` |
---|
91 | echo java -jar $JAR server aggregator.yml |
---|
92 | java -jar $JAR server aggregator.yml |
---|
93 | fi |
---|