diff --git a/bin/add-practice-exercise.ps1 b/bin/add-practice-exercise.ps1 index 400643b5cf..21ab2d6f6c 100644 --- a/bin/add-practice-exercise.ps1 +++ b/bin/add-practice-exercise.ps1 @@ -54,7 +54,7 @@ Remove-Item -Path "${exerciseDir}/UnitTest1.cs" (Get-Content -Path ".editorconfig") -Replace "\[\*\.cs\]", "[${exerciseName}.cs]" | Set-Content -Path "${exerciseDir}/.editorconfig" # Create new generator template and run generator (this will update the tests file) -bin/update-tests.ps1 -e $Exercise -new +bin/update-tests.ps1 -Exercise $Exercise -New -SyncProbSpecs # Output the next steps $files = Get-Content "exercises/practice/${Exercise}/.meta/config.json" | ConvertFrom-Json | Select-Object -ExpandProperty files diff --git a/bin/update-tests.ps1 b/bin/update-tests.ps1 index b4462f248c..76b7ca6b5f 100644 --- a/bin/update-tests.ps1 +++ b/bin/update-tests.ps1 @@ -8,6 +8,8 @@ The slug of the exercise to generate the tests for (optional). .PARAMETER CreateNew Create a new test generator file before generating the tests (switch). +.PARAMETER SyncProbSpecs + Sync the prob-specs repo used (switch). .EXAMPLE The example below will generate the tests for exercises with a template PS C:\> ./test.ps1 @@ -22,22 +24,29 @@ param ( [string]$Exercise, [Parameter()] - [switch]$New + [switch]$New, + + [Parameter()] + [switch]$SyncProbSpecs ) $ErrorActionPreference = "Stop" $PSNativeCommandUseErrorActionPreference = $true -function Run-Command($verb) { - if ($Exercise) { - & dotnet run --project generators $verb --exercise $Exercise +function Run-Command($verb, $exercise = $null) { + if ($exercise) { + & dotnet run --project generators $verb --exercise $exercise } else { & dotnet run --project generators $verb } } +if ($SyncProbSpecs.IsPresent) { + Run-Command sync +} + if ($New.IsPresent) { - Run-Command new + Run-Command new $Exercise } -Run-Command update +Run-Command update $Exercise diff --git a/generators/ProbSpecs.cs b/generators/ProbSpecs.cs index 91e6312b23..c797a5615c 100644 --- a/generators/ProbSpecs.cs +++ b/generators/ProbSpecs.cs @@ -6,6 +6,7 @@ internal static class ProbSpecs { internal static void Sync() { + Console.WriteLine($"Syncing problem-specifications repo..."); Clone(); Pull(); } diff --git a/generators/Program.cs b/generators/Program.cs index 44aca629f4..4c24256cf7 100644 --- a/generators/Program.cs +++ b/generators/Program.cs @@ -5,7 +5,7 @@ namespace Generators; public static class Program { static void Main(string[] args) => - Parser.Default.ParseArguments(args) + Parser.Default.ParseArguments(args) .WithParsed(HandleNewCommand) .WithParsed(HandleUpdateCommand) .WithParsed(HandleSyncCommand)