Skip to content

Commit c217736

Browse files
author
Jesus Marquina
committed
fix: Follow URL conventions
1 parent e673e91 commit c217736

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

bin/download

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz"
1717
download_release "$ASDF_INSTALL_VERSION" "$release_file"
1818

1919
# Extract contents of tar.gz file into the download directory
20-
tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1 || fail "Could not extract $release_file"
20+
tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" || fail "Could not extract $release_file"
2121

2222
# Remove the tar.gz file since we don't need to keep it
2323
rm "$release_file"

lib/utils.bash

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -euo pipefail
44

5-
GH_REPO="https://github.com/tufin/oasdiff"
5+
GH_REPO="https://github.com/Tufin/oasdiff"
66
TOOL_NAME="oasdiff"
77
TOOL_TEST="oasdiff --help"
88

@@ -36,17 +36,37 @@ list_all_versions() {
3636
}
3737

3838
download_release() {
39-
local version filename url
39+
local version filename url platform
4040
version="$1"
4141
filename="$2"
42+
platform=$(get_platform)
4243

4344
# TODO: Adapt the release URL convention for oasdiff
44-
url="$GH_REPO/archive/v${version}.tar.gz"
45+
url="$GH_REPO/releases/download/v${version}/${TOOL_NAME}_${version}_$platform.tar.gz"
4546

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

51+
get_platform() {
52+
local version=$1
53+
54+
case $(uname) in
55+
#Linux OS
56+
Linux)
57+
if [ "$(uname -m)" = "aarch64" ]; then
58+
echo "linux-arm64"
59+
else
60+
echo "linux-amd64"
61+
fi
62+
;;
63+
#Mac OS
64+
Darwin)
65+
echo "darwin_all"
66+
;;
67+
esac
68+
}
69+
5070
install_version() {
5171
local install_type="$1"
5272
local version="$2"

0 commit comments

Comments
 (0)