Skip to content

Commit

Permalink
fix: clone shorebird repo instead of downloading archive
Browse files Browse the repository at this point in the history
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
  • Loading branch information
johnmartel committed Jan 17, 2024
1 parent 648589e commit 62988aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
12 changes: 2 additions & 10 deletions bin/download
Original file line number Diff line number Diff line change
Expand Up @@ -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"
8 changes: 4 additions & 4 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand Down

0 comments on commit 62988aa

Please sign in to comment.