Skip to content

Commit

Permalink
More updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Oct 20, 2024
1 parent e637b5e commit b2c2a26
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-code-snippets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
dotnet-version: "8.0.200"

- name: Validate Code Snippets
run: pwsh ./check-code-snippets.ps1
run: pwsh ./bin/check-code-snippets.ps1
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee
with:
dotnet-version: "8.0.200"
- run: pwsh ./test.ps1
- run: pwsh ./bin/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
The difficulty of the exercise on a scale from 1 to 10 (optional, default: 1).
.EXAMPLE
The example below will add the "acronym" exercise
PS C:\> ./add-practice-exercise.ps1 acronym
PS C:\> bin/add-practice-exercise.ps1 acronym
#>

[CmdletBinding(SupportsShouldProcess)]
Expand Down
6 changes: 1 addition & 5 deletions check-code-snippets.ps1 → bin/check-code-snippets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
- recursively search a list of directories for Markdown documentation
- extract any F# code snippets
- evaluate them to verify correct syntax (no type checking is performed)
.PARAMETER SourceDirectories
A list of directories containing Markdown documentation (defaults to ["concepts","exercises"]).
.PARAMETER Exclude
A list of directories to ignore (optional).
.EXAMPLE
PS C:\> ./check-code-snippets.ps1
PS C:\> bin/check-code-snippets.ps1
Verifies all *.md files under the `concepts` and `exercises` directories
#>

Expand Down
4 changes: 2 additions & 2 deletions test.ps1 → bin/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
The slug of the exercise to verify (optional).
.EXAMPLE
The example below will verify the full solution
PS C:\> ./test.ps1
PS C:\> bin/test.ps1
.EXAMPLE
The example below will verify the "acronym" exercise
PS C:\> ./test.ps1 acronym
PS C:\> bin/test.ps1 acronym
#>

[CmdletBinding(SupportsShouldProcess)]
Expand Down
15 changes: 15 additions & 0 deletions bin/update-exercise-tools.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<#
.SYNOPSIS
Update exercise tools.
.DESCRIPTION
Update the exercise tools for each exercise.
.EXAMPLE
PS C:\> bin/update-exercise-tools.ps1
#>

$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true

Get-ChildItem -Path exercises -Filter dotnet-tools.json -Force -Recurse | ForEach-Object {
dotnet tool update fantomas-tool --tool-manifest $_.FullName
}
32 changes: 32 additions & 0 deletions bin/update-exercises.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<#
.SYNOPSIS
Update the exercises.
.DESCRIPTION
Update the exercises' docs, metadata, and tests.
.PARAMETER Exercise
The slug of the exercise to update (optional).
.EXAMPLE
The example below will update all exercises
PS C:\> bin/update-exercises.ps1
.EXAMPLE
The example below will update the "acronym" exercise
PS C:\> bin/update-exercises.ps1 acronym
#>

[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Position = 0, Mandatory = $false)][string]$Exercise
)

$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true

& bin/fetch-configlet

if ($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
}
68 changes: 0 additions & 68 deletions update-exercise-tools.ps1

This file was deleted.

0 comments on commit b2c2a26

Please sign in to comment.