Skip to content

Commit

Permalink
perf: cleans up installing
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanrayboss committed Oct 21, 2023
1 parent aa2d4df commit 382b6a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 43 deletions.
3 changes: 0 additions & 3 deletions bin/download
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ source "${plugin_dir}/lib/utils.bash"

mkdir -p "$ASDF_DOWNLOAD_PATH"

# TODO: Adapt this to proper extension and adapt extracting strategy.
release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz"

echo "Release file... $release_file"

# Download tar.gz file to the download directory
download_release "$ASDF_INSTALL_VERSION" "$release_file"

Expand Down
43 changes: 3 additions & 40 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -36,51 +36,14 @@ list_all_versions() {
list_github_tags
}

get_platform() {
local platform
platform=$(uname)
case $platform in
Darwin) platform="darwin" ;;
Linux) platform="linux" ;;
Windows) platform="windows" ;;
esac
echo "$platform"
}

get_system_architecture() {
local architecture
architecture=$(uname -m)
case $architecture in
armv7l) architecture="armv7" ;;
aarch64) architecture="arm64" ;;
i386) architecture="386" ;;
x86_64) architecture="amd64" ;;
esac
echo "$architecture"
}

get_file_extension() {
local extension
platform="$1"
case $platform in
darwin) extension="tar.gz" ;;
linux) extension="tar.gz" ;;
windows) extension="zip" ;;
esac
echo "$extension"
}

download_release() {
local version platform architecture extension filename url
local version filename url
version="$1"
platform="$(get_platform)"
architecture="$(get_system_architecture)"
extension="$(get_file_extension "$platform")"
filename="$2"

url="$GH_REPO/releases/download/v${version}/migrate.${platform}-${architecture}.${extension}"
url="$GH_REPO/archive/v${version}.tar.gz"

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

Expand Down

0 comments on commit 382b6a7

Please sign in to comment.