#!/bin/sh
#
# Shell script to start the Deployit CLI
#

if [ "x$DEPLOYIT_HOME" = "x" ] ; then
  BIN_DIR=`dirname "$0"`
  cd "$BIN_DIR"
  ABSOLUTE_BIN_DIR=`pwd`
  DEPLOYIT_HOME=`dirname "$ABSOLUTE_BIN_DIR"`
fi
echo DEPLOYIT_HOME: $DEPLOYIT_HOME
cd "$DEPLOYIT_HOME"

if [ -z "$JAVA_HOME" ] ; then
  javaExec=java
else
  javaExec=${JAVA_HOME}/bin/java
fi

classpath='conf'
for each in `ls hotfix/*.jar lib/*.jar plugins/*.jar 2>/dev/null`
do
  if [ -f $each ]; then
    classpath=${classpath}:${each}
  fi
done

$javaExec -cp "${classpath}" com.xebialabs.deployit.cli.Cli "$@"
