From 0175e43ad213a63d742aaf2cfde223a1ddc8e3a1 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Sun, 20 Oct 2024 11:07:02 +0200 Subject: [PATCH] Fix update exercises script (#2314) * Stop no error * Fix update exercises script --- bin/test.ps1 | 1 + bin/update-exercises.ps1 | 23 +++++++---------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/bin/test.ps1 b/bin/test.ps1 index 1d7199b27..914079cea 100644 --- a/bin/test.ps1 +++ b/bin/test.ps1 @@ -23,6 +23,7 @@ param ( [string]$Exercise ) +$ErrorActionPreference = "Stop" $PSNativeCommandUseErrorActionPreference = $true function Invoke-Build-Generators { diff --git a/bin/update-exercises.ps1 b/bin/update-exercises.ps1 index 6543af75c..c19da5bb2 100644 --- a/bin/update-exercises.ps1 +++ b/bin/update-exercises.ps1 @@ -11,9 +11,6 @@ .EXAMPLE The example below will update the "acronym" exercise PS C:\> ./update-exercises.ps1 acronym -.EXAMPLE - The example below will update the "acronym" exercise and regenerate the tests - PS C:\> ./update-exercises.ps1 acronym -RegenerateTests #> [CmdletBinding(SupportsShouldProcess)] @@ -22,21 +19,15 @@ param ( [Parameter()][switch]$RegenerateTests ) +$ErrorActionPreference = "Stop" $PSNativeCommandUseErrorActionPreference = $true -# Use fetch-configlet and configlet to create the exercise -$extension = if ($IsWindows) { ".exe" } else { "" } -$fetchConfiglet = Join-Path "bin" -ChildPath "fetch-configlet${extension}" -$configlet = Join-Path "bin" -ChildPath "configlet${extension}" - -$syncArgs = @("sync", "--docs", "--metadata", "--filepaths", "--update", "--yes") -$generatorArgs = @("run", "--project", "generators") +& bin/fetch-configlet if ($Exercise) { - $syncArgs += "--exercise ${Exercise}" - $generatorArgs += "--exercise ${Exercise}" + & configlet sync --docs --metadata --filepaths --update --yes --exercise $Exercise + & dotnet run --project generators --exercise $Exercise +} else { + & configlet sync --docs --metadata --filepaths --update --yes + & dotnet run --project generators } - -Start-Process -FilePath $fetchConfiglet -Wait -Start-Process -FilePath $configlet -ArgumentList $syncArgs -Wait -Start-Process "dotnet" -ArgumentList $generatorArgs -Wait