Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

If you associate a command script template with a task in your migration project, gmStudio will find it, edit processing parameters, and run it at key execution points during batch processing:
  • Pre/Post Translation 
  • Pre/Post Deployment 
  • Pre/Post Build
  • Functional Test Task
     
For example, one use of this facility might be to install the new system in a test environment and run a series of automated tests after each build.

Execution of the Batch Command Script

If a Batch Command Script is associated with an upgrade task, it will be executed along with the major batch operations.  For example, during the deploy operation, gmStudio starts a command line process and executes the following command line:

Code Block
languagepowershell
linenumberstrue
cmd.exe /C pushd "C:\gmSpec\Lang\OverloadArg\proj\log" 
&& "OverloadArg-OverloadArg-2A-csh.userCmdBatch.cmd" PRE-DEPLOY >"OverloadArg-OverloadArg-2A-csh.bnd.log" 2>&1 
&& "C:\Program Files (x86)\GreatMigrations\gmStudio\\support\tools\deploy.exe" "OverloadArg-OverloadArg-2A-csh.bnd" replace verbose >> "C:\gmSpec\Lang\OverloadArg\proj\log\OverloadArg-OverloadArg-2A-csh.bnd.log" 2>&1 
&& "OverloadArg-OverloadArg-2A-csh.userCmdBatch.cmd" POST-DEPLOY >>"OverloadArg-OverloadArg-2A-csh.bnd.log" 2>&1 
&& popd
 
The command line executes five operations:
1) Make workspace log folder the working folder
2) Run the actual batch command script passing PRE-DEPLOY 
3) Run the deployment tool
4) Run the actual batch command script passing POST-DEPLOY 
5) Reset the working folder

The standard and error output of each operation is captured in a log file. 

 

Structure of the Batch Command Script

The Batch Command Script is a template file:  it supports an extensive set of parameter variables (i.e. %parameter%) that will be replaced by actual values associated with the upgrade project/task to create an actual batch command script. The replacements produce the Actual Batch Command Script in the workspace\log folder.  That Actual Batch Command Script  is executed before and after the associated batch operation being performed by gmStudio.  A listing of the actual batch script in the log folder may be viewed at the bottom of the Deploy Log display on the Information panel.


The default Batch Command Script template is organized into sections using statement labels.  The different sections are executed based on the command line parameters passed when the script is executed.

Batch Command Output

The console output generated by the batch process will be attached joined to the appropriate logs associated the with each main batch operation.  These logs can be reviewed in the by Clicking the Information Panel 
Steps to Activate
Panel.  
The log from the TEST operation may be viewed at the bottom of the Build log display.

Activating a Batch Command Script

The UsrCmds field on each task record is where you specify the name of your batch script template. You will not typically specify the full path to your batch file, rather you will specify just the file name filename then place it in a standard template location such as the usr folder in your workspace. the script in the workspace\usr folder.   

The steps to associate a batch command script with an upgrade task are as follows:

  1. Click the task you want to add user batch handling for
  2. Client Edit Task Attributes in the Task Context menu 
    This will display the task information editor 
  3. Enter the name UserCmd.cmd in the UserCmd field 
  4. Click Save
    The tool will copy a default UserCmd.cmd from to your workspace\usr folder if one is not already there. 

Editing the User Batch Command Script

Once you have associated a batch command script with a task, clicking [Edit Task Script(s)] on the Task context menu will open the file in the editor along with the main translation task script.

Sample Batch Command Script

A listing of a Sample Batch Command Script sample batch command script template is shown below.  Notice that there are examples of the script parameters and different labeled sections that correspond to the different execution points.  

This particular script has code in the TEST section which executes the .NET code and compares its output with the output generated by running the VB6 code. 

Code Block
languagepowershell
::----------------------------------------------------------------
:: 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%
:: UserDesc          = %UserDesc%
:: UserCmnt          = %UserCmnt%
::----------------------------------------------------------------
@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. file replacement)
::echo setup directory folders for site
::robocopy "%VirtualRoot%" "%ProjFolder%\deploy" * /s /xf * /e 
::echo deleting *.as* files from deployment %ProjFolder%\deploy
::if exist "%ProjFolder%\deploy\*.as*" del /s "%ProjFolder%\deploy\*.as*"
::if exist "%ProjFolder%\deploy\*.cs*" del /s "%ProjFolder%\deploy\*.cs*"
goto END
::----------------------------------------------------------------
:POST-DEPLOY
::----------------------------------------------------------------
echo USER COMMAND: %1 [%JobId%]
:: Enter post-deployment processing here (e.g. file replacement)
::robocopy "%VirtualRoot%" "%NetProjFolder%" *.jpg *.gif *.png *.vbs *.js *.css *.xls *.txt /np /s /NJH
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%]
:: Enter functional testing here
pushd "%NetProjFolder%\bin"
"%SrcName%.exe"
popd
echo file-report layout:side-by-side ^& > diff.bc
echo options:display-mismatches,line-numbers ^& >> diff.bc
echo output-to:%%3 %%1 %%2 >> diff.bc
::"c:\Program Files (x86)\Beyond Compare 3\BComp.exe" @"diff.bc" "%SrcFolder%\%SrcName%.log" "%NetProjFolder%\bin\%SrcName%.log" %SrcName%_test.log
:: type %srcName%_test.log

fc "%SrcFolder%\%SrcName%.log" "%NetProjFolder%\bin\%SrcName%.log"
goto END
:END

Table of Contents