Files
NuGet.Client/scripts/common.ps1
T
Alex Panov 204d7fafd1 Fixed publishing of VS15 symbols for CI builds
Fixes NuGet/Home#3185

- Added a parameter pointing  to the right version of NuGet.Core for pdb publishing
- Added pdb to the command line package nuspec
- Minor script fixes
2016-07-29 09:23:43 -07:00

41 lines
1.1 KiB
PowerShell

function ReadPropertiesFile {
Param(
[Parameter(Mandatory=$True)]
[string]$Path
)
Write-Verbose "Reading properties file '$Path'"
$properties = @{}
Get-Content $Path |
? { -not $_.StartsWith('#') } |
% { $_.Trim() } |
? { $_ -ne '' } |
% { $tokens = $_ -split "\s*=\s*"; $properties.Add($tokens[0], $tokens[1]) }
$properties
}
function ReplaceTextInFiles {
[CmdletBinding(SupportsShouldProcess=$True)]
Param(
[Parameter(ValueFromPipeline=$True, Mandatory=$True, Position=0)]
[string[]]$Files,
[Parameter(Mandatory=$True)]
[Alias('old')]
[string]$OldText,
[Parameter(Mandatory=$True)]
[Alias('new')]
[string]$NewText
)
Process {
$Files |
?{ (Get-Content $_ | Out-String) -match $OldText } |
?{ $pscmdlet.ShouldProcess($_, 'replace text') } |
%{
$updated = (Get-Content $_) | %{
$_.Replace($OldText, $NewText)
}
Set-Content $_ $updated | Out-Null
}
}
}