Skip to content

Commit 8aee6f9

Browse files
niheavenrashil2000r15ch13se35710yi-Xu-0100
authored
chore(release): Bump to version 0.3.0
Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com> Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com> Co-authored-by: Richard Kuhnt <r15ch13+git@gmail.com> Co-authored-by: Mathias Hermansson <mathias.hermansson@se.ibm.com> Co-authored-by: yi_Xu <yi_Xu@yixuju.cn> Co-authored-by: Chawye Hsu <chawyehsu@hotmail.com> Co-authored-by: L. Yeung <lewis_yeung-ly@outlook.com> Co-authored-by: AkariiinMKII <6019344+AkariiinMKII@users.noreply.github.com> Co-authored-by: KOGA Mitsuhiro <shiena.jp+github@gmail.com> Co-authored-by: Jules <jules+dev@simplelogin.com> Co-authored-by: César Román <thecesrom@gmail.com>
2 parents 4a31bd3 + 9baf293 commit 8aee6f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+794
-453
lines changed

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ labels: "bug"
3131

3232
### System details
3333

34-
**Windows version:** [e.g. 7, 8, 10]
34+
**Windows version:** [e.g. 7, 8, 10, 11]
3535

36-
**OS architecture:** [e.g. 32bit, 64bit]
36+
**OS architecture:** [e.g. 32bit, 64bit, arm64]
3737

3838
**PowerShell version:** [output of `"$($PSVersionTable.PSVersion)"`]
3939

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
*.log
12
.DS_Store
23
._.DS_Store
34
scoop.sublime-workspace

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"powershell.codeFormatting.preset": "OTBS",
55
"powershell.codeFormatting.alignPropertyValuePairs": true,
66
"powershell.codeFormatting.ignoreOneLineBlock": true,
7+
"powershell.codeFormatting.useConstantStrings": true,
8+
"powershell.codeFormatting.useCorrectCasing": true,
9+
"powershell.codeFormatting.whitespaceBetweenParameters": true,
710
"files.exclude": {
811
"**/.git": true,
912
"**/.svn": true,

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
## [v0.3.0](https://github.com/ScoopInstaller/Scoop/compare/v0.2.4...v0.3.0) - 2022-10-10
2+
3+
### Features
4+
5+
- **install:** Add support for ARM64 architecture ([#5154](https://github.com/ScoopInstaller/Scoop/issues/5154))
6+
- **install:** Show the running process ([#5102](https://github.com/ScoopInstaller/Scoop/issues/5102))
7+
- **getopt:** Support option terminator (`--`) ([#5121](https://github.com/ScoopInstaller/Scoop/issues/5121))
8+
- **subdir:** Allow subdir in 'bucket' ([#5119](https://github.com/ScoopInstaller/Scoop/issues/5119))
9+
- **scoop-config:** Allow 'hold_update_until' be set manually ([#5100](https://github.com/ScoopInstaller/Scoop/issues/5100))
10+
- **scoop-(un)hold:** Support `scoop (un)hold scoop` ([#5089](https://github.com/ScoopInstaller/Scoop/issues/5089))
11+
- **scoop-update:** Stash uncommitted changes before update ([#5091](https://github.com/ScoopInstaller/Scoop/issues/5091))
12+
13+
### Bug Fixes
14+
15+
- **config:** Change config option to snake_case in file and SCREAMING_CASE in code ([#5116](https://github.com/ScoopInstaller/Scoop/issues/5116))
16+
- **jsonpath:** Prevent converting date string to DateTime in JSONPath ([#5130](https://github.com/ScoopInstaller/Scoop/issues/5130))
17+
- **psmodule:** Remove folder recursively when unlinking previous module path ([#5127](https://github.com/ScoopInstaller/Scoop/issues/5127))
18+
- **scoop-update:** Add `uninstall_psmodule` to update process ([#5136](https://github.com/ScoopInstaller/Scoop/issues/5136))
19+
20+
### Code Refactoring
21+
22+
- **download:** Rename `dl()` to `Invoke-Download()` ([#5143](https://github.com/ScoopInstaller/Scoop/issues/5143))
23+
- **path:** Use 'Convert-Path()' instead of 'Resolve-Path()' ([#5109](https://github.com/ScoopInstaller/Scoop/issues/5109))
24+
- **scoop-shim:** Use `getopt` to parse arguments ([#5125](https://github.com/ScoopInstaller/Scoop/issues/5125))
25+
26+
### Builds
27+
28+
- **checkver:** Implement SourceForge checkver functionality ([#5113](https://github.com/ScoopInstaller/Scoop/issues/5113), [#5163](https://github.com/ScoopInstaller/Scoop/issues/5163))
29+
- **checkurls:** Allow checking URLs from private_hosts ([#5152](https://github.com/ScoopInstaller/Scoop/issues/5152))
30+
- **schema:** Set manifest schema to be stricter ([#5093](https://github.com/ScoopInstaller/Scoop/issues/5093))
31+
- **vscode:** Tweak VSCode setting ([#5149](https://github.com/ScoopInstaller/Scoop/issues/5149))
32+
133
## [v0.2.4](https://github.com/ScoopInstaller/Scoop/compare/v0.2.3...v0.2.4) - 2022-08-08
234

335
### Features

bin/auto-pr.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ param(
6666
if ($App -ne '*' -and (Test-Path $App -PathType Leaf)) {
6767
$Dir = Split-Path $App
6868
} elseif ($Dir) {
69-
$Dir = Resolve-Path $Dir
69+
$Dir = Convert-Path $Dir
7070
} else {
7171
throw "'-Dir' parameter required if '-App' is not a filepath!"
7272
}

bin/checkhashes.ps1

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ param(
4949
. "$PSScriptRoot\..\lib\install.ps1"
5050
. "$PSScriptRoot\..\lib\unix.ps1"
5151

52-
$Dir = Resolve-Path $Dir
52+
$Dir = Convert-Path $Dir
5353
if ($ForceUpdate) { $Update = $true }
5454
# Cleanup
5555
if (!$UseCache) { Remove-Item "$cachedir\*HASH_CHECK*" -Force }
@@ -60,9 +60,10 @@ function err ([String] $name, [String[]] $message) {
6060
}
6161

6262
$MANIFESTS = @()
63-
foreach ($single in Get-ChildItem $Dir "$App.json") {
64-
$name = (strip_ext $single.Name)
65-
$manifest = parse_json "$Dir\$($single.Name)"
63+
foreach ($single in Get-ChildItem $Dir -Filter "$App.json" -Recurse) {
64+
$name = $single.BaseName
65+
$file = $single.FullName
66+
$manifest = parse_json $file
6667

6768
# Skip nighly manifests, since their hash validation is skipped
6869
if ($manifest.version -eq 'nightly') { continue }
@@ -79,6 +80,8 @@ foreach ($single in Get-ChildItem $Dir "$App.json") {
7980
hash $manifest '64bit' | ForEach-Object { $hashes += $_ }
8081
script:url $manifest '32bit' | ForEach-Object { $urls += $_ }
8182
hash $manifest '32bit' | ForEach-Object { $hashes += $_ }
83+
script:url $manifest 'arm64' | ForEach-Object { $urls += $_ }
84+
hash $manifest 'arm64' | ForEach-Object { $hashes += $_ }
8285
} else {
8386
err $name 'Manifest does not contain URL property.'
8487
continue
@@ -92,6 +95,7 @@ foreach ($single in Get-ChildItem $Dir "$App.json") {
9295

9396
$MANIFESTS += @{
9497
app = $name
98+
file = $file
9599
manifest = $manifest
96100
urls = $urls
97101
hashes = $hashes
@@ -113,7 +117,7 @@ foreach ($current in $MANIFESTS) {
113117
$version = 'HASH_CHECK'
114118
$tmp = $expected_hash -split ':'
115119

116-
dl_with_cache $current.app $version $_ $null $null -use_cache:$UseCache
120+
Invoke-CachedDownload $current.app $version $_ $null $null -use_cache:$UseCache
117121

118122
$to_check = fullpath (cache_path $current.app $version $_)
119123
$actual_hash = compute_hash $to_check $algorithm
@@ -158,23 +162,27 @@ foreach ($current in $MANIFESTS) {
158162
# Defaults to zero, don't know, which architecture is available
159163
$64bit_count = 0
160164
$32bit_count = 0
165+
$arm64_count = 0
161166

167+
# 64bit is get, donwloaded and added first
162168
if ($platforms.Contains('64bit')) {
163169
$64bit_count = $current.manifest.architecture.'64bit'.hash.Count
164-
# 64bit is get, donwloaded and added first
165170
$current.manifest.architecture.'64bit'.hash = $actuals[0..($64bit_count - 1)]
166171
}
167172
if ($platforms.Contains('32bit')) {
168173
$32bit_count = $current.manifest.architecture.'32bit'.hash.Count
169-
$max = $64bit_count + $32bit_count - 1 # Edge case if manifest contains 64bit and 32bit.
170-
$current.manifest.architecture.'32bit'.hash = $actuals[($64bit_count)..$max]
174+
$current.manifest.architecture.'32bit'.hash = $actuals[($64bit_count)..($64bit_count + $32bit_count - 1)]
175+
}
176+
if ($platforms.Contains('arm64')) {
177+
$arm64_count = $current.manifest.architecture.'arm64'.hash.Count
178+
$current.manifest.architecture.'arm64'.hash = $actuals[($64bit_count + $32bit_count)..($64bit_count + $32bit_count + $arm64_count - 1)]
171179
}
172180
}
173181

174182
Write-Host "Writing updated $($current.app) manifest" -ForegroundColor DarkGreen
175183

176184
$current.manifest = $current.manifest | ConvertToPrettyJson
177-
$path = Resolve-Path "$Dir\$($current.app).json"
185+
$path = Convert-Path $current.file
178186
[System.IO.File]::WriteAllLines($path, $current.manifest)
179187
}
180188
}

bin/checkurls.ps1

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ param(
3030
. "$PSScriptRoot\..\lib\manifest.ps1"
3131
. "$PSScriptRoot\..\lib\install.ps1"
3232

33-
$Dir = Resolve-Path $Dir
33+
$Dir = Convert-Path $Dir
3434
$Queue = @()
3535

36-
Get-ChildItem $Dir "$App.json" | ForEach-Object {
37-
$manifest = parse_json "$Dir\$($_.Name)"
38-
$Queue += , @($_.Name, $manifest)
36+
Get-ChildItem $Dir -Filter "$App.json" -Recurse | ForEach-Object {
37+
$manifest = parse_json $_.FullName
38+
$Queue += , @($_.BaseName, $manifest)
3939
}
4040

4141
Write-Host '[' -NoNewLine
@@ -62,6 +62,13 @@ function test_dl([String] $url, $cookies) {
6262
$wreq.Headers.Add('Cookie', (cookie_header $cookies))
6363
}
6464
}
65+
66+
get_config PRIVATE_HOSTS | Where-Object { $_ -ne $null -and $url -match $_.match } | ForEach-Object {
67+
(ConvertFrom-StringData -StringData $_.Headers).GetEnumerator() | ForEach-Object {
68+
$wreq.Headers[$_.Key] = $_.Value
69+
}
70+
}
71+
6572
$wres = $null
6673
try {
6774
$wres = $wreq.GetResponse()
@@ -91,6 +98,7 @@ foreach ($man in $Queue) {
9198
} else {
9299
script:url $manifest '64bit' | ForEach-Object { $urls += $_ }
93100
script:url $manifest '32bit' | ForEach-Object { $urls += $_ }
101+
script:url $manifest 'arm64' | ForEach-Object { $urls += $_ }
94102
}
95103

96104
$urls | ForEach-Object {
@@ -125,7 +133,7 @@ foreach ($man in $Queue) {
125133
Write-Host $failed -NoNewLine -ForegroundColor Red
126134
}
127135
Write-Host '] ' -NoNewLine
128-
Write-Host (strip_ext $name)
136+
Write-Host $name
129137

130138
$errors | ForEach-Object {
131139
Write-Host " > $_" -ForegroundColor DarkRed

bin/checkver.ps1

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ param(
7878

7979
if ($App -ne '*' -and (Test-Path $App -PathType Leaf)) {
8080
$Dir = Split-Path $App
81-
$files = Get-ChildItem $Dir (Split-Path $App -Leaf)
81+
$files = Get-ChildItem $Dir -Filter (Split-Path $App -Leaf)
8282
} elseif ($Dir) {
83-
$Dir = Resolve-Path $Dir
84-
$files = Get-ChildItem $Dir "$App.json"
83+
$Dir = Convert-Path $Dir
84+
$files = Get-ChildItem $Dir -Filter "$App.json" -Recurse
8585
} else {
8686
throw "'-Dir' parameter required if '-App' is not a filepath!"
8787
}
@@ -97,9 +97,10 @@ if ($App -eq '*' -and $Version -ne '') {
9797
$Queue = @()
9898
$json = ''
9999
$files | ForEach-Object {
100-
$json = parse_json "$Dir\$($_.Name)"
100+
$file = $_.FullName
101+
$json = parse_json $file
101102
if ($json.checkver) {
102-
$Queue += , @($_.Name, $json)
103+
$Queue += , @($_.BaseName, $json, $file)
103104
}
104105
}
105106

@@ -109,7 +110,7 @@ Get-EventSubscriber | Unregister-Event
109110

110111
# start all downloads
111112
$Queue | ForEach-Object {
112-
$name, $json = $_
113+
$name, $json, $file = $_
113114

114115
$substitutions = Get-VersionSubstitution $json.version # 'autoupdate.ps1'
115116

@@ -121,18 +122,32 @@ $Queue | ForEach-Object {
121122
}
122123
Register-ObjectEvent $wc downloadDataCompleted -ErrorAction Stop | Out-Null
123124

124-
$githubRegex = '\/releases\/tag\/(?:v|V)?([\d.]+)'
125-
126-
$url = $json.homepage
125+
# Not Specified
127126
if ($json.checkver.url) {
128127
$url = $json.checkver.url
128+
} else {
129+
$url = $json.homepage
130+
}
131+
132+
if ($json.checkver.re) {
133+
$regex = $json.checkver.re
134+
} elseif ($json.checkver.regex) {
135+
$regex = $json.checkver.regex
136+
} else {
137+
$regex = ''
129138
}
130-
$regex = ''
139+
131140
$jsonpath = ''
132141
$xpath = ''
133142
$replace = ''
134143
$useGithubAPI = $false
135144

145+
# GitHub
146+
if ($regex) {
147+
$githubRegex = $regex
148+
} else {
149+
$githubRegex = '/releases/tag/(?:v|V)?([\d.]+)'
150+
}
136151
if ($json.checkver -eq 'github') {
137152
if (!$json.homepage.StartsWith('https://github.com/')) {
138153
error "$name checkver expects the homepage to be a github repository"
@@ -148,11 +163,38 @@ $Queue | ForEach-Object {
148163
if ($json.checkver.PSObject.Properties.Count -eq 1) { $useGithubAPI = $true }
149164
}
150165

151-
if ($json.checkver.re) {
152-
$regex = $json.checkver.re
166+
# SourceForge
167+
if ($regex) {
168+
$sourceforgeRegex = $regex
169+
} else {
170+
$sourceforgeRegex = '(?!\.)([\d.]+)(?<=\d)'
153171
}
154-
if ($json.checkver.regex) {
155-
$regex = $json.checkver.regex
172+
if ($json.checkver -eq 'sourceforge') {
173+
if ($json.homepage -match '//(sourceforge|sf)\.net/projects/(?<project>[^/]+)(/files/(?<path>[^/]+))?|//(?<project>[^.]+)\.(sourceforge\.(net|io)|sf\.net)') {
174+
$project = $Matches['project']
175+
$path = $Matches['path']
176+
} else {
177+
$project = strip_ext $name
178+
}
179+
$url = "https://sourceforge.net/projects/$project/rss"
180+
if ($path) {
181+
$url = $url + '?path=/' + $path.TrimStart('/')
182+
}
183+
$regex = "CDATA\[/$path/.*?$sourceforgeRegex.*?\]".Replace('//', '/')
184+
}
185+
if ($json.checkver.sourceforge) {
186+
if ($json.checkver.sourceforge -is [System.String] -and $json.checkver.sourceforge -match '(?<project>[\w-]*)(/(?<path>.*))?') {
187+
$project = $Matches['project']
188+
$path = $Matches['path']
189+
} else {
190+
$project = $json.checkver.sourceforge.project
191+
$path = $json.checkver.sourceforge.path
192+
}
193+
$url = "https://sourceforge.net/projects/$project/rss"
194+
if ($path) {
195+
$url = $url + '?path=/' + $path.TrimStart('/')
196+
}
197+
$regex = "CDATA\[/$path/.*?$sourceforgeRegex.*?\]".Replace('//', '/')
156198
}
157199

158200
if ($json.checkver.jp) {
@@ -165,7 +207,7 @@ $Queue | ForEach-Object {
165207
$xpath = $json.checkver.xpath
166208
}
167209

168-
if ($json.checkver.replace -and $json.checkver.replace.GetType() -eq [System.String]) {
210+
if ($json.checkver.replace -is [System.String]) { # If `checkver` is [System.String], it has a method called `Replace`
169211
$replace = $json.checkver.replace
170212
}
171213

@@ -185,7 +227,8 @@ $Queue | ForEach-Object {
185227
$url = substitute $url $substitutions
186228

187229
$state = New-Object psobject @{
188-
app = (strip_ext $name);
230+
app = $name;
231+
file = $file;
189232
url = $url;
190233
regex = $regex;
191234
json = $json;
@@ -213,6 +256,7 @@ while ($in_progress -gt 0) {
213256

214257
$state = $ev.SourceEventArgs.UserState
215258
$app = $state.app
259+
$file = $state.file
216260
$json = $state.json
217261
$url = $state.url
218262
$regexp = $state.regex
@@ -319,7 +363,7 @@ while ($in_progress -gt 0) {
319363
# Skip actual only if versions are same and there is no -f
320364
if (($ver -eq $expected_ver) -and !$ForceUpdate -and $SkipUpdated) { continue }
321365

322-
Write-Host "$App`: " -NoNewline
366+
Write-Host "$app`: " -NoNewline
323367

324368
# version hasn't changed (step over if forced update)
325369
if ($ver -eq $expected_ver -and !$ForceUpdate) {
@@ -345,7 +389,7 @@ while ($in_progress -gt 0) {
345389
Write-Host 'Forcing autoupdate!' -ForegroundColor DarkMagenta
346390
}
347391
try {
348-
Invoke-AutoUpdate $App $Dir $json $ver $matchesHashtable # 'autoupdate.ps1'
392+
Invoke-AutoUpdate $app $file $json $ver $matchesHashtable # 'autoupdate.ps1'
349393
} catch {
350394
if ($ThrowError) {
351395
throw $_

bin/describe.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ param(
2424
. "$PSScriptRoot\..\lib\manifest.ps1"
2525
. "$PSScriptRoot\..\lib\description.ps1"
2626

27-
$Dir = Resolve-Path $Dir
27+
$Dir = Convert-Path $Dir
2828
$Queue = @()
2929

30-
Get-ChildItem $Dir "$App.json" | ForEach-Object {
31-
$manifest = parse_json "$Dir\$($_.Name)"
32-
$Queue += , @(($_.Name -replace '\.json$', ''), $manifest)
30+
Get-ChildItem $Dir -Filter "$App.json" -Recurse | ForEach-Object {
31+
$manifest = parse_json $_.FullName
32+
$Queue += , @($_.BaseName, $manifest)
3333
}
3434

3535
$Queue | ForEach-Object {

bin/formatjson.ps1

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,14 @@ param(
3131
. "$PSScriptRoot\..\lib\manifest.ps1"
3232
. "$PSScriptRoot\..\lib\json.ps1"
3333

34-
$Dir = Resolve-Path $Dir
35-
36-
Get-ChildItem $Dir "$App.json" | ForEach-Object {
37-
if ($PSVersionTable.PSVersion.Major -gt 5) { $_ = $_.Name } # Fix for pwsh
34+
$Dir = Convert-Path $Dir
3835

36+
Get-ChildItem $Dir -Filter "$App.json" -Recurse | ForEach-Object {
37+
$file = $_.FullName
3938
# beautify
40-
$json = parse_json "$Dir\$_" | ConvertToPrettyJson
39+
$json = parse_json $file | ConvertToPrettyJson
4140

4241
# convert to 4 spaces
4342
$json = $json -replace "`t", ' '
44-
[System.IO.File]::WriteAllLines("$Dir\$_", $json)
43+
[System.IO.File]::WriteAllLines($file, $json)
4544
}

0 commit comments

Comments
 (0)