forked from vadimzozulya/FakeHttpContext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pack.ps1
21 lines (18 loc) · 809 Bytes
/
pack.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
param
(
[Parameter(Mandatory=$false)][string] $nugetPackagesOutput = $PSScriptRoot + "\output"
)
if (Test-Path $nugetPackagesOutput) {
gci -Path $nugetPackagesOutput -Include "*.*" -File -Recurse | foreach{ $_.Delete()}
} else {
New-Item -ItemType Directory -Path $nugetPackagesOutput
}
$assemblyInfoFilePath = '.\src\FakeHttpContext\Properties\AssemblyInfo.cs'
$assemblyInformationalVersionRegex = "(\[assembly: AssemblyInformationalVersion\()(`")(.*)(`"\))"
$existingVersion = (select-string -Path $assemblyInfoFilePath -Pattern $assemblyInformationalVersionRegex).Matches[0].Groups[3]
Get-ChildItem -Path .\nuspec | foreach {
$nuspecFile = $_.FullName
$params = "-OutputDirectory $nugetPackagesOutput -version $existingVersion"
$nugetCmd = "nuget pack $nuspecFile $params"
iex $nugetCmd
}