Created
March 17, 2015 10:00
-
-
Save tobiaszuercher/b52d98f0b9d20fa7293c to your computer and use it in GitHub Desktop.
Regex counter for TeamCity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[string]$path, | |
[string]$regex, | |
[string]$name | |
) | |
$counter = 0 | |
Get-ChildItem $path -Recurse -Filter "*.cs" | Get-Content | % { | |
$result = [regex]::Matches($_, $regex, "IgnoreCase") | |
$counter += $result.Count | |
} | |
Write-Host "##teamcity[buildStatisticValue key='$name' value='$counter']" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment