Skip to content

Commit

Permalink
Add powershell module that was being ignored by git (oops)
Browse files Browse the repository at this point in the history
  • Loading branch information
damianh committed Aug 14, 2014
1 parent 9e8962a commit 36faddc
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions build/Modules/BuildFunctions.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
function Get-Version
{
param
(
[string]$assemblyInfoFilePath
)
Write-Host "path $assemblyInfoFilePath"
$pattern = '(?<=^\[assembly\: AssemblyVersion\(\")(?<versionString>\d+\.\d+\.\d+\.\d+)(?=\"\))'
$assmblyInfoContent = Get-Content $assemblyInfoFilePath
return $assmblyInfoContent | Select-String -Pattern $pattern | Select -expand Matches |% {$_.Groups['versionString'].Value}
}

function Update-Version
{
param
(
[string]$version,
[string]$assemblyInfoFilePath
)

$newVersion = 'AssemblyVersion("' + $version + '")';
$newFileVersion = 'AssemblyFileVersion("' + $version + '")';
$tmpFile = $assemblyInfoFilePath + ".tmp"

Get-Content $assemblyInfoFilePath |
%{$_ -replace 'AssemblyFileVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)', $newFileVersion } | Out-File -Encoding UTF8 $tmpFile

Move-Item $tmpFile $assemblyInfoFilePath -force
}

0 comments on commit 36faddc

Please sign in to comment.