From 27c8ceb4a27a0f226db51ad84114551dead6e20e Mon Sep 17 00:00:00 2001 From: Alexander Stathis Date: Thu, 19 Jun 2025 09:23:43 -0400 Subject: [PATCH 1/8] fix: what the fuck --- bin/download | 2 +- bin/latest-stable | 2 +- lib/utils.bash | 13 ++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/bin/download b/bin/download index c8a1fa3..dbed466 100755 --- a/bin/download +++ b/bin/download @@ -11,4 +11,4 @@ source "${plugin_dir}/lib/utils.bash" mkdir -p "$ASDF_DOWNLOAD_PATH" # Download tar.gz file to the download directory -download_release "$ASDF_INSTALL_VERSION" $(release_file $ASDF_DOWNLOAD_PATH) +download_release "$ASDF_INSTALL_VERSION $(release_file $ASDF_DOWNLOAD_PATH)" diff --git a/bin/latest-stable b/bin/latest-stable index 33401f7..3065a6b 100755 --- a/bin/latest-stable +++ b/bin/latest-stable @@ -23,7 +23,7 @@ printf "redirect url: %s\n" "$redirect_url" >&2 if [[ "$redirect_url" == "$GH_REPO/releases" ]]; then version="$(list_all_versions | sort_versions | tail -n1 | xargs echo)" else - version="$(printf "%s\n" "$redirect_url" | sed 's|.*/tag/v\{0,1\}||' | sed -E $REPLACE_RELEASE_REGEX)" + version="$(printf "%s\n" "$redirect_url" | sed 's|.*/tag/v\{0,1\}||' | sed -E "$REPLACE_RELEASE_REGEX")" fi printf "%s\n" "$version" diff --git a/lib/utils.bash b/lib/utils.bash index 5c5a519..33fc8da 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -16,9 +16,6 @@ escape_slashes() { MAJOR_1_PREFIX='cli/v' MAJOR_2_PREFIX='@biomejs/biome@' -# match either @biomejs/biome@ or cli/v -RELEASE_PREFIX_REGEX='\(@biomejs/biome@\|cli\/v\)' - # match either @biomejs/biome@X.Y.Z or cli/vX.Y.Z RELEASE_REGEX="^\($MAJOR_1_PREFIX\|$MAJOR_2_PREFIX\)[0-9]\+\.[0-9]\+\.[0-9]\+$" REPLACE_RELEASE_REGEX="s/^($(escape_slashes $MAJOR_1_PREFIX)|$(escape_slashes $MAJOR_2_PREFIX))//" @@ -42,13 +39,11 @@ sort_versions() { LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n | awk '{print $2}' } - -# @biomejs/biome@[0-9]\+\.[0-9]\+\.[0-9]\+$ list_github_tags() { git ls-remote --tags --refs "$GH_REPO" | grep -o 'refs/tags/.*' | cut -d/ -f3- | - grep -o $RELEASE_REGEX | # Match semantic versioning tags - sed -E $REPLACE_RELEASE_REGEX + grep -o "$RELEASE_REGEX" | # Match semantic versioning tags + sed -E "$REPLACE_RELEASE_REGEX" } list_all_versions() { @@ -91,6 +86,10 @@ install_version() { local version="$2" local install_path="${3%/bin}/bin" + if [ "$install_type" != "version" ]; then + fail "asdf-$TOOL_NAME supports release installs only" + fi + ( mkdir -p "$install_path" mv $(release_file $ASDF_DOWNLOAD_PATH) "$install_path/$TOOL_NAME" From a16f3afed3bb482d07b23b528233b4825d107afd Mon Sep 17 00:00:00 2001 From: Alexander Stathis Date: Thu, 19 Jun 2025 09:28:19 -0400 Subject: [PATCH 2/8] --- bin/download | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/download b/bin/download index dbed466..5d5e6b0 100755 --- a/bin/download +++ b/bin/download @@ -11,4 +11,4 @@ source "${plugin_dir}/lib/utils.bash" mkdir -p "$ASDF_DOWNLOAD_PATH" # Download tar.gz file to the download directory -download_release "$ASDF_INSTALL_VERSION $(release_file $ASDF_DOWNLOAD_PATH)" +download_release "$ASDF_INSTALL_VERSION" "$(release_file $ASDF_DOWNLOAD_PATH)" From 14fea893c58d08837b1cd8e45de4959cbe397209 Mon Sep 17 00:00:00 2001 From: Alexander Stathis Date: Thu, 19 Jun 2025 09:29:30 -0400 Subject: [PATCH 3/8] --- lib/utils.bash | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/utils.bash b/lib/utils.bash index 33fc8da..ddf5726 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -20,8 +20,6 @@ MAJOR_2_PREFIX='@biomejs/biome@' RELEASE_REGEX="^\($MAJOR_1_PREFIX\|$MAJOR_2_PREFIX\)[0-9]\+\.[0-9]\+\.[0-9]\+$" REPLACE_RELEASE_REGEX="s/^($(escape_slashes $MAJOR_1_PREFIX)|$(escape_slashes $MAJOR_2_PREFIX))//" -echo $MAJOR_1_PREFIX | sed 's/\//\\\//' - fail() { echo -e "asdf-$TOOL_NAME: $*" exit 1 From e0bb0726a814897e3b8b0d552089045873d3f044 Mon Sep 17 00:00:00 2001 From: Alexander Stathis Date: Thu, 19 Jun 2025 09:33:46 -0400 Subject: [PATCH 4/8] --- lib/utils.bash | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/utils.bash b/lib/utils.bash index ddf5726..8f39110 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -69,11 +69,20 @@ release_file() { } download_release() { - local version filename url + local version filename url major_prefix version="$1" filename="$2" - url="$GH_REPO/releases/download/cli/v${version}/biome$(binary_suffix)" + if [[ "$version" =~ "^2" ]]; then + major_prefix="$MAJOR_2_PREFIX" + elif [[ "$version" =~ "^1" ]]; then + major_prefix="$MAJOR_1_PREFIX" + else + fail "Unsupported version: $version" + return 1 + fi + + url="$GH_REPO/releases/download/${major_prefix}${version}/biome$(binary_suffix)" echo "* Downloading $TOOL_NAME release $version..." curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url" From 5a336c64ac809cff50770654f49f29f18e8c9c9b Mon Sep 17 00:00:00 2001 From: Alexander Stathis Date: Thu, 19 Jun 2025 09:36:50 -0400 Subject: [PATCH 5/8] --- lib/utils.bash | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/utils.bash b/lib/utils.bash index 8f39110..f87ee04 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -73,6 +73,9 @@ download_release() { version="$1" filename="$2" + echo "$version" + echo "$filename" + if [[ "$version" =~ "^2" ]]; then major_prefix="$MAJOR_2_PREFIX" elif [[ "$version" =~ "^1" ]]; then From 68ae2a5c49dabcd7e627747ce184b95cb898ab5b Mon Sep 17 00:00:00 2001 From: Alexander Stathis Date: Thu, 19 Jun 2025 09:40:47 -0400 Subject: [PATCH 6/8] --- lib/utils.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utils.bash b/lib/utils.bash index f87ee04..cb69d66 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -76,9 +76,9 @@ download_release() { echo "$version" echo "$filename" - if [[ "$version" =~ "^2" ]]; then + if [[ $version =~ "^2" ]]; then major_prefix="$MAJOR_2_PREFIX" - elif [[ "$version" =~ "^1" ]]; then + elif [[ $version =~ "^1" ]]; then major_prefix="$MAJOR_1_PREFIX" else fail "Unsupported version: $version" From 72798d99282ce5e6789d6b52bf611b025efd26c6 Mon Sep 17 00:00:00 2001 From: Alexander Stathis Date: Thu, 19 Jun 2025 09:42:36 -0400 Subject: [PATCH 7/8] --- lib/utils.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utils.bash b/lib/utils.bash index cb69d66..c873eae 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -76,9 +76,9 @@ download_release() { echo "$version" echo "$filename" - if [[ $version =~ "^2" ]]; then + if [[ $version =~ ^2 ]]; then major_prefix="$MAJOR_2_PREFIX" - elif [[ $version =~ "^1" ]]; then + elif [[ $version =~ ^1 ]]; then major_prefix="$MAJOR_1_PREFIX" else fail "Unsupported version: $version" From 1d5b11c8c0eab2d4d00b4fb3aa2ad4029ac2e440 Mon Sep 17 00:00:00 2001 From: Alexander Stathis Date: Thu, 19 Jun 2025 09:43:07 -0400 Subject: [PATCH 8/8] --- lib/utils.bash | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/utils.bash b/lib/utils.bash index c873eae..fb9c9ca 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -73,9 +73,6 @@ download_release() { version="$1" filename="$2" - echo "$version" - echo "$filename" - if [[ $version =~ ^2 ]]; then major_prefix="$MAJOR_2_PREFIX" elif [[ $version =~ ^1 ]]; then