-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
executable file
·38 lines (30 loc) · 918 Bytes
/
run.sh
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
#!/usr/bin/env bash
if [[ -f "$HOME/.sdkman/bin/sdkman-init.sh" ]]; then
source "$HOME/.sdkman/bin/sdkman-init.sh"
fi
# run Ride in target dir
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "${DIR}" || exit 1
PROPERTY_FILE=version.properties
function getProperty {
PROP_KEY=$1
PROP_VALUE=$(cat $PROPERTY_FILE | grep "$PROP_KEY" | cut -d'=' -f2)
echo "$PROP_VALUE" | xargs
}
echo "# Reading property from $PROPERTY_FILE"
VERSION=$(getProperty "version")
JAR_NAME=$(getProperty "jar.name")
RELEASE_TAG=$(getProperty "release.tag")
TARGET=${PWD}/target
ZIPFILE="${TARGET}/ride-${RELEASE_TAG}-dist.zip"
if [[ ! -f "${ZIPFILE}" ]]; then
echo "${ZIPFILE} does not exist, creating it..."
mvn clean package
fi
ZIPDIR=${ZIPFILE%.*}
if [[ ! -e "${ZIPDIR}" ]]; then
echo "Unpacking ${ZIPFILE} to ${ZIPDIR}"
unzip -d "$ZIPDIR" "$ZIPFILE"
fi
cd "${ZIPDIR}" || exit
./ride.sh