forked from GMOD/Apollo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapollo
executable file
·143 lines (129 loc) · 4.17 KB
/
apollo
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
function usage(){
echo "";
echo "Usage: apollo <command>";
echo "";
echo "Commands:";
echo "";
echo "deploy: Builds Unoptimized war file (no processing of javascript) into the target directory.";
echo "devmode: Runs from current directory debug mode (non-minimized javascript).";
echo "run-local <port>: Runs from current directory, but not in dev-mode. ";
echo "test: Runs test-suite.";
echo "debug: Runs from current directory in debug mode (non-minimized javascript).";
echo "release: Builds in release mode (minimized javascript). (advanced)";
echo "compile: Compiled the build.";
echo "clean: Removes class files.";
echo "clean-all: Removes class files and jbrowse files.";
echo "help: This message.";
};
if [[ $# == 0 || $1 == help || $1 == --help ]]; then
usage
exit 1;
fi
function check_node(){
node_executable=$(which node)
if ! [ -x "$node_executable" ] ; then
nodejs_executable=$(which nodejs)
if ! [ -x "$nodejs_executable" ] ; then
echo "You must install 'Node JS' to do a release of web apollo."
exit 1 ;
else
echo "Creating an alias 'node' for 'nodejs'"
alias node="nodejs"
fi
fi
}
function check_perldependencies(){
perl -e 'use Text::Markdown'
if [ $? != 0 ] ; then
echo "Perl package 'Text::Markdown' is required in order to do a release of web apollo."
exit 1 ;
fi
perl -e 'use DateTime'
if [ $? != 0 ] ; then
echo "Perl package 'DateTime' is required in order to do a release of web apollo."
exit 1 ;
fi
}
function check_configs_for_release(){
ant_executable=$(which ant)
if ! [ -x "$ant_executable" ] ; then
echo "You must install 'Ant' to do a release of web apollo."
fi
check_node
check_perldependencies
}
function check_configs(){
grails_executeable=$(which grails)
git_executable=$(which git)
if ! [ -x "$grails_executeable" ] ; then
echo "You must install 'grails' to install web apollo."
exit 1 ;
fi
if ! [ -x "$git_executable" ] ; then
echo "You must install 'git' to install web apollo."
exit 1 ;
fi
}
if [[ $1 == "devmode" ]];then
# should call the copy target first
check_configs
ant devmode &
grails -reloading run-app
elif [[ $1 == "run-local" ]];then
# should call the copy target first
check_configs
if [[ $# == 2 ]]; then
ant copy-resources gwtc && grails -Dserver.port=$2 run-app
else
ant copy-resources gwtc && grails run-app
fi
elif [[ $1 == "debug" ]];then
# TODO: feel like there is a better way to do this
OLD_MAVEN_OPTS=$MAVEN_OPTS
check_configs
export MAVEN_OPTS=-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=n
ant devmode &
grails -reloading debug
export MAVEN_OPTS=$OLD_MAVEN_OPTS
unset OLD_MAVEN_OPTS
elif [[ $1 == "test" ]];then
# should call the copy target first
grails test-app
elif [[ $1 == "test-unit" ]];then
# should call the copy target first
grails test-app :unit
# mvn test
elif [[ $1 == "deploy" ]];then
# should call the copy target first
check_configs
# this makes it globally available
rm -f src/java/apollo-config.groovy
cp apollo-config.groovy src/java/apollo-config.groovy
#grails deploy
ant copy-resources gwtc && grails war
elif [[ $1 == "release" ]];then
# should call the copy target first
check_configs
check_configs_for_release
rm -f src/java/apollo-config.groovy
cp apollo-config.groovy src/java/apollo-config.groovy
ant clean-all release gwtc && grails war
elif [[ $1 == "compile" ]];then
# should call the copy target first
ant gwtc && grails compile
elif [[ $1 == "clean-all" ]];then
# should call the copy target first
rm -rf bin
rm -rf jbrowse-download
rm -rf JBrowse-dev
rm -rf src/main/webapp/jbrowse
rm -f *.zip
ant clean-all
grails clean
elif [[ $1 == "clean" ]];then
# should call the copy target first
ant clean && grails clean
else
usage
fi