public
Last active

UpdateReportInProject.bat

  • Download Gist
UpdateReportInProject.bat
Batchfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
@Echo off
%SystemRoot%\system32\chcp 1252
set "max=9"
call :initProgress %max% "Update WorkItems: [PPPP]"
 
set SERVER=%~1
set PROJECT=/TfsReports/IT Development/%~2
 
set RDLPath=C:\src\TFS2010Prod\TFSCommon\ProcessTemplates\Standard Template\Process Template\Reports
 
ECHO.
ECHO Upload starting for %~2
 
REM echo Sprint Burndown
echo UploadReport "%SERVER%" "%RDLPath%\Sprint Burndown.rdl" "Sprint Burndown" "%PROJECT%" "TfsReportDS:Tfs2010ReportDS" "TfsOlapReportDS:Tfs2010OlapReportDS"
call:doProgress
REM echo Build Success over Time
echo UploadReport "%SERVER%" "%RDLPath%\Build Success over Time.rdl" "Build Success over Time" "%PROJECT%/Builds" "TfsReportDS:Tfs2010ReportDS"
call:doProgress
REM echo Release Burndown
echo UploadReport "%SERVER%" "%RDLPath%\Release Burndown.rdl" "Release Burndown" "%PROJECT%" "TfsReportDS:Tfs2010ReportDS" "TfsOlapReportDS:Tfs2010OlapReportDS"
call:doProgress
REM echo ReleaseNotes
echo UploadReport "%SERVER%" "%RDLPath%\ReleaseNotes.rdl" "Release Notes" "%PROJECT%" "TFSDBServer:Tfs2010ReportDS" "TFSDevCollection:TFS2010DevelopmentCollection"
call:doProgress
REM echo Test Case Readiness
echo UploadReport "%SERVER%" "%RDLPath%\Test Case Readiness.rdl" "Test Case Readiness" "%PROJECT%/Tests" "TfsReportDS:Tfs2010ReportDS" "TfsOlapReportDS:Tfs2010OlapReportDS"
call:doProgress
REM echo Test Plan Progress
echo UploadReport "%SERVER%" "%RDLPath%\Test Plan Progress.rdl" "Test Plan Progress" "%PROJECT%/Tests" "TfsReportDS:Tfs2010ReportDS" "TfsOlapReportDS:Tfs2010OlapReportDS"
call:doProgress
REM echo TestCaseDocumentation
echo UploadReport "%SERVER%" "%RDLPath%\TestCaseDocumentation.rdl" "Test Case Documentation" "%PROJECT%" "Warehouse:Tfs2010ReportDS" "Collection:TFS2010DevelopmentCollection"
call:doProgress
REM echo Velocity
echo UploadReport "%SERVER%" "%RDLPath%\Velocity.rdl" "Velocity" "%PROJECT%" "TfsReportDS:Tfs2010ReportDS" "TfsOlapReportDS:Tfs2010OlapReportDS"
call:doProgress
REM echo Build Summary
echo UploadReport "%SERVER%" "%RDLPath%\Build Summary.rdl" "Build Summary" "%PROJECT%/Builds" "TfsReportDS:Tfs2010ReportDS"
call:doProgress
ECHO.
ECHO Upload done for %~2
GOTO END
 
:FAILURE
ECHO.
ECHO Import FAILED for %PROJECT%!
 
:END
GOTO:EOF
 
:initProgress max format -- initialize an internal progress counter and display the progress in percent
:: -- max [in] - progress counter maximum, equal to 100 percent
:: -- format [in,opt] - title string formatter, default is '[P] completed.'
:$created 20060101 :$changed 20080327
:$source http://www.dostips.com
set /a "ProgressCnt=-1"
set /a "ProgressMax=%~1"
set "ProgressFormat=%~2"
if not defined ProgressFormat set "ProgressFormat=[PPPP]"
set "ProgressFormat=%ProgressFormat:[PPPP]=[P] completed.%"
call:doProgress
EXIT /b
 
 
:doProgress -- display the next progress tick
:$created 20060101 :$changed 20080327
:$source http://www.dostips.com
set /a "ProgressCnt+=1"
SETLOCAL ENABLEDELAYEDEXPANSION
set /a "per100=100*ProgressCnt/ProgressMax"
set /a "per10=per100/10"
set /a "per10m=10-per100/10-1"
set "P=%per100%%%"
set "PP="
for /l %%N in (0,1,%per10%) do call set "PP=%%PP%%*"
for /l %%N in (%per10%,1,9) do call set "PP=%%PP%% "
set "PPP="
for /l %%N in (0,1,%per10m%) do call set "PPP=%%PPP%%*"
set "ProgressFormat=%ProgressFormat:[P]=!P!%"
set "ProgressFormat=%ProgressFormat:[PP]=!PP!%"
set "ProgressFormat=%ProgressFormat:[PPP]=!PPP!%"
title %ProgressFormat%
EXIT /b

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.