@echo off
REM
REM Batch script to start the Deployit CLI
REM

setlocal ENABLEDELAYEDEXPANSION

if "%DEPLOYIT_HOME%"=="" (
  cd /d %~dp0
  cd ..
  set DEPLOYIT_HOME=!CD!
)

echo DEPLOYIT_HOME: %DEPLOYIT_HOME%
cd /d %DEPLOYIT_HOME%

if "%JAVA_HOME%"=="" (
  set JAVA_EXEC=java
) else (
  set JAVA_EXEC="%JAVA_HOME%\bin\java"
)

set DEPLOYIT_CLASSPATH=conf
for %%i in (hotfix\*.jar) do set DEPLOYIT_CLASSPATH=!DEPLOYIT_CLASSPATH!;%%i
for %%i in (lib\*.jar) do set DEPLOYIT_CLASSPATH=!DEPLOYIT_CLASSPATH!;%%i
for %%i in (plugins\*.jar) do set DEPLOYIT_CLASSPATH=!DEPLOYIT_CLASSPATH!;%%i

%JAVA_EXEC% -cp "%DEPLOYIT_CLASSPATH%" com.xebialabs.deployit.cli.Cli %*

:end
endlocal

