@@ -55,7 +55,7 @@ function init {
5555 }
5656
5757 # We expect the source for the module in a subdirectory called one of three things:
58- $Script :SourcePath = " src" , " source" , ${ModuleName} | ForEach { Join-Path $Path $_ - Resolve - ErrorAction Ignore } | Select - First 1
58+ $Script :SourcePath = " src" , " source" , ${ModuleName} | ForEach-Object { Join-Path $Path $_ - Resolve - ErrorAction Ignore } | Select-Object - First 1
5959 if (! $SourcePath ) {
6060 Write-Warning " This Build script expects a 'Source' or '$ModuleName ' folder to be alongside it."
6161 throw " Can't find module source folder."
@@ -66,7 +66,7 @@ function init {
6666 Write-Warning " This Build script expects a '${ModuleName} .psd1' in the '$SourcePath ' folder."
6767 throw " Can't find module source files"
6868 }
69- $Script :TestPath = " Tests" , " Specs" | ForEach { Join-Path $Path $_ - Resolve - ErrorAction Ignore } | Select - First 1
69+ $Script :TestPath = " Tests" , " Specs" | ForEach-Object { Join-Path $Path $_ - Resolve - ErrorAction Ignore } | Select-Object - First 1
7070 if (! $TestPath ) {
7171 Write-Warning " This Build script expects a 'Tests' or 'Specs' folder to contain tests."
7272 }
@@ -145,9 +145,9 @@ function update {
145145 Trace-Message " UPDATE $ModuleName in $Path "
146146
147147 if (Test-Path (Join-Path $Path packages.config)) {
148- if (! ($Name = Get-PackageSource | ? Location -eq ' https://www.nuget.org/api/v2' | % Name)) {
148+ if (! ($Name = Get-PackageSource | Where-Object Location -eq ' https://www.nuget.org/api/v2' | ForEach-Object Name)) {
149149 Write-Warning " Adding NuGet package source"
150- $Name = Register-PackageSource NuGet - Location ' https://www.nuget.org/api/v2' - ForceBootstrap - ProviderName NuGet | % Name
150+ $Name = Register-PackageSource NuGet - Location ' https://www.nuget.org/api/v2' - ForceBootstrap - ProviderName NuGet | Where-Object Name
151151 }
152152
153153 if ($Force -and (Test-Path $Path \packages)) {
@@ -162,9 +162,9 @@ function update {
162162 }
163163
164164 # Remember, as of now, only nuget actually supports the -Destination flag
165- foreach ($Package in ([xml ](gc .\packages.config)).packages.package) {
165+ foreach ($Package in ([xml ](Get-Content .\packages.config)).packages.package) {
166166 Trace-Message " Installing $ ( $Package.id ) v$ ( $Package.version ) from $ ( $Package.Source ) "
167- $install = Install-Package - Name $Package.id - RequiredVersion $Package.version - Source $Package.Source - Destination $Path \packages - Force:$Force - ErrorVariable failure
167+ $null = Install-Package - Name $Package.id - RequiredVersion $Package.version - Source $Package.Source - Destination $Path \packages - Force:$Force - ErrorVariable failure
168168 if ($failure ) {
169169 throw " Failed to install $ ( $package.id ) , see errors above."
170170 }
@@ -196,7 +196,7 @@ function build {
196196 $targets = ($TargetFramework -replace ' ^' , ' lib\' ) + ' lib' | ForEach-Object { Join-Path $folder $_ }
197197 }
198198
199- $PackageSource = Get-Item $targets - ErrorAction SilentlyContinue | Select - First 1 - Expand FullName
199+ $PackageSource = Get-Item $targets - ErrorAction SilentlyContinue | Select-Object - First 1 - Expand FullName
200200 if (! $PackageSource ) {
201201 throw " Could not find a lib folder for $ ( $Package.id ) from package. You may need to run Setup.ps1"
202202 }
@@ -231,7 +231,7 @@ function build {
231231 $ReleaseModule = Join-Path $ReleasePath ${RootModule}
232232 Trace-Message " Setting content for $ReleaseModule "
233233
234- $FunctionsToExport = Join-Path $SourcePath Public\* .ps1 - Resolve | % { [System.IO.Path ]::GetFileNameWithoutExtension($_ ) }
234+ $FunctionsToExport = Join-Path $SourcePath Public\* .ps1 - Resolve | ForEach-Object { [System.IO.Path ]::GetFileNameWithoutExtension($_ ) }
235235 Set-Content $ReleaseModule ((
236236 (Get-Content (Join-Path $SourcePath Private\* .ps1) - Raw) +
237237 (Get-Content (Join-Path $SourcePath Public\* .ps1) - Raw)) -join " `r`n`r`n`r`n " ) - Encoding UTF8
@@ -243,7 +243,7 @@ function build {
243243
244244 # Finally, we need to copy any files in the Source directory
245245 Get-ChildItem $SourcePath - File |
246- Where Name -ne $RootModule |
246+ Where-Object Name -ne $RootModule |
247247 Copy-Item - Destination $ReleasePath
248248
249249 Update-Manifest $ReleaseManifest - Property FunctionsToExport - Value $FunctionsToExport
0 commit comments