Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit aec1d27

Browse files
lazywinadminbmanikm
authored andcommitted
Expand some Aliases (#338)
1 parent 94a35b8 commit aec1d27

7 files changed

Lines changed: 24 additions & 24 deletions

File tree

PowerShellGet/private/functions/Get-PrivateData.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ function Get-PrivateData
4444

4545

4646
#Validate each of the property of PSData is of the desired data type
47-
$Tags= $PrivateData["Tags"] -join "','" | %{"'$_'"}
48-
$LicenseUri = $PrivateData["LicenseUri"]| %{"'$_'"}
49-
$ProjectUri = $PrivateData["ProjectUri"] | %{"'$_'"}
50-
$IconUri = $PrivateData["IconUri"] | %{"'$_'"}
47+
$Tags= $PrivateData["Tags"] -join "','" | Foreach-Object {"'$_'"}
48+
$LicenseUri = $PrivateData["LicenseUri"]| Foreach-Object {"'$_'"}
49+
$ProjectUri = $PrivateData["ProjectUri"] | Foreach-Object {"'$_'"}
50+
$IconUri = $PrivateData["IconUri"] | Foreach-Object {"'$_'"}
5151
$ReleaseNotesEscape = $PrivateData["ReleaseNotes"] -Replace "'","''"
52-
$ReleaseNotes = $ReleaseNotesEscape | %{"'$_'"}
53-
$Prerelease = $PrivateData[$script:Prerelease] | %{"'$_'"}
52+
$ReleaseNotes = $ReleaseNotesEscape | Foreach-Object {"'$_'"}
53+
$Prerelease = $PrivateData[$script:Prerelease] | Foreach-Object {"'$_'"}
5454
$RequireLicenseAcceptance = $PrivateData["RequireLicenseAcceptance"]
55-
$ExternalModuleDependencies = $PrivateData["ExternalModuleDependencies"] -join "','" | %{"'$_'"}
55+
$ExternalModuleDependencies = $PrivateData["ExternalModuleDependencies"] -join "','" | Foreach-Object {"'$_'"}
5656
$DefaultProperties = @("Tags","LicenseUri","ProjectUri","IconUri","ReleaseNotes",$script:Prerelease,"ExternalModuleDependencies","RequireLicenseAcceptance")
5757

5858
$ExtraProperties = @()
@@ -65,7 +65,7 @@ function Get-PrivateData
6565
if(($PrivateData[$key]).GetType().IsArray)
6666
{
6767
$PropertyString += $key +" = " +" @("
68-
$PrivateData[$key] | % { $PropertyString += "'" + $_ +"'" + "," }
68+
$PrivateData[$key] | Foreach-Object { $PropertyString += "'" + $_ +"'" + "," }
6969
if($PrivateData[$key].Length -ge 1)
7070
{
7171
#Remove extra ,

PowerShellGet/public/providerfunctions/Find-Package.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ function Find-Package
431431
}
432432

433433
# $pkg.Name has to match any of the supplied names, using PowerShell wildcards
434-
if ($namesParameterEmpty -or ($names | % { if ($pkg.Name -like $_){return $true; break} } -End {return $false}))
434+
if ($namesParameterEmpty -or ($names | Foreach-Object { if ($pkg.Name -like $_){return $true; break} } -End {return $false}))
435435
{
436436
$includePackage = $true
437437

Tests/Asserts.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function NewException
4646
)
4747

4848
$callstack = get-pscallstack
49-
$callStackStr = CallStackToString ($callstack | select -skip 1);
49+
$callStackStr = CallStackToString ($callstack | Select-Object -skip 1);
5050
$errMessage = $message;
5151
$exception = new-object System.Management.Automation.RuntimeException $errMessage;
5252
$exception.Data['PSCallStack'] = $callstack;

Tests/PSGetPublishModule.Tests.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ Describe PowerShell.PSGet.PublishModuleTests.P1 -Tags 'P1','OuterLoop' {
17741774
$version = "1.0"
17751775

17761776
# Module dependencies should be available under PSModulePath other Test-ModuleManifest will fail.
1777-
$RequiredModuleDep, $NestedModuleDep, $ExternalRequiredModuleDep, $ExternalNestedModuleDep | %{
1777+
$RequiredModuleDep, $NestedModuleDep, $ExternalRequiredModuleDep, $ExternalNestedModuleDep | Foreach-Object {
17781778
$DepModuleBase = Join-Path $script:ProgramFilesModulesPath $_
17791779
$null = New-Item -Path $DepModuleBase -ItemType Directory -Force
17801780
New-ModuleManifest -Path (Join-Path $DepModuleBase "$_.psd1") `
@@ -1818,7 +1818,7 @@ Describe PowerShell.PSGet.PublishModuleTests.P1 -Tags 'P1','OuterLoop' {
18181818
}
18191819
finally
18201820
{
1821-
$ModuleName, $RequiredModuleDep, $NestedModuleDep, $ExternalRequiredModuleDep, $ExternalNestedModuleDep | % { PSGetTestUtils\Uninstall-Module -Name $_ }
1821+
$ModuleName, $RequiredModuleDep, $NestedModuleDep, $ExternalRequiredModuleDep, $ExternalNestedModuleDep | Foreach-Object { PSGetTestUtils\Uninstall-Module -Name $_ }
18221822
}
18231823
}
18241824
}
@@ -1986,7 +1986,7 @@ Describe PowerShell.PSGet.PublishModuleTests.P2 -Tags 'P2','OuterLoop' {
19861986
$version = "1.0.0"
19871987

19881988
# Module dependencies should be available under PSModulePath other Test-ModuleManifest will fail.
1989-
$RequiredModuleDep, $NestedModuleDep, $ExternalRequiredModuleDep, $ExternalNestedModuleDep | %{
1989+
$RequiredModuleDep, $NestedModuleDep, $ExternalRequiredModuleDep, $ExternalNestedModuleDep | Foreach-Object {
19901990
$DepModuleBase = Join-Path $script:ProgramFilesModulesPath $_
19911991
$null = New-Item -Path $DepModuleBase -ItemType Directory -Force
19921992
New-ModuleManifest -Path (Join-Path $DepModuleBase "$_.psd1") `
@@ -2039,7 +2039,7 @@ Describe PowerShell.PSGet.PublishModuleTests.P2 -Tags 'P2','OuterLoop' {
20392039
}
20402040
finally
20412041
{
2042-
$ModuleName, $RequiredModuleDep, $NestedModuleDep | % { PSGetTestUtils\Uninstall-Module -Name $_ }
2042+
$ModuleName, $RequiredModuleDep, $NestedModuleDep | Foreach-Object { PSGetTestUtils\Uninstall-Module -Name $_ }
20432043
}
20442044

20452045
try
@@ -2063,7 +2063,7 @@ Describe PowerShell.PSGet.PublishModuleTests.P2 -Tags 'P2','OuterLoop' {
20632063
}
20642064
finally
20652065
{
2066-
$ModuleName, $RequiredModuleDep, $NestedModuleDep, $ExternalRequiredModuleDep, $ExternalNestedModuleDep | % { PSGetTestUtils\Uninstall-Module -Name $_ }
2066+
$ModuleName, $RequiredModuleDep, $NestedModuleDep, $ExternalRequiredModuleDep, $ExternalNestedModuleDep | Foreach-Object { PSGetTestUtils\Uninstall-Module -Name $_ }
20672067
}
20682068

20692069
# WarningVariable value doesnt get the warning messages on PS 3.0 and 4.0, known issue.
@@ -2093,7 +2093,7 @@ Describe PowerShell.PSGet.PublishModuleTests.P2 -Tags 'P2','OuterLoop' {
20932093
}
20942094
finally
20952095
{
2096-
$ModuleName, $RequiredModuleDep, $NestedModuleDep, $ExternalRequiredModuleDep, $ExternalNestedModuleDep | % { PSGetTestUtils\Uninstall-Module -Name $_ }
2096+
$ModuleName, $RequiredModuleDep, $NestedModuleDep, $ExternalRequiredModuleDep, $ExternalNestedModuleDep | Foreach-Object { PSGetTestUtils\Uninstall-Module -Name $_ }
20972097
}
20982098
}
20992099
}

Tests/PSGetTestUtils.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ function Uninstall-Module
10601060
$Name
10611061
)
10621062

1063-
Get-Module $Name -ListAvailable | %{
1063+
Get-Module $Name -ListAvailable | Foreach-Object {
10641064

10651065
Remove-Module $_ -Force -ErrorAction SilentlyContinue;
10661066

Tests/PSGetTests.Generators.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function Get-FindModuleParameterSets {
55

66
$testParameterSets = @()
77

8-
$variations | %{
8+
$variations | Foreach-Object {
99

1010
$FindModuleInputParameters = [ordered]@{}
1111
if($_.Name) {$FindModuleInputParameters['Name']=$_.Name}
@@ -37,7 +37,7 @@ function Get-FindModuleWithSourcesParameterSets {
3737

3838
$testParameterSets = @()
3939

40-
$variations | %{
40+
$variations | Foreach-Object {
4141
if(-not ($_.Source -like "http*"))
4242
{
4343
$testParameterSets += @{
@@ -60,7 +60,7 @@ function Get-InstallModuleWithSourcesParameterSets {
6060

6161
$testParameterSets = @()
6262

63-
$variations | %{
63+
$variations | Foreach-Object {
6464
if(-not ($_.Source -like "http*"))
6565
{
6666
$testParameterSets += @{

tools/build.psm1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,15 @@ function Invoke-PowerShellGetTest {
245245
$env:PSModulePath;
246246
247247
# Current Process
248-
$ValueWithUniqueEntries = ([System.Environment]::GetEnvironmentVariable('PSModulePath', [System.EnvironmentVariableTarget]::Process) -split ';' | %{$_.Trim('\\')} | Select-Object -Unique) -join ';'
248+
$ValueWithUniqueEntries = ([System.Environment]::GetEnvironmentVariable('PSModulePath', [System.EnvironmentVariableTarget]::Process) -split ';' | Foreach-Object {$_.Trim('\\')} | Select-Object -Unique) -join ';'
249249
[System.Environment]::SetEnvironmentVariable('PSModulePath', $ValueWithUniqueEntries, [System.EnvironmentVariableTarget]::Process)
250250
251251
# Current User
252-
$ValueWithUniqueEntries = ([System.Environment]::GetEnvironmentVariable('PSModulePath', [System.EnvironmentVariableTarget]::User) -split ';' | %{$_.Trim('\\')} | Select-Object -Unique) -join ';'
252+
$ValueWithUniqueEntries = ([System.Environment]::GetEnvironmentVariable('PSModulePath', [System.EnvironmentVariableTarget]::User) -split ';' | Foreach-Object {$_.Trim('\\')} | Select-Object -Unique) -join ';'
253253
[System.Environment]::SetEnvironmentVariable('PSModulePath', $ValueWithUniqueEntries, [System.EnvironmentVariableTarget]::User)
254254
255255
# Current Machine
256-
$ValueWithUniqueEntries = ([System.Environment]::GetEnvironmentVariable('PSModulePath', [System.EnvironmentVariableTarget]::Machine) -split ';' | %{$_.Trim('\\')} | Select-Object -Unique) -join ';'
256+
$ValueWithUniqueEntries = ([System.Environment]::GetEnvironmentVariable('PSModulePath', [System.EnvironmentVariableTarget]::Machine) -split ';' | Foreach-Object {$_.Trim('\\')} | Select-Object -Unique) -join ';'
257257
[System.Environment]::SetEnvironmentVariable('PSModulePath', $ValueWithUniqueEntries, [System.EnvironmentVariableTarget]::Machine)
258258
259259
Write-Host "PSModulePath value after removing the duplicate entries:"
@@ -265,7 +265,7 @@ function Invoke-PowerShellGetTest {
265265
Push-Location $PowerShellGetTestsPath
266266

267267
$TestResultsFile = Microsoft.PowerShell.Management\Join-Path -Path $PowerShellGetTestsPath -ChildPath "TestResults$TestScenario.xml"
268-
& $PowerShellExePath -Command "`$env:PSModulePath = (`$env:PSModulePath -split ';' | %{`$_.Trim('\\')} | Select-Object -Unique) -join ';' ;
268+
& $PowerShellExePath -Command "`$env:PSModulePath = (`$env:PSModulePath -split ';' | Foreach-Object {`$_.Trim('\\')} | Select-Object -Unique) -join ';' ;
269269
Write-Host 'After updating the PSModulePath value:' ;
270270
`$env:PSModulePath ;
271271
`$ProgressPreference = 'SilentlyContinue'

0 commit comments

Comments
 (0)