mirror of
https://github.com/aphrody-labs/NuGet.Client.git
synced 2026-10-17 12:45:02 +00:00
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
41 lines
1.1 KiB
PowerShell
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
|
|
}
|
|
}
|
|
} |