Skip to content

Commit

Permalink
chore(release): Bump to version 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
niheaven authored Mar 8, 2022
2 parents 5602083 + 750ea54 commit 04b30de
Show file tree
Hide file tree
Showing 71 changed files with 3,220 additions and 1,914 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Scoop Core CI Tests

on:
pull_request:
workflow_dispatch:

jobs:
test_powershell:
name: WindowsPowerShell
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Init Test Suite
uses: potatoqualitee/psmodulecache@v4
with:
modules-to-cache: PSScriptAnalyzer, BuildHelpers, Pester:4.10.1
shell: powershell
- name: Test Scoop Core
shell: powershell
run: ./test/bin/test.ps1
test_pwsh:
name: PowerShell
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Init Test Suite
uses: potatoqualitee/psmodulecache@v4
with:
modules-to-cache: PSScriptAnalyzer, BuildHelpers, Pester:4.10.1
shell: pwsh
- name: Test Scoop Core
shell: pwsh
run: ./test/bin/test.ps1
4 changes: 0 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
// Configure PSScriptAnalyzer settings
{
"[powershell]": {
// Disable formating until: https://github.com/PowerShell/vscode-powershell/issues/1019 is fixed
"editor.formatOnSave": false
},
"powershell.scriptAnalysis.settingsPath": "PSScriptAnalyzerSettings.psd1",
"powershell.codeFormatting.preset": "OTBS",
"powershell.codeFormatting.alignPropertyValuePairs": true,
Expand Down
522 changes: 522 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion PSScriptAnalyzerSettings.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Only diagnostic records of the specified severity will be generated.
# Uncomment the following line if you only want Errors and Warnings but
# not Information diagnostic records.
Severity = @('Error','Warning')
Severity = @('Error')

# Analyze **only** the following rules. Use IncludeRules when you want
# to invoke only a small subset of the defualt rules.
Expand Down
35 changes: 16 additions & 19 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,34 @@ version: "{build}-{branch}"
branches:
except:
- gh-pages
build: off
deploy: off
clone_depth: 49
image: Visual Studio 2019
build: false
deploy: false
clone_depth: 2
image: Visual Studio 2022
environment:
scoop: C:\projects\scoop
scoop_home: C:\projects\scoop
scoop_helpers: C:\projects\helpers
lessmsi: '%scoop_helpers%\lessmsi\lessmsi.exe'
innounp: '%scoop_helpers%\innounp\innounp.exe'
zstd: '%scoop_helpers%\zstd\zstd.exe'
matrix:
- PowerShell: 5
- PowerShell: 6
cache:
- '%USERPROFILE%\Documents\WindowsPowerShell\Modules -> appveyor.yml, test\bin\*.ps1'
- C:\projects\helpers -> appveyor.yml, test\bin\*.ps1
- PowerShell: 7
matrix:
fast_finish: true
for:
- matrix:
only:
- PowerShell: 5
cache:
- '%USERPROFILE%\Documents\WindowsPowerShell\Modules -> appveyor.yml, test\bin\*.ps1'
- C:\projects\helpers -> appveyor.yml, test\bin\*.ps1
install:
- ps: . "$env:SCOOP_HOME\test\bin\init.ps1"
- ps: .\test\bin\init.ps1
test_script:
- ps: . "$env:SCOOP_HOME\test\bin\test.ps1" -TestPath "$env:APPVEYOR_BUILD_FOLDER"
- ps: .\test\bin\test.ps1
- matrix:
only:
- PowerShell: 6
- PowerShell: 7
cache:
- '%USERPROFILE%\Documents\PowerShell\Modules -> appveyor.yml, test\bin\*.ps1'
- C:\projects\helpers -> appveyor.yml, test\bin\*.ps1
install:
- pwsh: . "$env:SCOOP_HOME\test\bin\init.ps1"
- pwsh: .\test\bin\init.ps1
test_script:
- pwsh: . "$env:SCOOP_HOME\test\bin\test.ps1" -TestPath "$env:APPVEYOR_BUILD_FOLDER"
- pwsh: .\test\bin\test.ps1
174 changes: 90 additions & 84 deletions bin/checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
Useful for hash updates.
.PARAMETER SkipUpdated
Updated manifests will not be shown.
.PARAMETER Version
Update manifest to specific version.
.EXAMPLE
PS BUCKETROOT > .\bin\checkver.ps1
Check all manifest inside default directory.
Expand Down Expand Up @@ -63,19 +65,24 @@ param(
[String] $Version = ''
)

. "$psscriptroot\..\lib\core.ps1"
. "$psscriptroot\..\lib\manifest.ps1"
. "$psscriptroot\..\lib\buckets.ps1"
. "$psscriptroot\..\lib\autoupdate.ps1"
. "$psscriptroot\..\lib\json.ps1"
. "$psscriptroot\..\lib\versions.ps1"
. "$psscriptroot\..\lib\install.ps1" # needed for hash generation
. "$psscriptroot\..\lib\unix.ps1"
. "$PSScriptRoot\..\lib\core.ps1"
. "$PSScriptRoot\..\lib\manifest.ps1"
. "$PSScriptRoot\..\lib\buckets.ps1"
. "$PSScriptRoot\..\lib\autoupdate.ps1"
. "$PSScriptRoot\..\lib\json.ps1"
. "$PSScriptRoot\..\lib\versions.ps1"
. "$PSScriptRoot\..\lib\install.ps1" # needed for hash generation
. "$PSScriptRoot\..\lib\unix.ps1"

$Dir = Resolve-Path $Dir
$Search = $App
$GitHubToken = $env:SCOOP_CHECKVER_TOKEN, (get_config 'checkver-token') | Where-Object -Property Length -Value 0 -GT | Select-Object -First 1

# don't use $Version with $App = '*'
if ($App -eq '*' -and $Version -ne '') {
throw "Don't use '-Version' with '-App *'!"
}

# get apps to check
$Queue = @()
$json = ''
Expand Down Expand Up @@ -205,95 +212,97 @@ while ($in_progress -gt 0) {
$reverse = $state.reverse
$replace = $state.replace
$expected_ver = $json.version
$ver = ''

$page = $ev.SourceEventArgs.Result
$err = $ev.SourceEventArgs.Error
if ($json.checkver.script) {
$page = $json.checkver.script -join "`r`n" | Invoke-Expression
}
$ver = $Version

if ($err) {
next "$($err.message)`r`nURL $url is not valid"
continue
}

if (!$regex -and $replace) {
next "'replace' requires 're' or 'regex'"
continue
}

if ($jsonpath) {
# Return only a single value if regex is absent
$noregex = [String]::IsNullOrEmpty($regex)
# If reverse is ON and regex is ON,
# Then reverse would have no effect because regex handles reverse
# on its own
# So in this case we have to disable reverse
$ver = json_path $page $jsonpath $null ($reverse -and $noregex) $noregex
if (!$ver) {
$ver = json_path_legacy $page $jsonpath
if (!$ver) {
$page = $ev.SourceEventArgs.Result
$err = $ev.SourceEventArgs.Error
if ($json.checkver.script) {
$page = $json.checkver.script -join "`r`n" | Invoke-Expression
}
if (!$ver) {
next "couldn't find '$jsonpath' in $url"

if ($err) {
next "$($err.message)`r`nURL $url is not valid"
continue
}
}

if ($xpath) {
$xml = [xml]$page
# Find all `significant namespace declarations` from the XML file
$nsList = $xml.SelectNodes("//namespace::*[not(. = ../../namespace::*)]")
# Then add them into the NamespaceManager
$nsmgr = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
$nsList | ForEach-Object {
$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"
if (!$regex -and $replace) {
next "'replace' requires 're' or 'regex'"
continue
}
}

if ($jsonpath -and $regexp) {
$page = $ver
$ver = ''
}
if ($jsonpath) {
# Return only a single value if regex is absent
$noregex = [String]::IsNullOrEmpty($regex)
# If reverse is ON and regex is ON,
# Then reverse would have no effect because regex handles reverse
# on its own
# So in this case we have to disable reverse
$ver = json_path $page $jsonpath $null ($reverse -and $noregex) $noregex
if (!$ver) {
$ver = json_path_legacy $page $jsonpath
}
if (!$ver) {
next "couldn't find '$jsonpath' in $url"
continue
}
}

if ($xpath -and $regexp) {
$page = $ver
$ver = ''
}
if ($xpath) {
$xml = [xml]$page
# Find all `significant namespace declarations` from the XML file
$nsList = $xml.SelectNodes("//namespace::*[not(. = ../../namespace::*)]")
# Then add them into the NamespaceManager
$nsmgr = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
$nsList | ForEach-Object {
$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"
continue
}
}

if ($regexp) {
$regex = New-Object System.Text.RegularExpressions.Regex($regexp)
if ($reverse) {
$match = $regex.Matches($page) | Select-Object -Last 1
} else {
$match = $regex.Matches($page) | Select-Object -First 1
if ($jsonpath -and $regexp) {
$page = $ver
$ver = ''
}

if ($match -and $match.Success) {
$matchesHashtable = @{}
$regex.GetGroupNames() | ForEach-Object { $matchesHashtable.Add($_, $match.Groups[$_].Value) }
$ver = $matchesHashtable['1']
if ($replace) {
$ver = $regex.Replace($match.Value, $replace)
if ($xpath -and $regexp) {
$page = $ver
$ver = ''
}

if ($regexp) {
$regex = New-Object System.Text.RegularExpressions.Regex($regexp)
if ($reverse) {
$match = $regex.Matches($page) | Select-Object -Last 1
} else {
$match = $regex.Matches($page) | Select-Object -First 1
}
if (!$ver) {
$ver = $matchesHashtable['version']

if ($match -and $match.Success) {
$matchesHashtable = @{}
$regex.GetGroupNames() | ForEach-Object { $matchesHashtable.Add($_, $match.Groups[$_].Value) }
$ver = $matchesHashtable['1']
if ($replace) {
$ver = $regex.Replace($match.Value, $replace)
}
if (!$ver) {
$ver = $matchesHashtable['version']
}
} else {
next "couldn't match '$regexp' in $url"
continue
}
} else {
next "couldn't match '$regexp' in $url"
continue
}
}

if (!$ver) {
next "couldn't find new version in $url"
continue
if (!$ver) {
next "couldn't find new version in $url"
continue
}
}

# Skip actual only if versions are same and there is no -f
Expand Down Expand Up @@ -325,9 +334,6 @@ while ($in_progress -gt 0) {
Write-Host 'Forcing autoupdate!' -ForegroundColor DarkMagenta
}
try {
if ($Version -ne "") {
$ver = $Version
}
Invoke-AutoUpdate $App $Dir $json $ver $matchesHashtable
} catch {
error $_.Exception.Message
Expand Down
1 change: 0 additions & 1 deletion bin/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Copy-Item "$dir\_tmp\*-master\*" $dir -Recurse -Force
Remove-Item "$dir\_tmp", $zipfile -Recurse -Force

ensure_robocopy_in_path
ensure_scoop_in_path

scoop config lastupdate ([System.DateTime]::Now.ToString('o'))
success 'Scoop was installed successfully!'
Expand Down
3 changes: 1 addition & 2 deletions bin/refresh.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# for development, update the installed scripts to match local source
. "$psscriptroot\..\lib\core.ps1"
. "$PSScriptRoot\..\lib\core.ps1"

$src = relpath ".."
$dest = ensure (versiondir 'scoop' 'current')
Expand All @@ -15,5 +15,4 @@ $output | Where-Object { $_ -ne "" }
Write-Output 'creating shim...'
shim "$dest\bin\scoop.ps1" $false

ensure_scoop_in_path
success 'scoop was refreshed!'
Loading

0 comments on commit 04b30de

Please sign in to comment.