From 62988aaffa9e8e1d578dbebcb853fe46455b3d5f Mon Sep 17 00:00:00 2001 From: John Martel Date: Tue, 16 Jan 2024 19:38:58 -0500 Subject: [PATCH] fix: clone shorebird repo instead of downloading archive The shorebird CLI requires the installation directory to be a clone of the git repository. See: https://github.com/shorebirdtech/shorebird/blob/v0.21.1/third_party/flutter/bin/internal/shared.sh#L210 --- bin/download | 12 ++---------- lib/utils.bash | 8 ++++---- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/bin/download b/bin/download index 38c6411..42bbef3 100755 --- a/bin/download +++ b/bin/download @@ -10,13 +10,5 @@ source "${plugin_dir}/lib/utils.bash" mkdir -p "$ASDF_DOWNLOAD_PATH" -release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz" - -# Download tar.gz file to the download directory -download_release "$ASDF_INSTALL_VERSION" "$release_file" - -# Extract contents of tar.gz file into the download directory -tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1 || fail "Could not extract $release_file" - -# Remove the tar.gz file since we don't need to keep it -rm "$release_file" +# Clone repository to the download directory +download_release "$ASDF_INSTALL_VERSION" diff --git a/lib/utils.bash b/lib/utils.bash index e616c6a..15a44ac 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -35,14 +35,13 @@ list_all_versions() { } download_release() { - local version filename url + local version url version="$1" - filename="$2" - url="$GH_REPO/archive/v${version}.tar.gz" + url="${GH_REPO}.git" echo "* Downloading $TOOL_NAME release $version..." - curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url" + git clone --depth 1 --branch "v$version" "$url" "$ASDF_DOWNLOAD_PATH" } install_version() { @@ -56,6 +55,7 @@ install_version() { ( mkdir -p "$install_path" + cp -r "$ASDF_DOWNLOAD_PATH"/.git "$install_path" cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path" local tool_cmd