Skip to content

Commit d63b7d6

Browse files
authored
chore(release): Bump to version 0.2.1
2 parents 7e6be8f + ecb8f02 commit d63b7d6

31 files changed

+341
-258
lines changed

CHANGELOG.md

+33
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
## [v0.2.1](https://github.com/ScoopInstaller/Scoop/compare/v0.2.0...v0.2.1) - 2022-06-10
2+
3+
### Features
4+
5+
- **core:** Add pre_uninstall and post_uninstall hooks ([#4957](https://github.com/ScoopInstaller/Scoop/issues/4957), [#4962](https://github.com/ScoopInstaller/Scoop/issues/4962))
6+
7+
### Bug Fixes
8+
9+
- **bucket:** Make sure `list_buckets` return array ([#4979](https://github.com/ScoopInstaller/Scoop/issues/4979))
10+
- **chore:** Deprecate tls1 and tls1.1 ([#4950](https://github.com/ScoopInstaller/Scoop/issues/4950))
11+
- **chore:** Update Nonportable bucket URL ([#4955](https://github.com/ScoopInstaller/Scoop/issues/4955))
12+
- **core:** Using `Invoke-Command` instead of `Invoke-Expression` ([#4941](https://github.com/ScoopInstaller/Scoop/issues/4941))
13+
- **core:** Load config file before initialization ([#4932](https://github.com/ScoopInstaller/Scoop/issues/4932))
14+
- **core:** Allow to use '_' and '.' in bucket name ([#4952](https://github.com/ScoopInstaller/Scoop/issues/4952))
15+
- **depends:** Avoid digits in archive file extension (except for .7z and .001) ([#4915](https://github.com/ScoopInstaller/Scoop/issues/4915))
16+
- **bucket:** Don't check remote URL of non-git buckets ([#4923](https://github.com/ScoopInstaller/Scoop/issues/4923))
17+
- **bucket:** Don't write message OK before bucket is cloned ([#4925](https://github.com/ScoopInstaller/Scoop/issues/4925))
18+
- **shim:** Add 'Get-CommandPath()' to find git ([#4913](https://github.com/ScoopInstaller/Scoop/issues/4913))
19+
- **shim:** Remove character replacement in .cmd -> .ps1 shims ([#4914](https://github.com/ScoopInstaller/Scoop/issues/4914))
20+
- **scoop:** Pass CLI arguments as string objects ([#4931](https://github.com/ScoopInstaller/Scoop/issues/4931))
21+
- **scoop-info:** Fix error message when manifest is not found ([#4935](https://github.com/ScoopInstaller/Scoop/issues/4935))
22+
- **scoop-search:** Require files in 'bucket' dir for remote known buckets ([#4944](https://github.com/ScoopInstaller/Scoop/issues/4944))
23+
- **update:** Prevent uninstall when update ([#4949](https://github.com/ScoopInstaller/Scoop/issues/4949))
24+
- **scoop-download:** Use correct Args when calling `Get-Manifest` ([#4970](https://github.com/ScoopInstaller/Scoop/issues/4970))
25+
26+
### Code Refactoring
27+
28+
- **manifest:** Rename 'Find-Manifest()' to 'Get-Manifest() ([#4966](https://github.com/ScoopInstaller/Scoop/issues/4966), [#4981](https://github.com/ScoopInstaller/Scoop/issues/4981))
29+
30+
### Documentation
31+
32+
- **readme:** Update license badge ([#4929](https://github.com/ScoopInstaller/Scoop/issues/4929))
33+
134
## [v0.2.0](https://github.com/ScoopInstaller/Scoop/compare/v0.1.0...v0.2.0) - 2022-05-10
235

336
### Features

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
<a href="https://gitter.im/lukesampson/scoop">
2828
<img src="https://badges.gitter.im/lukesampson/scoop.png" alt="Gitter Chat" />
2929
</a>
30-
<a href="https://github.com/ScoopInstaller/Scoop/blob/master/LICENSE">
31-
<img src="https://img.shields.io/github/license/ScoopInstaller/Scoop.svg" alt="License" />
30+
<a href="./LICENSE">
31+
<img src="https://img.shields.io/badge/license-UNLICENSE%20or%20MIT-blue" alt="License" />
3232
</a>
3333
</p>
3434

@@ -121,7 +121,7 @@ The following buckets are known to scoop:
121121
- [nerd-fonts](https://github.com/matthewjberger/scoop-nerd-fonts) - Nerd Fonts
122122
- [nirsoft](https://github.com/kodybrown/scoop-nirsoft) - Almost all of the [250+](https://rasa.github.io/scoop-directory/by-apps#kodybrown_scoop-nirsoft) apps from [Nirsoft](https://nirsoft.net)
123123
- [java](https://github.com/ScoopInstaller/Java) - A collection of Java development kits (JDKs), Java runtime engines (JREs), Java's virtual machine debugging tools and Java based runtime engines.
124-
- [nonportable](https://github.com/TheRandomLabs/scoop-nonportable) - Non-portable apps (may require UAC)
124+
- [nonportable](https://github.com/ScoopInstaller/Nonportable) - Non-portable apps (may require UAC)
125125
- [php](https://github.com/ScoopInstaller/PHP) - Installers for most versions of PHP
126126
- [versions](https://github.com/ScoopInstaller/Versions) - Alternative versions of apps found in other buckets
127127

bin/auto-pr.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ if (is_unix) {
9696

9797
function execute($cmd) {
9898
Write-Host $cmd -ForegroundColor Green
99-
$output = Invoke-Expression $cmd
99+
$output = Invoke-Command ([scriptblock]::Create($cmd))
100100

101101
if ($LASTEXITCODE -gt 0) {
102102
abort "^^^ Error! See above ^^^ (last command: $cmd)"

bin/checkver.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ while ($in_progress -gt 0) {
221221
$page = $ev.SourceEventArgs.Result
222222
$err = $ev.SourceEventArgs.Error
223223
if ($json.checkver.script) {
224-
$page = $json.checkver.script -join "`r`n" | Invoke-Expression
224+
$page = Invoke-Command ([scriptblock]::Create($json.checkver.script -join "`r`n"))
225225
}
226226

227227
if ($err) {

bin/scoop.ps1

+15-18
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
#Requires -Version 5
2-
param($SubCommand)
3-
42
Set-StrictMode -Off
53

64
. "$PSScriptRoot\..\lib\core.ps1"
75
. "$PSScriptRoot\..\lib\buckets.ps1"
86
. "$PSScriptRoot\..\lib\commands.ps1"
97
. "$PSScriptRoot\..\lib\help.ps1"
108

9+
$subCommand = $Args[0]
10+
1111
# for aliases where there's a local function, re-alias so the function takes precedence
1212
$aliases = Get-Alias | Where-Object { $_.Options -notmatch 'ReadOnly|AllScope' } | ForEach-Object { $_.Name }
1313
Get-ChildItem Function: | Where-Object -Property Name -In -Value $aliases | ForEach-Object {
1414
Set-Alias -Name $_.Name -Value Local:$($_.Name) -Scope Script
1515
}
1616

17-
switch ($SubCommand) {
18-
({ $SubCommand -in @($null, '--help', '/?') }) {
19-
if (!$SubCommand -and $Args -eq '-v') {
20-
$SubCommand = '--version'
21-
} else {
22-
exec 'help'
23-
}
17+
switch ($subCommand) {
18+
({ $subCommand -in @($null, '-h', '--help', '/?') }) {
19+
exec 'help'
2420
}
25-
({ $SubCommand -eq '--version' }) {
21+
({ $subCommand -in @('-v', '--version') }) {
2622
Write-Host 'Current Scoop version:'
2723
if ((Test-CommandAvailable git) -and (Test-Path "$PSScriptRoot\..\.git") -and (get_config SCOOP_BRANCH 'master') -ne 'master') {
28-
Invoke-Expression "git -C '$PSScriptRoot\..' --no-pager log --oneline HEAD -n 1"
24+
git -C "$PSScriptRoot\.." --no-pager log --oneline HEAD -n 1
2925
} else {
3026
$version = Select-String -Pattern '^## \[(v[\d.]+)\].*?([\d-]+)$' -Path "$PSScriptRoot\..\CHANGELOG.md"
3127
Write-Host $version.Matches.Groups[1].Value -ForegroundColor Cyan -NoNewline
@@ -35,22 +31,23 @@ switch ($SubCommand) {
3531

3632
Get-LocalBucket | ForEach-Object {
3733
$bucketLoc = Find-BucketDirectory $_ -Root
38-
if ((Test-Path (Join-Path $bucketLoc '.git')) -and (Test-CommandAvailable git)) {
34+
if ((Test-Path "$bucketLoc\.git") -and (Test-CommandAvailable git)) {
3935
Write-Host "'$_' bucket:"
40-
Invoke-Expression "git -C '$bucketLoc' --no-pager log --oneline HEAD -n 1"
36+
git -C "$bucketLoc" --no-pager log --oneline HEAD -n 1
4137
Write-Host ''
4238
}
4339
}
4440
}
45-
({ $SubCommand -in (commands) }) {
46-
if ($Args -in @('-h', '--help', '/?')) {
47-
exec 'help' @($SubCommand)
41+
({ $subCommand -in (commands) }) {
42+
[string[]]$arguments = $Args | Select-Object -Skip 1
43+
if ($null -ne $arguments -and $arguments[0] -in @('-h', '--help', '/?')) {
44+
exec 'help' @($subCommand)
4845
} else {
49-
exec $SubCommand $Args
46+
exec $subCommand $arguments
5047
}
5148
}
5249
default {
53-
"scoop: '$SubCommand' isn't a scoop command. See 'scoop help'."
50+
"scoop: '$subCommand' isn't a scoop command. See 'scoop help'."
5451
exit 1
5552
}
5653
}

buckets.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"nirsoft": "https://github.com/kodybrown/scoop-nirsoft",
66
"php": "https://github.com/ScoopInstaller/PHP",
77
"nerd-fonts": "https://github.com/matthewjberger/scoop-nerd-fonts",
8-
"nonportable": "https://github.com/TheRandomLabs/scoop-nonportable",
8+
"nonportable": "https://github.com/ScoopInstaller/Nonportable",
99
"java": "https://github.com/ScoopInstaller/Java",
1010
"games": "https://github.com/Calinou/scoop-games"
1111
}

lib/buckets.ps1

+11-42
Original file line numberDiff line numberDiff line change
@@ -72,43 +72,11 @@ function buckets {
7272
return Get-LocalBucket
7373
}
7474

75-
function Find-Manifest($app, $bucket) {
76-
$manifest, $url = $null, $null
77-
78-
# check if app is a URL or UNC path
79-
if ($app -match '^(ht|f)tps?://|\\\\') {
80-
$url = $app
81-
$app = appname_from_url $url
82-
$manifest = url_manifest $url
83-
} else {
84-
if ($bucket) {
85-
$manifest = manifest $app $bucket
86-
} else {
87-
foreach ($bucket in Get-LocalBucket) {
88-
$manifest = manifest $app $bucket
89-
if ($manifest) { break }
90-
}
91-
}
92-
93-
if (!$manifest) {
94-
# couldn't find app in buckets: check if it's a local path
95-
$path = $app
96-
if (!$path.endswith('.json')) { $path += '.json' }
97-
if (Test-Path $path) {
98-
$url = "$(Resolve-Path $path)"
99-
$app = appname_from_url $url
100-
$manifest, $bucket = url_manifest $url
101-
}
102-
}
103-
}
104-
105-
return $app, $manifest, $bucket, $url
106-
}
107-
10875
function Convert-RepositoryUri {
10976
[CmdletBinding()]
11077
param (
11178
[Parameter(Mandatory, Position = 0, ValueFromPipeline = $true)]
79+
[AllowEmptyString()]
11280
[String] $Uri
11381
)
11482

@@ -141,7 +109,7 @@ function list_buckets {
141109
Measure-Object | Select-Object -ExpandProperty Count
142110
$buckets += [PSCustomObject]$bucket
143111
}
144-
$buckets
112+
,$buckets
145113
}
146114

147115
function add_bucket($name, $repo) {
@@ -161,10 +129,12 @@ function add_bucket($name, $repo) {
161129
return 1
162130
}
163131
foreach ($bucket in Get-LocalBucket) {
164-
$remote = git -C "$bucketsdir\$bucket" config --get remote.origin.url
165-
if ((Convert-RepositoryUri -Uri $remote) -eq $uni_repo) {
166-
warn "Bucket $bucket already exists for $repo"
167-
return 2
132+
if (Test-Path -Path "$bucketsdir\$bucket\.git") {
133+
$remote = git -C "$bucketsdir\$bucket" config --get remote.origin.url
134+
if ((Convert-RepositoryUri -Uri $remote) -eq $uni_repo) {
135+
warn "Bucket $bucket already exists for $repo"
136+
return 2
137+
}
168138
}
169139
}
170140

@@ -174,11 +144,10 @@ function add_bucket($name, $repo) {
174144
error "'$repo' doesn't look like a valid git repository`n`nError given:`n$out"
175145
return 1
176146
}
177-
Write-Host 'OK'
178-
179147
ensure $bucketsdir | Out-Null
180148
$dir = ensure $dir
181149
git_cmd clone "$repo" "`"$dir`"" -q
150+
Write-Host 'OK'
182151
success "The $name bucket was added successfully."
183152
return 0
184153
}
@@ -195,12 +164,12 @@ function rm_bucket($name) {
195164
}
196165

197166
function new_issue_msg($app, $bucket, $title, $body) {
198-
$app, $manifest, $bucket, $url = Find-Manifest $app $bucket
167+
$app, $manifest, $bucket, $url = Get-Manifest "$bucket/$app"
199168
$url = known_bucket_repo $bucket
200169
$bucket_path = "$bucketsdir\$bucket"
201170

202171
if (Test-Path $bucket_path) {
203-
$remote = Invoke-Expression "git -C '$bucket_path' config --get remote.origin.url"
172+
$remote = git -C "$bucket_path" config --get remote.origin.url
204173
# Support ssh and http syntax
205174
# git@PROVIDER:USER/REPO.git
206175
# https://PROVIDER/USER/REPO.git

lib/commands.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function command_path($cmd) {
2020
$shim_path = "$scoopdir\shims\scoop-$cmd.ps1"
2121
$line = ((Get-Content $shim_path) | Where-Object { $_.startswith('$path') })
2222
if($line) {
23-
Invoke-Expression -command "$line"
23+
Invoke-Command ([scriptblock]::Create($line)) -NoNewScope
2424
$cmd_path = $path
2525
}
2626
else { $cmd_path = $shim_path }

0 commit comments

Comments
 (0)