From 08f0c88d5bf5d839015ab2b275c6bfbe63fe43bd Mon Sep 17 00:00:00 2001 From: SimaDovakin Date: Fri, 26 Jul 2024 10:33:42 +0300 Subject: [PATCH] anagram-exercise-fix: Rebased to main and synced all fetch-cobolcheck files --- .../practice/acronym/bin/fetch-cobolcheck | 19 +++++-------------- .../practice/acronym/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../all-your-base/bin/fetch-cobolcheck | 19 +++++-------------- .../all-your-base/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../practice/allergies/bin/fetch-cobolcheck | 11 +---------- .../allergies/bin/fetch-cobolcheck.ps1 | 6 ++++-- .../practice/anagram/bin/fetch-cobolcheck | 11 +---------- .../practice/anagram/bin/fetch-cobolcheck.ps1 | 4 +++- .../armstrong-numbers/bin/fetch-cobolcheck | 11 +---------- .../bin/fetch-cobolcheck.ps1 | 6 ++++-- .../atbash-cipher/bin/fetch-cobolcheck | 19 +++++-------------- .../atbash-cipher/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../binary-search/bin/fetch-cobolcheck | 19 +++++-------------- .../binary-search/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../practice/binary/bin/fetch-cobolcheck | 19 +++++-------------- .../practice/binary/bin/fetch-cobolcheck.ps1 | 13 +++++++------ exercises/practice/bob/bin/fetch-cobolcheck | 19 +++++-------------- .../practice/bob/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../circular-buffer/bin/fetch-cobolcheck | 19 +++++-------------- .../circular-buffer/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../collatz-conjecture/bin/fetch-cobolcheck | 11 +---------- .../bin/fetch-cobolcheck.ps1 | 6 ++++-- .../complex-numbers/bin/fetch-cobolcheck | 19 +++++-------------- .../complex-numbers/bin/fetch-cobolcheck.ps1 | 13 +++++++------ exercises/practice/darts/bin/fetch-cobolcheck | 19 +++++-------------- .../practice/darts/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../practice/diamond/bin/fetch-cobolcheck | 19 +++++-------------- .../practice/diamond/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../bin/fetch-cobolcheck | 11 +---------- .../bin/fetch-cobolcheck.ps1 | 6 ++++-- .../practice/eliuds-eggs/bin/fetch-cobolcheck | 19 +++++-------------- .../eliuds-eggs/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../grade-school/bin/fetch-cobolcheck | 19 +++++-------------- .../grade-school/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../practice/hamming/bin/fetch-cobolcheck | 11 +---------- .../practice/hamming/bin/fetch-cobolcheck.ps1 | 6 ++++-- .../practice/hello-world/bin/fetch-cobolcheck | 11 +---------- .../hello-world/bin/fetch-cobolcheck.ps1 | 6 ++++-- .../practice/high-scores/bin/fetch-cobolcheck | 11 +---------- .../high-scores/bin/fetch-cobolcheck.ps1 | 6 ++++-- .../practice/isogram/bin/fetch-cobolcheck | 11 +---------- .../practice/isogram/bin/fetch-cobolcheck.ps1 | 6 ++++-- .../practice/knapsack/bin/fetch-cobolcheck | 19 +++++-------------- .../knapsack/bin/fetch-cobolcheck.ps1 | 13 +++++++------ exercises/practice/leap/bin/fetch-cobolcheck | 11 +---------- .../practice/leap/bin/fetch-cobolcheck.ps1 | 6 ++++-- exercises/practice/luhn/bin/fetch-cobolcheck | 11 +---------- .../practice/luhn/bin/fetch-cobolcheck.ps1 | 6 ++++-- .../matching-brackets/bin/fetch-cobolcheck | 19 +++++-------------- .../bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../practice/meetup/bin/fetch-cobolcheck | 19 +++++-------------- .../practice/meetup/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../nucleotide-count/bin/fetch-cobolcheck | 11 +---------- .../nucleotide-count/bin/fetch-cobolcheck.ps1 | 6 ++++-- .../practice/pangram/bin/fetch-cobolcheck | 11 +---------- .../practice/pangram/bin/fetch-cobolcheck.ps1 | 4 +++- .../pascals-triangle/bin/fetch-cobolcheck | 19 +++++-------------- .../pascals-triangle/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../practice/pig-latin/bin/fetch-cobolcheck | 19 +++++-------------- .../pig-latin/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../protein-translation/bin/fetch-cobolcheck | 19 +++++-------------- .../bin/fetch-cobolcheck.ps1 | 11 ++++++----- .../queen-attack/bin/fetch-cobolcheck | 19 +++++-------------- .../queen-attack/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../practice/raindrops/bin/fetch-cobolcheck | 11 +---------- .../raindrops/bin/fetch-cobolcheck.ps1 | 6 ++++-- .../reverse-string/bin/fetch-cobolcheck | 11 +---------- .../reverse-string/bin/fetch-cobolcheck.ps1 | 6 ++++-- .../rna-transcription/bin/fetch-cobolcheck | 11 +---------- .../bin/fetch-cobolcheck.ps1 | 6 ++++-- .../robot-simulator/bin/fetch-cobolcheck | 19 +++++-------------- .../robot-simulator/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../roman-numerals/bin/fetch-cobolcheck | 11 +---------- .../roman-numerals/bin/fetch-cobolcheck.ps1 | 4 +++- .../rotational-cipher/bin/fetch-cobolcheck | 11 +---------- .../bin/fetch-cobolcheck.ps1 | 6 ++++-- .../scrabble-score/bin/fetch-cobolcheck | 19 +++++-------------- .../scrabble-score/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../secret-handshake/bin/fetch-cobolcheck | 19 +++++-------------- .../secret-handshake/bin/fetch-cobolcheck.ps1 | 13 +++++++------ exercises/practice/sieve/bin/fetch-cobolcheck | 11 +---------- .../practice/sieve/bin/fetch-cobolcheck.ps1 | 6 ++++-- .../practice/space-age/bin/fetch-cobolcheck | 19 +++++-------------- .../space-age/bin/fetch-cobolcheck.ps1 | 13 +++++++------ .../practice/square-root/bin/fetch-cobolcheck | 11 +---------- .../square-root/bin/fetch-cobolcheck.ps1 | 6 ++++-- .../practice/triangle/bin/fetch-cobolcheck | 19 +++++-------------- .../triangle/bin/fetch-cobolcheck.ps1 | 11 ++++++----- .../practice/two-fer/bin/fetch-cobolcheck | 11 +---------- .../practice/two-fer/bin/fetch-cobolcheck.ps1 | 6 ++++-- exercises/practice/yacht/bin/fetch-cobolcheck | 11 +---------- .../practice/yacht/bin/fetch-cobolcheck.ps1 | 6 ++++-- 92 files changed, 393 insertions(+), 739 deletions(-) diff --git a/exercises/practice/acronym/bin/fetch-cobolcheck b/exercises/practice/acronym/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/acronym/bin/fetch-cobolcheck +++ b/exercises/practice/acronym/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/acronym/bin/fetch-cobolcheck.ps1 b/exercises/practice/acronym/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/acronym/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/acronym/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/all-your-base/bin/fetch-cobolcheck b/exercises/practice/all-your-base/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/all-your-base/bin/fetch-cobolcheck +++ b/exercises/practice/all-your-base/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/all-your-base/bin/fetch-cobolcheck.ps1 b/exercises/practice/all-your-base/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/all-your-base/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/all-your-base/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/allergies/bin/fetch-cobolcheck b/exercises/practice/allergies/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/allergies/bin/fetch-cobolcheck +++ b/exercises/practice/allergies/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/allergies/bin/fetch-cobolcheck.ps1 b/exercises/practice/allergies/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/allergies/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/allergies/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/anagram/bin/fetch-cobolcheck b/exercises/practice/anagram/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/anagram/bin/fetch-cobolcheck +++ b/exercises/practice/anagram/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/anagram/bin/fetch-cobolcheck.ps1 b/exercises/practice/anagram/bin/fetch-cobolcheck.ps1 index a57f708d..3e9608d1 100644 --- a/exercises/practice/anagram/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/anagram/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/armstrong-numbers/bin/fetch-cobolcheck b/exercises/practice/armstrong-numbers/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/armstrong-numbers/bin/fetch-cobolcheck +++ b/exercises/practice/armstrong-numbers/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/armstrong-numbers/bin/fetch-cobolcheck.ps1 b/exercises/practice/armstrong-numbers/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/armstrong-numbers/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/armstrong-numbers/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/atbash-cipher/bin/fetch-cobolcheck b/exercises/practice/atbash-cipher/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/atbash-cipher/bin/fetch-cobolcheck +++ b/exercises/practice/atbash-cipher/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/atbash-cipher/bin/fetch-cobolcheck.ps1 b/exercises/practice/atbash-cipher/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/atbash-cipher/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/atbash-cipher/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/binary-search/bin/fetch-cobolcheck b/exercises/practice/binary-search/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/binary-search/bin/fetch-cobolcheck +++ b/exercises/practice/binary-search/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/binary-search/bin/fetch-cobolcheck.ps1 b/exercises/practice/binary-search/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/binary-search/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/binary-search/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/binary/bin/fetch-cobolcheck b/exercises/practice/binary/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/binary/bin/fetch-cobolcheck +++ b/exercises/practice/binary/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/binary/bin/fetch-cobolcheck.ps1 b/exercises/practice/binary/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/binary/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/binary/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/bob/bin/fetch-cobolcheck b/exercises/practice/bob/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/bob/bin/fetch-cobolcheck +++ b/exercises/practice/bob/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/bob/bin/fetch-cobolcheck.ps1 b/exercises/practice/bob/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/bob/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/bob/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/circular-buffer/bin/fetch-cobolcheck b/exercises/practice/circular-buffer/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/circular-buffer/bin/fetch-cobolcheck +++ b/exercises/practice/circular-buffer/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/circular-buffer/bin/fetch-cobolcheck.ps1 b/exercises/practice/circular-buffer/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/circular-buffer/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/circular-buffer/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/collatz-conjecture/bin/fetch-cobolcheck b/exercises/practice/collatz-conjecture/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/collatz-conjecture/bin/fetch-cobolcheck +++ b/exercises/practice/collatz-conjecture/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/collatz-conjecture/bin/fetch-cobolcheck.ps1 b/exercises/practice/collatz-conjecture/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/collatz-conjecture/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/collatz-conjecture/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/complex-numbers/bin/fetch-cobolcheck b/exercises/practice/complex-numbers/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/complex-numbers/bin/fetch-cobolcheck +++ b/exercises/practice/complex-numbers/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/complex-numbers/bin/fetch-cobolcheck.ps1 b/exercises/practice/complex-numbers/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/complex-numbers/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/complex-numbers/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/darts/bin/fetch-cobolcheck b/exercises/practice/darts/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/darts/bin/fetch-cobolcheck +++ b/exercises/practice/darts/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/darts/bin/fetch-cobolcheck.ps1 b/exercises/practice/darts/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/darts/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/darts/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/diamond/bin/fetch-cobolcheck b/exercises/practice/diamond/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/diamond/bin/fetch-cobolcheck +++ b/exercises/practice/diamond/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/diamond/bin/fetch-cobolcheck.ps1 b/exercises/practice/diamond/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/diamond/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/diamond/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/difference-of-squares/bin/fetch-cobolcheck b/exercises/practice/difference-of-squares/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/difference-of-squares/bin/fetch-cobolcheck +++ b/exercises/practice/difference-of-squares/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/difference-of-squares/bin/fetch-cobolcheck.ps1 b/exercises/practice/difference-of-squares/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/difference-of-squares/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/difference-of-squares/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/eliuds-eggs/bin/fetch-cobolcheck b/exercises/practice/eliuds-eggs/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/eliuds-eggs/bin/fetch-cobolcheck +++ b/exercises/practice/eliuds-eggs/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/eliuds-eggs/bin/fetch-cobolcheck.ps1 b/exercises/practice/eliuds-eggs/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/eliuds-eggs/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/eliuds-eggs/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/grade-school/bin/fetch-cobolcheck b/exercises/practice/grade-school/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/grade-school/bin/fetch-cobolcheck +++ b/exercises/practice/grade-school/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/grade-school/bin/fetch-cobolcheck.ps1 b/exercises/practice/grade-school/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/grade-school/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/grade-school/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/hamming/bin/fetch-cobolcheck b/exercises/practice/hamming/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/hamming/bin/fetch-cobolcheck +++ b/exercises/practice/hamming/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/hamming/bin/fetch-cobolcheck.ps1 b/exercises/practice/hamming/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/hamming/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/hamming/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/hello-world/bin/fetch-cobolcheck b/exercises/practice/hello-world/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/hello-world/bin/fetch-cobolcheck +++ b/exercises/practice/hello-world/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/hello-world/bin/fetch-cobolcheck.ps1 b/exercises/practice/hello-world/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/hello-world/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/hello-world/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/high-scores/bin/fetch-cobolcheck b/exercises/practice/high-scores/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/high-scores/bin/fetch-cobolcheck +++ b/exercises/practice/high-scores/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/high-scores/bin/fetch-cobolcheck.ps1 b/exercises/practice/high-scores/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/high-scores/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/high-scores/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/isogram/bin/fetch-cobolcheck b/exercises/practice/isogram/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/isogram/bin/fetch-cobolcheck +++ b/exercises/practice/isogram/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/isogram/bin/fetch-cobolcheck.ps1 b/exercises/practice/isogram/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/isogram/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/isogram/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/knapsack/bin/fetch-cobolcheck b/exercises/practice/knapsack/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/knapsack/bin/fetch-cobolcheck +++ b/exercises/practice/knapsack/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/knapsack/bin/fetch-cobolcheck.ps1 b/exercises/practice/knapsack/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/knapsack/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/knapsack/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/leap/bin/fetch-cobolcheck b/exercises/practice/leap/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/leap/bin/fetch-cobolcheck +++ b/exercises/practice/leap/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/leap/bin/fetch-cobolcheck.ps1 b/exercises/practice/leap/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/leap/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/leap/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/luhn/bin/fetch-cobolcheck b/exercises/practice/luhn/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/luhn/bin/fetch-cobolcheck +++ b/exercises/practice/luhn/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/luhn/bin/fetch-cobolcheck.ps1 b/exercises/practice/luhn/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/luhn/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/luhn/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/matching-brackets/bin/fetch-cobolcheck b/exercises/practice/matching-brackets/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/matching-brackets/bin/fetch-cobolcheck +++ b/exercises/practice/matching-brackets/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/matching-brackets/bin/fetch-cobolcheck.ps1 b/exercises/practice/matching-brackets/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/matching-brackets/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/matching-brackets/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/meetup/bin/fetch-cobolcheck b/exercises/practice/meetup/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/meetup/bin/fetch-cobolcheck +++ b/exercises/practice/meetup/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/meetup/bin/fetch-cobolcheck.ps1 b/exercises/practice/meetup/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/meetup/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/meetup/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/nucleotide-count/bin/fetch-cobolcheck b/exercises/practice/nucleotide-count/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/nucleotide-count/bin/fetch-cobolcheck +++ b/exercises/practice/nucleotide-count/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/nucleotide-count/bin/fetch-cobolcheck.ps1 b/exercises/practice/nucleotide-count/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/nucleotide-count/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/nucleotide-count/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/pangram/bin/fetch-cobolcheck b/exercises/practice/pangram/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/pangram/bin/fetch-cobolcheck +++ b/exercises/practice/pangram/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/pangram/bin/fetch-cobolcheck.ps1 b/exercises/practice/pangram/bin/fetch-cobolcheck.ps1 index a57f708d..3e9608d1 100644 --- a/exercises/practice/pangram/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/pangram/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/pascals-triangle/bin/fetch-cobolcheck b/exercises/practice/pascals-triangle/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/pascals-triangle/bin/fetch-cobolcheck +++ b/exercises/practice/pascals-triangle/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/pascals-triangle/bin/fetch-cobolcheck.ps1 b/exercises/practice/pascals-triangle/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/pascals-triangle/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/pascals-triangle/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/pig-latin/bin/fetch-cobolcheck b/exercises/practice/pig-latin/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/pig-latin/bin/fetch-cobolcheck +++ b/exercises/practice/pig-latin/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/pig-latin/bin/fetch-cobolcheck.ps1 b/exercises/practice/pig-latin/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/pig-latin/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/pig-latin/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/protein-translation/bin/fetch-cobolcheck b/exercises/practice/protein-translation/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/protein-translation/bin/fetch-cobolcheck +++ b/exercises/practice/protein-translation/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/protein-translation/bin/fetch-cobolcheck.ps1 b/exercises/practice/protein-translation/bin/fetch-cobolcheck.ps1 index 1535c6e8..3e9608d1 100644 --- a/exercises/practice/protein-translation/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/protein-translation/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/queen-attack/bin/fetch-cobolcheck b/exercises/practice/queen-attack/bin/fetch-cobolcheck index 64230fe2..16c73077 100644 --- a/exercises/practice/queen-attack/bin/fetch-cobolcheck +++ b/exercises/practice/queen-attack/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/queen-attack/bin/fetch-cobolcheck.ps1 b/exercises/practice/queen-attack/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/queen-attack/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/queen-attack/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/raindrops/bin/fetch-cobolcheck b/exercises/practice/raindrops/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/raindrops/bin/fetch-cobolcheck +++ b/exercises/practice/raindrops/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/raindrops/bin/fetch-cobolcheck.ps1 b/exercises/practice/raindrops/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/raindrops/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/raindrops/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/reverse-string/bin/fetch-cobolcheck b/exercises/practice/reverse-string/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/reverse-string/bin/fetch-cobolcheck +++ b/exercises/practice/reverse-string/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/reverse-string/bin/fetch-cobolcheck.ps1 b/exercises/practice/reverse-string/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/reverse-string/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/reverse-string/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/rna-transcription/bin/fetch-cobolcheck b/exercises/practice/rna-transcription/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/rna-transcription/bin/fetch-cobolcheck +++ b/exercises/practice/rna-transcription/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/rna-transcription/bin/fetch-cobolcheck.ps1 b/exercises/practice/rna-transcription/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/rna-transcription/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/rna-transcription/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/robot-simulator/bin/fetch-cobolcheck b/exercises/practice/robot-simulator/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/robot-simulator/bin/fetch-cobolcheck +++ b/exercises/practice/robot-simulator/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/robot-simulator/bin/fetch-cobolcheck.ps1 b/exercises/practice/robot-simulator/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/robot-simulator/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/robot-simulator/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/roman-numerals/bin/fetch-cobolcheck b/exercises/practice/roman-numerals/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/roman-numerals/bin/fetch-cobolcheck +++ b/exercises/practice/roman-numerals/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/roman-numerals/bin/fetch-cobolcheck.ps1 b/exercises/practice/roman-numerals/bin/fetch-cobolcheck.ps1 index a57f708d..3e9608d1 100644 --- a/exercises/practice/roman-numerals/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/roman-numerals/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/rotational-cipher/bin/fetch-cobolcheck b/exercises/practice/rotational-cipher/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/rotational-cipher/bin/fetch-cobolcheck +++ b/exercises/practice/rotational-cipher/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/rotational-cipher/bin/fetch-cobolcheck.ps1 b/exercises/practice/rotational-cipher/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/rotational-cipher/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/rotational-cipher/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/scrabble-score/bin/fetch-cobolcheck b/exercises/practice/scrabble-score/bin/fetch-cobolcheck index 64230fe2..16c73077 100644 --- a/exercises/practice/scrabble-score/bin/fetch-cobolcheck +++ b/exercises/practice/scrabble-score/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/scrabble-score/bin/fetch-cobolcheck.ps1 b/exercises/practice/scrabble-score/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/scrabble-score/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/scrabble-score/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/secret-handshake/bin/fetch-cobolcheck b/exercises/practice/secret-handshake/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/secret-handshake/bin/fetch-cobolcheck +++ b/exercises/practice/secret-handshake/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/secret-handshake/bin/fetch-cobolcheck.ps1 b/exercises/practice/secret-handshake/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/secret-handshake/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/secret-handshake/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/sieve/bin/fetch-cobolcheck b/exercises/practice/sieve/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/sieve/bin/fetch-cobolcheck +++ b/exercises/practice/sieve/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/sieve/bin/fetch-cobolcheck.ps1 b/exercises/practice/sieve/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/sieve/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/sieve/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/space-age/bin/fetch-cobolcheck b/exercises/practice/space-age/bin/fetch-cobolcheck index 64230fe2..16c73077 100755 --- a/exercises/practice/space-age/bin/fetch-cobolcheck +++ b/exercises/practice/space-age/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/space-age/bin/fetch-cobolcheck.ps1 b/exercises/practice/space-age/bin/fetch-cobolcheck.ps1 index 261f5f45..3e9608d1 100644 --- a/exercises/practice/space-age/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/space-age/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/square-root/bin/fetch-cobolcheck b/exercises/practice/square-root/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/square-root/bin/fetch-cobolcheck +++ b/exercises/practice/square-root/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/square-root/bin/fetch-cobolcheck.ps1 b/exercises/practice/square-root/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/square-root/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/square-root/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/triangle/bin/fetch-cobolcheck b/exercises/practice/triangle/bin/fetch-cobolcheck index 64230fe2..16c73077 100644 --- a/exercises/practice/triangle/bin/fetch-cobolcheck +++ b/exercises/practice/triangle/bin/fetch-cobolcheck @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# This file is a copy of the -# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet file. -# Please submit bugfixes/improvements to the above file to ensure that all tracks benefit from the changes. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! -# set -eo pipefail +set -eo pipefail readonly LATEST='https://api.github.com/repos/0xE282B0/cobol-check/releases/latest' @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/triangle/bin/fetch-cobolcheck.ps1 b/exercises/practice/triangle/bin/fetch-cobolcheck.ps1 index 1535c6e8..3e9608d1 100644 --- a/exercises/practice/triangle/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/triangle/bin/fetch-cobolcheck.ps1 @@ -1,7 +1,6 @@ -# 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. +# This file is inspired by https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1. +# It is only used in the cobol track, and a copy of it is placed in every exercise folder. +# If you change something, make sure to upgrade all scripts in all exercises! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" @@ -24,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/two-fer/bin/fetch-cobolcheck b/exercises/practice/two-fer/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/two-fer/bin/fetch-cobolcheck +++ b/exercises/practice/two-fer/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/two-fer/bin/fetch-cobolcheck.ps1 b/exercises/practice/two-fer/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/two-fer/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/two-fer/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts diff --git a/exercises/practice/yacht/bin/fetch-cobolcheck b/exercises/practice/yacht/bin/fetch-cobolcheck index dd8159be..16c73077 100755 --- a/exercises/practice/yacht/bin/fetch-cobolcheck +++ b/exercises/practice/yacht/bin/fetch-cobolcheck @@ -45,16 +45,7 @@ get_download_url() { } main() { - if [[ -d ./bin ]]; then - output_dir="./bin" - elif [[ $PWD == */bin ]]; then - output_dir="$PWD" - else - echo "Error: no ./bin directory found. This script should be ran from a repo root." >&2 - return 1 - fi - - output_path="${output_dir}/cobolcheck${ext}" + output_path="/usr/local/bin/cobolcheck${ext}" download_url="$(get_download_url)" curl "${curlopts[@]}" --output "${output_path}" "${download_url}" chmod +x "${output_path}" diff --git a/exercises/practice/yacht/bin/fetch-cobolcheck.ps1 b/exercises/practice/yacht/bin/fetch-cobolcheck.ps1 index 65ca602d..3e9608d1 100644 --- a/exercises/practice/yacht/bin/fetch-cobolcheck.ps1 +++ b/exercises/practice/yacht/bin/fetch-cobolcheck.ps1 @@ -23,5 +23,7 @@ Function Get-DownloadUrl { } $downloadUrl = Get-DownloadUrl -$outputFile = Join-Path -Path $PSScriptRoot -ChildPath "cobolcheck.exe" -Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts \ No newline at end of file +$outputDir = Join-Path -Path $HOME -ChildPath "cobolcheck" +$outputFile = Join-Path -Path $outputDir -ChildPath "cobolcheck.exe" +New-Item -ItemType Directory -Path $outputDir -Force | Out-Null +Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile @requestOpts