Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Vaccano
Created May 11, 2011 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vaccano/967583 to your computer and use it in GitHub Desktop.
Save Vaccano/967583 to your computer and use it in GitHub Desktop.
UpdateReportInProject.bat
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment