Skip to content

Commit 1d79fc3

Browse files
committed
fix windows
1 parent 25491f5 commit 1d79fc3

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

integration-tests/run.ps1

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,26 @@ function Normalize-Config {
2020
$ext = [System.IO.Path]::GetExtension($file).TrimStart('.')
2121

2222
switch ($ext) {
23-
{ $_ -in @('yaml', 'yml') } { yq e '.' $file | Sort-Object }
23+
{ $_ -in @('yaml', 'yml') } {
24+
# For YAML files, preserve the structure and sort within each section
25+
$content = Get-Content $file -Raw
26+
$runtimes = ($content | Select-String -Pattern "runtimes:[\s\S]*?tools:" -AllMatches).Matches.Value
27+
$tools = ($content | Select-String -Pattern "tools:[\s\S]*?$" -AllMatches).Matches.Value
28+
29+
# Sort runtimes section
30+
$runtimes = $runtimes -replace "runtimes:", "" -replace "tools:", ""
31+
$runtimes = $runtimes -split "`n" | Where-Object { $_ -match "^\s*-\s*" } | Sort-Object
32+
33+
# Sort tools section
34+
$tools = $tools -replace "tools:", ""
35+
$tools = $tools -split "`n" | Where-Object { $_ -match "^\s*-\s*" } | Sort-Object
36+
37+
# Reconstruct the YAML
38+
"runtimes:"
39+
$runtimes
40+
"tools:"
41+
$tools
42+
}
2443
{ $_ -in @('rc', 'conf', 'ini', 'xml') } {
2544
Get-Content $file | ForEach-Object {
2645
if ($_ -match '^[^#].*=.*,') {

0 commit comments

Comments
 (0)