-
-
Notifications
You must be signed in to change notification settings - Fork 86
/
box-cli
executable file
·76 lines (74 loc) · 2.15 KB
/
box-cli
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/bash
reldir=`dirname $0`
cd $reldir/build
ANTCMD="/bin/sh $HOME/cfdistro/ant/bin/ant -nouserlib -f build.xml"
export ANT_HOME=$HOME/cfdistro/ant
CFDISTRO_ZIP=$HOME/cfdistro/cfdistro.zip
if [ "$HTTP_CLIENT" = "" ]; then
if type -p curl >/dev/null 2>&1; then
if [ "$https_proxy" != "" ]; then
CURL_PROXY="-x $https_proxy"
fi
HTTP_CLIENT="curl $CURL_PROXY -f -L -o"
else
HTTP_CLIENT="wget -O"
fi
fi
if [ ! -d "$ANT_HOME" ]; then
export ANT_HOME=$HOME/cfdistro/ant
ANTCMD="/bin/sh $HOME/cfdistro/ant/bin/ant -nouserlib -f build.xml"
fi
if [ ! -d "$ANT_HOME" ]; then
if [ -r "$CFDISTRO_ZIP" ]; then
echo "The zip was already saved to $CFDISTRO_ZIP."
echo "If you wish to re-download, delete it."
exit 1
fi
echo "Downloading cfdistro now..."
CFDISTRO_DIR=`dirname "$CFDISTRO_ZIP"`
mkdir -p "$CFDISTRO_DIR"
CFDISTRO_URL="http://cfmlprojects.org/artifacts/cfdistro/latest/cfdistro.zip"
$HTTP_CLIENT "$CFDISTRO_ZIP" "$CFDISTRO_URL"
if [ $? != 0 ]; then
echo "Failed to download $CFDISTRO_URL"
echo "If you have an old version of libssl you may not have the correct"
echo "certificate authority. Either upgrade or set HTTP_CLIENT to insecure:"
echo " export HTTP_CLIENT=\"wget --no-check-certificate -O\" # or"
echo " export HTTP_CLIENT=\"curl --insecure -f -L -o"
rm $CFDISTRO_ZIP 2> /dev/null
exit 1
fi
unzip "$CFDISTRO_ZIP" -d "$CFDISTRO_DIR"
fi
if [ -z "$1" ]; then
echo "box-cli control script"
OPTIONS="start stop help list-targets update exit"
select opt in $OPTIONS; do
if [ "$opt" = "start" ]; then
$ANTCMD build.start.launch
exit
elif [ "$opt" = "stop" ]; then
$ANTCMD server.stop
exit
elif [ "$opt" = "help" ]; then
echo "usage (skips this prompt): box-cli [start|stop|{target}]"
elif [ "$opt" = "list-targets" ]; then
$ANTCMD help
elif [ "$opt" = "update" ]; then
$ANTCMD project.update
elif [ "$opt" = "exit" ]; then
exit
else
#clear
echo bad option
fi
done
fi
target=$1
parameters=""
shift
for var in "$@"
do
parameters="$parameters -D$var"
done
$ANTCMD $target -Dbasedir=. $parameters