Skip to content

Commit

Permalink
chore(release): Bump to version 0.3.0
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
11 people authored Oct 13, 2022
2 parents 4a31bd3 + 9baf293 commit 8aee6f9
Show file tree
Hide file tree
Showing 50 changed files with 794 additions and 453 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ labels: "bug"

### System details

**Windows version:** [e.g. 7, 8, 10]
**Windows version:** [e.g. 7, 8, 10, 11]

**OS architecture:** [e.g. 32bit, 64bit]
**OS architecture:** [e.g. 32bit, 64bit, arm64]

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

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.log
.DS_Store
._.DS_Store
scoop.sublime-workspace
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"powershell.codeFormatting.preset": "OTBS",
"powershell.codeFormatting.alignPropertyValuePairs": true,
"powershell.codeFormatting.ignoreOneLineBlock": true,
"powershell.codeFormatting.useConstantStrings": true,
"powershell.codeFormatting.useCorrectCasing": true,
"powershell.codeFormatting.whitespaceBetweenParameters": true,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
## [v0.3.0](https://github.com/ScoopInstaller/Scoop/compare/v0.2.4...v0.3.0) - 2022-10-10

### Features

- **install:** Add support for ARM64 architecture ([#5154](https://github.com/ScoopInstaller/Scoop/issues/5154))
- **install:** Show the running process ([#5102](https://github.com/ScoopInstaller/Scoop/issues/5102))
- **getopt:** Support option terminator (`--`) ([#5121](https://github.com/ScoopInstaller/Scoop/issues/5121))
- **subdir:** Allow subdir in 'bucket' ([#5119](https://github.com/ScoopInstaller/Scoop/issues/5119))
- **scoop-config:** Allow 'hold_update_until' be set manually ([#5100](https://github.com/ScoopInstaller/Scoop/issues/5100))
- **scoop-(un)hold:** Support `scoop (un)hold scoop` ([#5089](https://github.com/ScoopInstaller/Scoop/issues/5089))
- **scoop-update:** Stash uncommitted changes before update ([#5091](https://github.com/ScoopInstaller/Scoop/issues/5091))

### Bug Fixes

- **config:** Change config option to snake_case in file and SCREAMING_CASE in code ([#5116](https://github.com/ScoopInstaller/Scoop/issues/5116))
- **jsonpath:** Prevent converting date string to DateTime in JSONPath ([#5130](https://github.com/ScoopInstaller/Scoop/issues/5130))
- **psmodule:** Remove folder recursively when unlinking previous module path ([#5127](https://github.com/ScoopInstaller/Scoop/issues/5127))
- **scoop-update:** Add `uninstall_psmodule` to update process ([#5136](https://github.com/ScoopInstaller/Scoop/issues/5136))

### Code Refactoring

- **download:** Rename `dl()` to `Invoke-Download()` ([#5143](https://github.com/ScoopInstaller/Scoop/issues/5143))
- **path:** Use 'Convert-Path()' instead of 'Resolve-Path()' ([#5109](https://github.com/ScoopInstaller/Scoop/issues/5109))
- **scoop-shim:** Use `getopt` to parse arguments ([#5125](https://github.com/ScoopInstaller/Scoop/issues/5125))

### Builds

- **checkver:** Implement SourceForge checkver functionality ([#5113](https://github.com/ScoopInstaller/Scoop/issues/5113), [#5163](https://github.com/ScoopInstaller/Scoop/issues/5163))
- **checkurls:** Allow checking URLs from private_hosts ([#5152](https://github.com/ScoopInstaller/Scoop/issues/5152))
- **schema:** Set manifest schema to be stricter ([#5093](https://github.com/ScoopInstaller/Scoop/issues/5093))
- **vscode:** Tweak VSCode setting ([#5149](https://github.com/ScoopInstaller/Scoop/issues/5149))

## [v0.2.4](https://github.com/ScoopInstaller/Scoop/compare/v0.2.3...v0.2.4) - 2022-08-08

### Features
Expand Down
2 changes: 1 addition & 1 deletion bin/auto-pr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ param(
if ($App -ne '*' -and (Test-Path $App -PathType Leaf)) {
$Dir = Split-Path $App
} elseif ($Dir) {
$Dir = Resolve-Path $Dir
$Dir = Convert-Path $Dir
} else {
throw "'-Dir' parameter required if '-App' is not a filepath!"
}
Expand Down
26 changes: 17 additions & 9 deletions bin/checkhashes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ param(
. "$PSScriptRoot\..\lib\install.ps1"
. "$PSScriptRoot\..\lib\unix.ps1"

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

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

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

$MANIFESTS += @{
app = $name
file = $file
manifest = $manifest
urls = $urls
hashes = $hashes
Expand All @@ -113,7 +117,7 @@ foreach ($current in $MANIFESTS) {
$version = 'HASH_CHECK'
$tmp = $expected_hash -split ':'

dl_with_cache $current.app $version $_ $null $null -use_cache:$UseCache
Invoke-CachedDownload $current.app $version $_ $null $null -use_cache:$UseCache

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

# 64bit is get, donwloaded and added first
if ($platforms.Contains('64bit')) {
$64bit_count = $current.manifest.architecture.'64bit'.hash.Count
# 64bit is get, donwloaded and added first
$current.manifest.architecture.'64bit'.hash = $actuals[0..($64bit_count - 1)]
}
if ($platforms.Contains('32bit')) {
$32bit_count = $current.manifest.architecture.'32bit'.hash.Count
$max = $64bit_count + $32bit_count - 1 # Edge case if manifest contains 64bit and 32bit.
$current.manifest.architecture.'32bit'.hash = $actuals[($64bit_count)..$max]
$current.manifest.architecture.'32bit'.hash = $actuals[($64bit_count)..($64bit_count + $32bit_count - 1)]
}
if ($platforms.Contains('arm64')) {
$arm64_count = $current.manifest.architecture.'arm64'.hash.Count
$current.manifest.architecture.'arm64'.hash = $actuals[($64bit_count + $32bit_count)..($64bit_count + $32bit_count + $arm64_count - 1)]
}
}

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

$current.manifest = $current.manifest | ConvertToPrettyJson
$path = Resolve-Path "$Dir\$($current.app).json"
$path = Convert-Path $current.file
[System.IO.File]::WriteAllLines($path, $current.manifest)
}
}
18 changes: 13 additions & 5 deletions bin/checkurls.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ param(
. "$PSScriptRoot\..\lib\manifest.ps1"
. "$PSScriptRoot\..\lib\install.ps1"

$Dir = Resolve-Path $Dir
$Dir = Convert-Path $Dir
$Queue = @()

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

Write-Host '[' -NoNewLine
Expand All @@ -62,6 +62,13 @@ function test_dl([String] $url, $cookies) {
$wreq.Headers.Add('Cookie', (cookie_header $cookies))
}
}

get_config PRIVATE_HOSTS | Where-Object { $_ -ne $null -and $url -match $_.match } | ForEach-Object {
(ConvertFrom-StringData -StringData $_.Headers).GetEnumerator() | ForEach-Object {
$wreq.Headers[$_.Key] = $_.Value
}
}

$wres = $null
try {
$wres = $wreq.GetResponse()
Expand Down Expand Up @@ -91,6 +98,7 @@ foreach ($man in $Queue) {
} else {
script:url $manifest '64bit' | ForEach-Object { $urls += $_ }
script:url $manifest '32bit' | ForEach-Object { $urls += $_ }
script:url $manifest 'arm64' | ForEach-Object { $urls += $_ }
}

$urls | ForEach-Object {
Expand Down Expand Up @@ -125,7 +133,7 @@ foreach ($man in $Queue) {
Write-Host $failed -NoNewLine -ForegroundColor Red
}
Write-Host '] ' -NoNewLine
Write-Host (strip_ext $name)
Write-Host $name

$errors | ForEach-Object {
Write-Host " > $_" -ForegroundColor DarkRed
Expand Down
80 changes: 62 additions & 18 deletions bin/checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ param(

if ($App -ne '*' -and (Test-Path $App -PathType Leaf)) {
$Dir = Split-Path $App
$files = Get-ChildItem $Dir (Split-Path $App -Leaf)
$files = Get-ChildItem $Dir -Filter (Split-Path $App -Leaf)
} elseif ($Dir) {
$Dir = Resolve-Path $Dir
$files = Get-ChildItem $Dir "$App.json"
$Dir = Convert-Path $Dir
$files = Get-ChildItem $Dir -Filter "$App.json" -Recurse
} else {
throw "'-Dir' parameter required if '-App' is not a filepath!"
}
Expand All @@ -97,9 +97,10 @@ if ($App -eq '*' -and $Version -ne '') {
$Queue = @()
$json = ''
$files | ForEach-Object {
$json = parse_json "$Dir\$($_.Name)"
$file = $_.FullName
$json = parse_json $file
if ($json.checkver) {
$Queue += , @($_.Name, $json)
$Queue += , @($_.BaseName, $json, $file)
}
}

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

# start all downloads
$Queue | ForEach-Object {
$name, $json = $_
$name, $json, $file = $_

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

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

$githubRegex = '\/releases\/tag\/(?:v|V)?([\d.]+)'

$url = $json.homepage
# Not Specified
if ($json.checkver.url) {
$url = $json.checkver.url
} else {
$url = $json.homepage
}

if ($json.checkver.re) {
$regex = $json.checkver.re
} elseif ($json.checkver.regex) {
$regex = $json.checkver.regex
} else {
$regex = ''
}
$regex = ''

$jsonpath = ''
$xpath = ''
$replace = ''
$useGithubAPI = $false

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

if ($json.checkver.re) {
$regex = $json.checkver.re
# SourceForge
if ($regex) {
$sourceforgeRegex = $regex
} else {
$sourceforgeRegex = '(?!\.)([\d.]+)(?<=\d)'
}
if ($json.checkver.regex) {
$regex = $json.checkver.regex
if ($json.checkver -eq 'sourceforge') {
if ($json.homepage -match '//(sourceforge|sf)\.net/projects/(?<project>[^/]+)(/files/(?<path>[^/]+))?|//(?<project>[^.]+)\.(sourceforge\.(net|io)|sf\.net)') {
$project = $Matches['project']
$path = $Matches['path']
} else {
$project = strip_ext $name
}
$url = "https://sourceforge.net/projects/$project/rss"
if ($path) {
$url = $url + '?path=/' + $path.TrimStart('/')
}
$regex = "CDATA\[/$path/.*?$sourceforgeRegex.*?\]".Replace('//', '/')
}
if ($json.checkver.sourceforge) {
if ($json.checkver.sourceforge -is [System.String] -and $json.checkver.sourceforge -match '(?<project>[\w-]*)(/(?<path>.*))?') {
$project = $Matches['project']
$path = $Matches['path']
} else {
$project = $json.checkver.sourceforge.project
$path = $json.checkver.sourceforge.path
}
$url = "https://sourceforge.net/projects/$project/rss"
if ($path) {
$url = $url + '?path=/' + $path.TrimStart('/')
}
$regex = "CDATA\[/$path/.*?$sourceforgeRegex.*?\]".Replace('//', '/')
}

if ($json.checkver.jp) {
Expand All @@ -165,7 +207,7 @@ $Queue | ForEach-Object {
$xpath = $json.checkver.xpath
}

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

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

$state = New-Object psobject @{
app = (strip_ext $name);
app = $name;
file = $file;
url = $url;
regex = $regex;
json = $json;
Expand Down Expand Up @@ -213,6 +256,7 @@ while ($in_progress -gt 0) {

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

Write-Host "$App`: " -NoNewline
Write-Host "$app`: " -NoNewline

# version hasn't changed (step over if forced update)
if ($ver -eq $expected_ver -and !$ForceUpdate) {
Expand All @@ -345,7 +389,7 @@ while ($in_progress -gt 0) {
Write-Host 'Forcing autoupdate!' -ForegroundColor DarkMagenta
}
try {
Invoke-AutoUpdate $App $Dir $json $ver $matchesHashtable # 'autoupdate.ps1'
Invoke-AutoUpdate $app $file $json $ver $matchesHashtable # 'autoupdate.ps1'
} catch {
if ($ThrowError) {
throw $_
Expand Down
8 changes: 4 additions & 4 deletions bin/describe.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ param(
. "$PSScriptRoot\..\lib\manifest.ps1"
. "$PSScriptRoot\..\lib\description.ps1"

$Dir = Resolve-Path $Dir
$Dir = Convert-Path $Dir
$Queue = @()

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

$Queue | ForEach-Object {
Expand Down
11 changes: 5 additions & 6 deletions bin/formatjson.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ param(
. "$PSScriptRoot\..\lib\manifest.ps1"
. "$PSScriptRoot\..\lib\json.ps1"

$Dir = Resolve-Path $Dir

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

Get-ChildItem $Dir -Filter "$App.json" -Recurse | ForEach-Object {
$file = $_.FullName
# beautify
$json = parse_json "$Dir\$_" | ConvertToPrettyJson
$json = parse_json $file | ConvertToPrettyJson

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

0 comments on commit 8aee6f9

Please sign in to comment.