diff --git a/CHANGELOG.md b/CHANGELOG.md index c43e60f9ff..3d8ef677ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ ### Builds +- **checkver,auto-pr:** Allow passing file path ([#5019](https://github.com/ScoopInstaller/Scoop/issues/5019)) - **checkver:** Exit routine earlier if error ([#5025](https://github.com/ScoopInstaller/Scoop/issues/5025)) ### Tests diff --git a/bin/auto-pr.ps1 b/bin/auto-pr.ps1 index 147f635bfe..b44f760c4d 100644 --- a/bin/auto-pr.ps1 +++ b/bin/auto-pr.ps1 @@ -43,7 +43,6 @@ param( [String] $Upstream, [String] $OriginBranch = 'master', [String] $App = '*', - [Parameter(Mandatory = $true)] [ValidateScript( { if (!(Test-Path $_ -Type Container)) { throw "$_ is not a directory!" @@ -64,7 +63,13 @@ param( . "$PSScriptRoot\..\lib\json.ps1" . "$PSScriptRoot\..\lib\unix.ps1" -$Dir = Resolve-Path $Dir +if ($App -ne '*' -and (Test-Path $App -PathType Leaf)) { + $Dir = Split-Path $App +} elseif ($Dir) { + $Dir = Resolve-Path $Dir +} else { + throw "'-Dir' parameter required if '-App' is not a filepath!" +} if ((!$Push -and !$Request) -or $Help) { Write-Host @' diff --git a/bin/checkver.ps1 b/bin/checkver.ps1 index b71bcf697e..1b2fb2033e 100644 --- a/bin/checkver.ps1 +++ b/bin/checkver.ps1 @@ -52,7 +52,6 @@ #> param( [String] $App = '*', - [Parameter(Mandatory = $true)] [ValidateScript( { if (!(Test-Path $_ -Type Container)) { throw "$_ is not a directory!" @@ -77,8 +76,16 @@ param( . "$PSScriptRoot\..\lib\install.ps1" # needed for hash generation . "$PSScriptRoot\..\lib\unix.ps1" -$Dir = Resolve-Path $Dir -$Search = $App +if ($App -ne '*' -and (Test-Path $App -PathType Leaf)) { + $Dir = Split-Path $App + $files = Get-ChildItem $Dir (Split-Path $App -Leaf) +} elseif ($Dir) { + $Dir = Resolve-Path $Dir + $files = Get-ChildItem $Dir "$App.json" +} else { + throw "'-Dir' parameter required if '-App' is not a filepath!" +} + $GitHubToken = Get-GitHubToken # don't use $Version with $App = '*' @@ -89,7 +96,7 @@ if ($App -eq '*' -and $Version -ne '') { # get apps to check $Queue = @() $json = '' -Get-ChildItem $Dir "$App.json" | ForEach-Object { +$files | ForEach-Object { $json = parse_json "$Dir\$($_.Name)" if ($json.checkver) { $Queue += , @($_.Name, $json) @@ -97,9 +104,8 @@ Get-ChildItem $Dir "$App.json" | ForEach-Object { } # clear any existing events -Get-Event | ForEach-Object { - Remove-Event $_.SourceIdentifier -} +Get-Event | Remove-Event +Get-EventSubscriber | Unregister-Event # start all downloads $Queue | ForEach-Object {