Skip to content

Commit

Permalink
Merge pull request filodb#127 from jenaiz/master
Browse files Browse the repository at this point in the history
creating a function for checking java and another to check sbt
  • Loading branch information
velvia authored Nov 9, 2016
2 parents ba8d940 + c86859a commit 9cc44bf
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions filo-cli
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,36 @@ FILO_VERSION=$(cat version.sbt | sed -e 's/.*"\(.*\)"/\1/g')
CLI_FILE=`pwd`"/cli/target/scala-$SCALA_VERSION/filo-cli-$FILO_VERSION"

function isJava8(){
if [[ "$JAVA" ]]; then
version=$("$JAVA" -version 2>&1 | awk -F '"' '/version/ {print $2}')
if [[ "$version" < "1.8" ]]; then
echo "FiloDB requires Java JDK 1.8 and the current version is $version. Please upgrade to continue."
if [[ "$JAVA" ]]; then
version=$("$JAVA" -version 2>&1 | awk -F '"' '/version/ {print $2}')
if [[ "$version" < "1.8" ]]; then
echo "FiloDB requires Java JDK 1.8 and the current version is $version. Please upgrade to continue."
exit
fi
fi
}

function check_java {
JAVA=$(type -p java)
if [ -z "$JAVA" ]; then
echo "Failed to find Java in PATH. Please install Java JDK 1.8"
exit
fi
fi
}

JAVA=$(type -p java)
if [ -z "$JAVA" ]; then
echo "Failed to find Java in PATH. Please install Java JDK 1.8"
exit
fi
function check_sbt {
if [ -z $1 ]; then
echo "Failed to find SBT in PATH. Please install SBT"
exit
fi
}

isJava8
check_java

SBT=$(type -p sbt)
if [ -z "$SBT" ]; then
echo "Failed to find SBT in PATH. Please install SBT"
exit
fi

check_sbt $SBT

if [ ! -f "$CLI_FILE" ];then
# run assembly if file doesn't exist
Expand Down

0 comments on commit 9cc44bf

Please sign in to comment.