Skip to content

Commit

Permalink
Formatted and linted
Browse files Browse the repository at this point in the history
  • Loading branch information
jrrom committed Nov 5, 2023
1 parent 88eee40 commit d0b170e
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,33 @@ download_release() {
version="$1"
filename="$2"


if [[ "$OSTYPE" == "linux-gnu"* ]]; then
bin="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
# spago release artifacts have changed names over time for macOS.
#
# - "osx.tar.gz" up to and including 0.17.0 (other than a few exceptions)
# - "macOS-latest.tar.gz" for 0.18.0
# - "macOS.tar.gz" for 0.18.1 onwards (up to 0.19.0 as of this writing)
#
# There are a few other outlier versions which might not be handled here, and the very
# early versions don't seem to contain an executable named "spago" so those don't work either.
#
# See https://github.com/purescript/spago/releases for release artifact filenames
major_version=$(echo $version | cut -d'.' -f1)
minor_version=$(echo $version | cut -d'.' -f2)
if [[ "$version" == "0.18.0" ]]; then
bin="macOS-latest"
elif (($major_version == 0 && $minor_version < 18)); then
bin="osx"
else
bin="macOS"
fi
else
fail "unrecognized operating system $OSTYPE"
fi

url="$GH_REPO/releases/download/${version}/${bin}.tar.gz"
bin="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
# spago release artifacts have changed names over time for macOS.
#
# - "osx.tar.gz" up to and including 0.17.0 (other than a few exceptions)
# - "macOS-latest.tar.gz" for 0.18.0
# - "macOS.tar.gz" for 0.18.1 onwards (up to 0.19.0 as of this writing)
#
# There are a few other outlier versions which might not be handled here, and the very
# early versions don't seem to contain an executable named "spago" so those don't work either.
#
# See https://github.com/purescript/spago/releases for release artifact filenames
major_version=$(echo "$version" | cut -d'.' -f1)
minor_version=$(echo "$version" | cut -d'.' -f2)
if [[ "$version" == "0.18.0" ]]; then
bin="macOS-latest"
elif (("$major_version" == 0 && "$minor_version" < 18)); then
bin="osx"
else
bin="macOS"
fi
else
fail "unrecognized operating system $OSTYPE"
fi

url="$GH_REPO/releases/download/${version}/${bin}.tar.gz"

echo "* Downloading $TOOL_NAME release $version..."
curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"
Expand Down

0 comments on commit d0b170e

Please sign in to comment.