Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): Bump to version 0.3.1 #5247

Merged
merged 25 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
24301ac
refactor(hash): Use 'Get-FileHash()' directly (#5177)
niheaven Oct 13, 2022
ec8161d
fix(decompress): Use PS's default 'Expand-Archive()' (#5185)
niheaven Oct 14, 2022
1f0f687
chore(installer): Drop the old installer (#5186)
chawyehsu Oct 14, 2022
512ab44
builds(auto-pr): Add `CommitMessageFormat` option (#5171)
yi-Xu-0100 Oct 14, 2022
d0cbc36
fix(hash): Fix SF hash extraction (#5189)
niheaven Oct 14, 2022
9fda542
builds(checkver): Support XML default namespace (#5191)
niheaven Oct 15, 2022
7dcb7c0
fix(tests): Fix tests in Linux and macOS (#5179)
niheaven Oct 15, 2022
1eea29b
fix(decompress): Trim ending '/' (#5195)
niheaven Oct 15, 2022
b308769
(chore): Sync with 'master'
niheaven Oct 15, 2022
5e6a9ee
builds(pssa): Remove unused 'ExcludeRules' (#5201)
niheaven Oct 17, 2022
c9dc41e
docs(config): Copyedit config description (#5197)
Ama1999 Oct 17, 2022
c71376e
feat(config): Allow scoop to check and update 'nightly' apps (#5166)
pynappo Oct 18, 2022
1c6ab39
ci: Update modules version (#5209)
niheaven Oct 20, 2022
01fe9cc
fix(import): Fix `scoop import` command (#5210)
niheaven Oct 23, 2022
d65fee6
docs(scoop-cat): Fix help message (#5224)
niheaven Oct 25, 2022
2474ab7
builds(schema): Add 'installer' and 'shortcuts' to 'autoupdate' (#5220)
niheaven Oct 25, 2022
1630e5f
tests(pester): Update to Pester 5 (#5222)
niheaven Oct 28, 2022
e4f9734
fix(shim): Exit if shim creating failed 'cause no git (#5225)
niheaven Oct 28, 2022
ea6c738
tests(bucket): Use BuildHelpers EnvVars (#5226)
niheaven Oct 28, 2022
29e5898
feat(checkup): Add Windows Developer Mode check (#5233)
chawyehsu Oct 31, 2022
d7bfe52
fix(scoop-config): Output [DateTime] as [String] (#5232)
niheaven Oct 31, 2022
29ed3cb
builds(checkhashes): Use correct version number if `UseCache` (#5240)
niheaven Nov 10, 2022
0f79573
refactor(unix): Remove unix.ps1 (#5235)
niheaven Nov 10, 2022
ac71c6e
feat(sysinternals): Add 'sysinternals' bucket to known (#5237)
niheaven Nov 10, 2022
c60df9c
docs(changelog): Prepare for version 0.3.1 (#5248)
niheaven Nov 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@main
with:
fetch-depth: 2
- name: Init Test Suite
uses: potatoqualitee/psmodulecache@v4
uses: potatoqualitee/psmodulecache@v5.1
with:
modules-to-cache: PSScriptAnalyzer, BuildHelpers, Pester:4.10.1
modules-to-cache: BuildHelpers
shell: powershell
- name: Test Scoop Core
shell: powershell
Expand All @@ -26,13 +26,13 @@ jobs:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@main
with:
fetch-depth: 2
- name: Init Test Suite
uses: potatoqualitee/psmodulecache@v4
uses: potatoqualitee/psmodulecache@v5.1
with:
modules-to-cache: PSScriptAnalyzer, BuildHelpers, Pester:4.10.1
modules-to-cache: BuildHelpers
shell: pwsh
- name: Test Scoop Core
shell: pwsh
Expand Down
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
## [v0.3.1](https://github.com/ScoopInstaller/Scoop/compare/v0.3.0...v0.3.1) - 2022-11-15

### Features

- **config:** Allow Scoop to check if apps versioned as 'nightly' are outdated ([#5166](https://github.com/ScoopInstaller/Scoop/issues/5166))
- **checkup:** Add Windows Developer Mode check ([#5233](https://github.com/ScoopInstaller/Scoop/issues/5233))
- **bucket:** Add 'sysinternals' bucket to known ([#5237](https://github.com/ScoopInstaller/Scoop/issues/5237))

### Bug Fixes

- **decompress:** Use PS's default 'Expand-Archive()' ([#5185](https://github.com/ScoopInstaller/Scoop/issues/5185))
- **hash:** Fix SourceForge's hash extraction ([#5189](https://github.com/ScoopInstaller/Scoop/issues/5189))
- **decompress:** Trim ending '/' ([#5195](https://github.com/ScoopInstaller/Scoop/issues/5195))
- **shim:** Exit if shim creating failed 'cause no git ([#5225](https://github.com/ScoopInstaller/Scoop/issues/5225))
- **scoop-import:** Add correct architecture argument ([#5210](https://github.com/ScoopInstaller/Scoop/issues/5210))
- **scoop-config:** Output `[DateTime]` as `[String]` ([#5232](https://github.com/ScoopInstaller/Scoop/issues/5232))

### Code Refactoring

- **hash:** Use `Get-FileHash()` directly ([#5177](https://github.com/ScoopInstaller/Scoop/issues/5177))
- **installer:** Drop the old installer ([#5186](https://github.com/ScoopInstaller/Scoop/issues/5186))
- **unix:** Remove `unix.ps1` ([#5235](https://github.com/ScoopInstaller/Scoop/issues/5235))

### Builds

- **auto-pr:** Add `CommitMessageFormat` option ([#5171](https://github.com/ScoopInstaller/Scoop/issues/5171))
- **checkver:** Support XML default namespace ([#5191](https://github.com/ScoopInstaller/Scoop/issues/5191))
- **pssa:** Remove unused 'ExcludeRules' ([#5201](https://github.com/ScoopInstaller/Scoop/issues/5201))
- **schema:** Add 'installer' and 'shortcuts' to 'autoupdate' ([#5220](https://github.com/ScoopInstaller/Scoop/issues/5220))
- **checkhashes:** Use correct version number if `UseCache` ([#5240](https://github.com/ScoopInstaller/Scoop/issues/5240))

### Continuous Integration

- **module:** Update modules version ([#5209](https://github.com/ScoopInstaller/Scoop/issues/5209))

### Tests

- **unix:** Fix tests in Linux and macOS ([#5179](https://github.com/ScoopInstaller/Scoop/issues/5179))
- **pester:** Update to Pester 5 ([#5222](https://github.com/ScoopInstaller/Scoop/issues/5222))
- **bucket:** Use BuildHelpers' EnvVars ([#5226](https://github.com/ScoopInstaller/Scoop/issues/5226))

### Documentation

- **scoop-cat:** Fix help message([#5224](https://github.com/ScoopInstaller/Scoop/issues/5224))

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

### Features
Expand Down
11 changes: 1 addition & 10 deletions PSScriptAnalyzerSettings.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# The PowerShell Script Analyzer will generate a warning
# diagnostic record for this file due to a bug -
# https://github.com/PowerShell/PSScriptAnalyzer/issues/472
@{
# Only diagnostic records of the specified severity will be generated.
# Uncomment the following line if you only want Errors and Warnings but
Expand All @@ -26,12 +23,6 @@
# will be excluded.
ExcludeRules = @(
# Currently Scoop widely uses Write-Host to output colored text.
'PSAvoidUsingWriteHost',
# Temporarily allow uses of Invoke-Expression,
# this command is used by some core functions and hard to be removed.
'PSAvoidUsingInvokeExpression',
# PSUseDeclaredVarsMoreThanAssignments doesn't currently work due to:
# https://github.com/PowerShell/PSScriptAnalyzer/issues/636
'PSUseDeclaredVarsMoreThanAssignments'
'PSAvoidUsingWriteHost'
)
}
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,21 @@ The following buckets are known to scoop:
- [games](https://github.com/Calinou/scoop-games) - Open source/freeware games and game-related tools
- [nerd-fonts](https://github.com/matthewjberger/scoop-nerd-fonts) - Nerd Fonts
- [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)
- [sysinternals](https://github.com/niheaven/scoop-sysinternals) - Sysinternals Suite and all individual application from [Microsoft](https://learn.microsoft.com/sysinternals/)
- [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.
- [nonportable](https://github.com/ScoopInstaller/Nonportable) - Non-portable apps (may require UAC)
- [php](https://github.com/ScoopInstaller/PHP) - Installers for most versions of PHP
- [versions](https://github.com/ScoopInstaller/Versions) - Alternative versions of apps found in other buckets

The main bucket is installed by default. To add any of the other buckets, type:
```

```console
scoop bucket add bucketname
```

For example, to add the extras bucket, type:
```

```console
scoop bucket add extras
```

Expand Down
22 changes: 13 additions & 9 deletions bin/auto-pr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
.PARAMETER App
Manifest name to search.
Placeholders are supported.
.PARAMETER CommitMessageFormat
The format of the commit message.
<app> will be replaced with the file name of manifest.
<version> will be replaced with the version of the latest manifest.
.PARAMETER Dir
The directory where to search for manifests.
.PARAMETER Push
Expand Down Expand Up @@ -43,6 +47,7 @@ param(
[String] $Upstream,
[String] $OriginBranch = 'master',
[String] $App = '*',
[String] $CommitMessageFormat = '<app>: Update to version <version>',
[ValidateScript( {
if (!(Test-Path $_ -Type Container)) {
throw "$_ is not a directory!"
Expand All @@ -61,7 +66,6 @@ param(

. "$PSScriptRoot\..\lib\manifest.ps1"
. "$PSScriptRoot\..\lib\json.ps1"
. "$PSScriptRoot\..\lib\unix.ps1"

if ($App -ne '*' -and (Test-Path $App -PathType Leaf)) {
$Dir = Split-Path $App
Expand All @@ -87,7 +91,7 @@ Optional options:
exit 0
}

if (is_unix) {
if ($IsLinux -or $IsMacOS) {
if (!(which hub)) {
Write-Host "Please install hub ('brew install hub' or visit: https://hub.github.com/)" -ForegroundColor Yellow
exit 1
Expand All @@ -110,7 +114,7 @@ function execute($cmd) {
return $output
}

function pull_requests($json, [String] $app, [String] $upstream, [String] $manifest) {
function pull_requests($json, [String] $app, [String] $upstream, [String] $manifest, [String] $commitMessage) {
$version = $json.version
$homepage = $json.homepage
$branch = "manifest/$app-$version"
Expand All @@ -127,7 +131,7 @@ function pull_requests($json, [String] $app, [String] $upstream, [String] $manif
Write-Host "Creating update $app ($version) ..." -ForegroundColor DarkCyan
execute "hub checkout -b $branch"
execute "hub add $manifest"
execute "hub commit -m '${app}: Update to version $version'"
execute "hub commit -m '$commitMessage"
Write-Host "Pushing update $app ($version) ..." -ForegroundColor DarkCyan
execute "hub push origin $branch"

Expand All @@ -142,7 +146,7 @@ function pull_requests($json, [String] $app, [String] $upstream, [String] $manif
Write-Host "hub pull-request -m '<msg>' -b '$upstream' -h '$branch'" -ForegroundColor Green

$msg = @"
$app`: Update to version $version
$commitMessage

Hello lovely humans,
a new version of [$app]($homepage) is available.
Expand All @@ -155,7 +159,7 @@ a new version of [$app]($homepage) is available.
hub pull-request -m "$msg" -b "$upstream" -h "$branch"
if ($LASTEXITCODE -gt 0) {
execute 'hub reset'
abort "Pull Request failed! (hub pull-request -m '${app}: Update to version $version' -b '$upstream' -h '$branch')"
abort "Pull Request failed! (hub pull-request -m '$commitMessage' -b '$upstream' -h '$branch')"
}
}

Expand Down Expand Up @@ -189,7 +193,7 @@ hub diff --name-only | ForEach-Object {
return
}
$version = $json.version

$CommitMessage = $CommitMessageFormat -replace '<app>',$app -replace '<version>',$version
if ($Push) {
Write-Host "Creating update $app ($version) ..." -ForegroundColor DarkCyan
execute "hub add $manifest"
Expand All @@ -198,12 +202,12 @@ hub diff --name-only | ForEach-Object {
$status = execute 'hub status --porcelain -uno'
$status = $status | Where-Object { $_ -match "M\s{2}.*$app.json" }
if ($status -and $status.StartsWith('M ') -and $status.EndsWith("$app.json")) {
execute "hub commit -m '${app}: Update to version $version'"
execute "hub commit -m '$commitMessage'"
} else {
Write-Host "Skipping $app because only LF/CRLF changes were detected ..." -ForegroundColor Yellow
}
} else {
pull_requests $json $app $Upstream $manifest
pull_requests $json $app $Upstream $manifest $CommitMessage
}
}

Expand Down
18 changes: 10 additions & 8 deletions bin/checkhashes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ param(
. "$PSScriptRoot\..\lib\json.ps1"
. "$PSScriptRoot\..\lib\versions.ps1"
. "$PSScriptRoot\..\lib\install.ps1"
. "$PSScriptRoot\..\lib\unix.ps1"

$Dir = Convert-Path $Dir
if ($ForceUpdate) { $Update = $true }
Expand Down Expand Up @@ -114,13 +113,16 @@ foreach ($current in $MANIFESTS) {

$current.urls | ForEach-Object {
$algorithm, $expected = get_hash $current.hashes[$count]
$version = 'HASH_CHECK'
$tmp = $expected_hash -split ':'
if ($UseCache) {
$version = $current.manifest.version
} else {
$version = 'HASH_CHECK'
}

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
$actual_hash = (Get-FileHash -Path $to_check -Algorithm $algorithm).Hash.ToLower()

# Append type of algorithm to both expected and actual if it's not sha256
if ($algorithm -ne 'sha256') {
Expand All @@ -145,12 +147,12 @@ foreach ($current in $MANIFESTS) {
Write-Host 'Mismatch found ' -ForegroundColor Red
$mismatched | ForEach-Object {
$file = fullpath (cache_path $current.app $version $current.urls[$_])
Write-Host "`tURL:`t`t$($current.urls[$_])"
Write-Host "`tURL:`t`t$($current.urls[$_])"
if (Test-Path $file) {
Write-Host "`tFirst bytes:`t$((get_magic_bytes_pretty $file ' ').ToUpper())"
Write-Host "`tFirst bytes:`t$((get_magic_bytes_pretty $file ' ').ToUpper())"
}
Write-Host "`tExpected:`t$($current.hashes[$_])" -ForegroundColor Green
Write-Host "`tActual:`t`t$($actuals[$_])" -ForegroundColor Red
Write-Host "`tExpected:`t$($current.hashes[$_])" -ForegroundColor Green
Write-Host "`tActual:`t`t$($actuals[$_])" -ForegroundColor Red
}
}

Expand Down
10 changes: 7 additions & 3 deletions bin/checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ param(
. "$PSScriptRoot\..\lib\json.ps1"
. "$PSScriptRoot\..\lib\versions.ps1"
. "$PSScriptRoot\..\lib\install.ps1" # needed for hash generation
. "$PSScriptRoot\..\lib\unix.ps1"

if ($App -ne '*' -and (Test-Path $App -PathType Leaf)) {
$Dir = Split-Path $App
Expand Down Expand Up @@ -310,12 +309,17 @@ while ($in_progress -gt 0) {
# Then add them into the NamespaceManager
$nsmgr = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
$nsList | ForEach-Object {
$nsmgr.AddNamespace($_.LocalName, $_.Value)
if ($_.LocalName -eq 'xmlns') {
$nsmgr.AddNamespace('ns', $_.Value)
$xpath = $xpath -replace '/([^:/]+)((?=/)|(?=$))', '/ns:$1'
} else {
$nsmgr.AddNamespace($_.LocalName, $_.Value)
}
}
# Getting version from XML, using XPath
$ver = $xml.SelectSingleNode($xpath, $nsmgr).'#text'
if (!$ver) {
next "couldn't find '$xpath' in $url"
next "couldn't find '$($xpath -replace 'ns:', '')' in $url"
continue
}
}
Expand Down
78 changes: 1 addition & 77 deletions bin/install.ps1
Original file line number Diff line number Diff line change
@@ -1,78 +1,2 @@
#Requires -Version 5

# remote install:
# Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
$old_erroractionpreference = $erroractionpreference
$erroractionpreference = 'stop' # quit if anything goes wrong

if (($PSVersionTable.PSVersion.Major) -lt 5) {
Write-Output "PowerShell 5 or later is required to run Scoop."
Write-Output "Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell"
break
}

# show notification to change execution policy:
$allowedExecutionPolicy = @('Unrestricted', 'RemoteSigned', 'ByPass')
if ((Get-ExecutionPolicy).ToString() -notin $allowedExecutionPolicy) {
Write-Output "PowerShell requires an execution policy in [$($allowedExecutionPolicy -join ", ")] to run Scoop."
Write-Output "For example, to set the execution policy to 'RemoteSigned' please run :"
Write-Output "'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'"
break
}

if ([System.Enum]::GetNames([System.Net.SecurityProtocolType]) -notcontains 'Tls12') {
Write-Output "Scoop requires at least .NET Framework 4.5"
Write-Output "Please download and install it first:"
Write-Output "https://www.microsoft.com/net/download"
break
}

# get core functions
$core_url = 'https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/lib/core.ps1'
Write-Output 'Initializing...'
Invoke-Expression (new-object net.webclient).downloadstring($core_url)

# prep
if (Get-Command -Name 'scoop' -ErrorAction SilentlyContinue) {
write-host "Scoop is already installed. Run 'scoop update' to get the latest version." -f red
# don't abort if invoked with iex that would close the PS session
if ($myinvocation.mycommand.commandtype -eq 'Script') { return } else { exit 1 }
}
$dir = ensure (versiondir 'scoop' 'current')

# download scoop zip
$zipUrl = 'https://github.com/ScoopInstaller/Scoop/archive/master.zip'
$zipFile = "$dir\scoop.zip"
Write-Output 'Downloading scoop...'
Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile

Write-Output 'Extracting...'
Add-Type -Assembly "System.IO.Compression.FileSystem"
[IO.Compression.ZipFile]::ExtractToDirectory($zipfile, "$dir\_tmp")
Copy-Item "$dir\_tmp\*master\*" $dir -Recurse -Force
Remove-Item "$dir\_tmp", $zipfile -Recurse -Force

Write-Output 'Creating shim...'
shim "$dir\bin\scoop.ps1" $false

# download main bucket
$dir = "$scoopdir\buckets\main"
$zipUrl = 'https://github.com/ScoopInstaller/Main/archive/master.zip'
$zipFile = "$dir\main-bucket.zip"
Write-Output 'Downloading main bucket...'
New-Item -Path $dir -Type Directory -Force | Out-Null
Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile

Write-Output 'Extracting...'
[IO.Compression.ZipFile]::ExtractToDirectory($zipfile, "$dir\_tmp")
Copy-Item "$dir\_tmp\*-master\*" $dir -Recurse -Force
Remove-Item "$dir\_tmp", $zipfile -Recurse -Force

ensure_robocopy_in_path

set_config LAST_UPDATE ([System.DateTime]::Now.ToString('o')) | Out-Null
success 'Scoop was installed successfully!'

Write-Output "Type 'scoop help' for instructions."

$erroractionpreference = $old_erroractionpreference # Reset $erroractionpreference to original value
Invoke-RestMethod https://get.scoop.sh | Invoke-Expression
1 change: 1 addition & 0 deletions buckets.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"extras": "https://github.com/ScoopInstaller/Extras",
"versions": "https://github.com/ScoopInstaller/Versions",
"nirsoft": "https://github.com/kodybrown/scoop-nirsoft",
"sysinternals": "https://github.com/niheaven/scoop-sysinternals",
"php": "https://github.com/ScoopInstaller/PHP",
"nerd-fonts": "https://github.com/matthewjberger/scoop-nerd-fonts",
"nonportable": "https://github.com/ScoopInstaller/Nonportable",
Expand Down
Loading