::----------------------------------------------------------------
:: This command script is executed before and after major steps 
:: in processing each migration job.  You may insert your pre- 
:: or post processing steps as appropriate.
:: This sample includes steps for setting up a web site build.
::
:: The following gmStudio variables are available to use in the script
::
:: JobId             = %JobId%
:: JobName           = %JobName%
:: SrcName           = %SrcName%
:: ShellToolExe      = %ShellToolExe%
:: NetProjFolder     = %NetProjFolder%
:: ProjFolder        = %ProjFolder%
:: UserFolder        = %UserFolder%
:: VirtualRoot       = %VirtualRoot%
:: RuntimeFolder     = %RuntimeFolder%
:: SrcPath           = %SrcPath%
:: DeployFolder      = %DeployFolder%
:: SrcFolder         = %SrcFolder%
:: Dialect           = %Dialect%
:: MigName           = %MigName%
:: IdfFromIdlFolder  = %IdfFromIdlFolder%
:: IdfFromCodeFolder = %IdfFromCodeFolder%
:: GenExternFolder   = %GenExternFolder%
:: DevEnv            = %DevEnv%
:: BndPath           = %BndPath%
:: ResxFolder        = %ResxFolder%
:: TaskTag           = %TaskTag%
:: SrcOrdr           = %SrcOrdr%
:: NetLang           = %NetLang%
:: NetExtn           = %NetExtn%
:: SettingsFolder    = %SettingsFolder%
:: UsrDesc          = %UsrDesc%
:: UsrCmnt          = %UsrCmnt%
::----------------------------------------------------------------

@ECHO OFF

IF .%1==.PRE-TRAN goto PRE-TRAN
IF .%1==.POST-TRAN goto POST-TRAN
IF .%1==.PRE-DEPLOY goto PRE-DEPLOY
IF .%1==.POST-DEPLOY goto POST-DEPLOY
IF .%1==.PRE-MAKE goto PRE-MAKE
IF .%1==.POST-MAKE goto POST-MAKE
IF .%1==.TEST goto TEST

echo UNKNOWN USER COMMAND: %1%
goto END

::----------------------------------------------------------------
:PRE-TRAN
::----------------------------------------------------------------

echo USER COMMAND: %1 [%JobId%]
:: Enter pre-translation processing here
goto END

::----------------------------------------------------------------
:POST-TRAN
::----------------------------------------------------------------

echo USER COMMAND: %1 [%JobId%]
:: Enter post-translation processing here
goto END

::----------------------------------------------------------------
:PRE-DEPLOY
::----------------------------------------------------------------

echo USER COMMAND: %1 [%JobId%]
:: Enter pre-deployment processing here (e.g. direcory setup)

::echo setup directory folders for site
::robocopy "%VirtualRoot%" "%NetProjFolder%" * /s /xf * /e 

goto END

::----------------------------------------------------------------
:POST-DEPLOY
::----------------------------------------------------------------

echo USER COMMAND: %1 [%JobId%]
:: Enter post-deployment processing here (e.g. file replacement/copy)

echo copying ..\usr\rtl\gmRTL.MSComDlg.dll ..\deploy\bin
copy ..\usr\rtl\gmRTL.MSComDlg.dll ..\deploy\bin
echo copying ..\usr\handcode\MSOUtl.%NetExtn% %NetProjFolder%
copy ..\usr\handcode\MSOUtl.%NetExtn% %NetProjFolder%

goto END

::----------------------------------------------------------------
:PRE-MAKE
::----------------------------------------------------------------

echo USER COMMAND: %1 [%JobId%]
:: Enter pre-build processing here
goto END

::----------------------------------------------------------------
:POST-MAKE
::----------------------------------------------------------------

echo USER COMMAND: %1 [%JobId%]
:: Enter post-build processing here
goto END

::----------------------------------------------------------------
:TEST
::----------------------------------------------------------------

echo USER COMMAND: %1 [%JobId%]

:: to activate functional test comment out goto below
goto END

:: a simple functional testing script for batch programs
pushd "%NetProjFolder%\bin"
"%SrcName%.exe"
popd
set ERRORLEVEL=
fc "%SrcFolder%\%SrcName%.log" "%NetProjFolder%\bin\%SrcName%.log"
goto Result%ErrorLevel%
:Result-1
:Result2
echo ERROR
exit 2
:Result1
echo FAIL
exit 1
:Result0 
echo PASS
exit 0


goto END

:END