-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
136 changed files
with
3,763 additions
and
505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This file is a copy of the | ||
# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1 file. | ||
# Please submit bugfixes/improvements to the above file to ensure that all tracks | ||
# benefit from the changes. | ||
|
||
$ErrorActionPreference = "Stop" | ||
$ProgressPreference = "SilentlyContinue" | ||
|
||
$requestOpts = @{ | ||
Headers = If ($env:GITHUB_TOKEN) { @{ Authorization = "Bearer ${env:GITHUB_TOKEN}" } } Else { @{ } } | ||
MaximumRetryCount = 3 | ||
RetryIntervalSec = 1 | ||
} | ||
|
||
$arch = If ([Environment]::Is64BitOperatingSystem) { "x86-64" } Else { "i386" } | ||
$fileName = "configlet_.+_windows_$arch.zip" | ||
|
||
Function Get-DownloadUrl { | ||
$latestUrl = "https://api.github.com/repos/exercism/configlet/releases/latest" | ||
Invoke-RestMethod -Uri $latestUrl -PreserveAuthorizationOnRedirect @requestOpts | ||
| Select-Object -ExpandProperty assets | ||
| Where-Object { $_.browser_download_url -match $FileName } | ||
| Select-Object -ExpandProperty browser_download_url -First 1 | ||
} | ||
|
||
$downloadUrl = Get-DownloadUrl | ||
$outputDirectory = "bin" | ||
$outputFile = Join-Path -Path $outputDirectory -ChildPath $fileName | ||
Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts | ||
Expand-Archive $outputFile -DestinationPath $outputDirectory -Force | ||
Remove-Item -Path $outputFile |
Oops, something went wrong.