Skip to content

Commit

Permalink
Merge pull request #4 from santisq/3-$using-statements-require-lower-…
Browse files Browse the repository at this point in the history
…case

`$using` statements require lower case
  • Loading branch information
santisq authored Jan 2, 2023
2 parents 942d6bc + 08cb911 commit 4a6b473
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ondemand publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:

- name: Publish to Gallery
shell: pwsh
run: .\publish.ps1
run: .\publish.ps1 PSParallelPipeline
env:
PSGALLERY_TOKEN: ${{ secrets.PSGALLERY_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:

- name: Publish to Gallery
shell: pwsh
run: .\publish.ps1
run: .\publish.ps1 PSParallelPipeline
env:
PSGALLERY_TOKEN: ${{ secrets.PSGALLERY_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSParallelPipeline.psm1'

# Version number of this module.
ModuleVersion = '1.0.1'
ModuleVersion = '1.0.2'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ function Invoke-Parallel {

$usingParams = @{}

# Credits to mklement0 for catching up a bug here. Thank you!
# https://github.com/mklement0
foreach($usingstatement in $ScriptBlock.Ast.FindAll({ $args[0] -is [UsingExpressionAst] }, $true)) {
$varText = $usingstatement.Extent.Text
$varPath = $usingstatement.SubExpression.VariablePath.UserPath

# Credits to mklement0 for catching up a bug here. Thank you!
# https://github.com/mklement0
$key = [Convert]::ToBase64String([Encoding]::Unicode.GetBytes($varText))
$key = [Convert]::ToBase64String([Encoding]::Unicode.GetBytes($varText.ToLower()))
if(-not $usingParams.ContainsKey($key)) {
$usingParams.Add($key, $ExecutionContext.SessionState.PSVariable.Get($varPath).Value)
$usingParams.Add($key, $ExecutionContext.SessionState.PSVariable.GetValue($varPath))
}
}

Expand All @@ -177,7 +177,8 @@ function Invoke-Parallel {
$args[0].InvokeWithContext($null, [psvariable]::new('_', $args[1]))
}).AddArgument($ScriptBlock.Ast.GetScriptBlock()).AddArgument($InputObject)

# This is how `Start-Job` does it's magic. Credits to Jordan Borean for his help here.
# This is how `Start-Job` does it's magic.
# Credits to Jordan Borean for his help here.
# https://github.com/jborean93

# Reference in the source code:
Expand Down
5 changes: 4 additions & 1 deletion publish.ps1
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Publish-Module -Path $PSScriptRoot -NuGetApiKey $env:PSGALLERY_TOKEN
param([string] $ModuleName)

$path = Join-Path $PSScriptRoot -ChildPath $ModuleName
Publish-Module -Path $path -NuGetApiKey $env:PSGALLERY_TOKEN

0 comments on commit 4a6b473

Please sign in to comment.