Skip to content

Commit

Permalink
chore(release): Bump to version 0.3.1 (#5247)
Browse files Browse the repository at this point in the history
  • Loading branch information
niheaven committed Nov 15, 2022
2 parents 8aee6f9 + c60df9c commit f930280
Show file tree
Hide file tree
Showing 44 changed files with 703 additions and 905 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
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
@@ -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
@@ -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
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
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
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
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
@@ -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
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

0 comments on commit f930280

Please sign in to comment.