From f0078b3154742874531f14422f7d95959301b725 Mon Sep 17 00:00:00 2001 From: raimon Date: Sat, 23 Sep 2023 10:55:49 +0900 Subject: [PATCH 1/7] Support for changing the name of the distribution archive in v4.1.0 or later --- .github/workflows/build.yml | 4 ++++ bin/download | 23 ++++++++++++++++++----- lib/utils.bash | 6 ++++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6727489..591d6ab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,9 +14,13 @@ jobs: os: - ubuntu-latest - macos-latest + hurl-version: + - 4.0.0 + - 4.1.0 runs-on: ${{ matrix.os }} steps: - name: asdf_plugin_test uses: asdf-vm/actions/plugin-test@v1 with: command: hurl --version + version: ${{ matrix.hurl-version }} diff --git a/bin/download b/bin/download index 0de0276..310a044 100755 --- a/bin/download +++ b/bin/download @@ -14,11 +14,24 @@ uname_s="$(uname -s)" uname_m="$(uname -m)" os="" -case "$uname_s" in -Darwin) os="macos" ;; -Linux) os="linux" ;; -*) fail "OS not supported: $uname_s" ;; -esac +is_using_rust_toolchain=$(verlte "4.1.0" "${ASDF_INSTALL_VERSION}") +if [ "$is_using_rust_toolchain" ]; then + case "$uname_s" in + Darwin) os="macos" ;; + Linux) os="linux" ;; + *) fail "OS not supported: $uname_s" ;; + esac +else + if [ "$uname_m" = "arm64" ]; then + uname_m="aarch64" + fi + + case "$uname_s" in + Darwin) os="apple-dawrin" ;; + Linux) os="unknown-linux-gnu" ;; + *) fail "OS not supported: $uname_s" ;; + esac +fi release_file="${TOOL_NAME}-${ASDF_INSTALL_VERSION}-${uname_m}-${os}.tar.gz" # Download tar.gz file to the download directory diff --git a/lib/utils.bash b/lib/utils.bash index fc46a8d..8d92840 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -33,6 +33,12 @@ list_all_versions() { list_github_tags } +verlte() { + # verlte 2.5.7 2.5.6 && echo "yes" || echo "no" # no + # verlte 2.5.6 2.5.6 && echo "yes" || echo "no" # yes + printf '%s\n' "$1" "$2" | sort -C -V +} + download_release() { local version filename url version="$1" From 8c7079740362bc2f6b2f57e0408a6626d9842494 Mon Sep 17 00:00:00 2001 From: raimon Date: Sat, 23 Sep 2023 11:01:00 +0900 Subject: [PATCH 2/7] Fix typo dawrin ^^ --- bin/download | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/download b/bin/download index 310a044..c67955c 100755 --- a/bin/download +++ b/bin/download @@ -27,7 +27,7 @@ else fi case "$uname_s" in - Darwin) os="apple-dawrin" ;; + Darwin) os="apple-darwin" ;; Linux) os="unknown-linux-gnu" ;; *) fail "OS not supported: $uname_s" ;; esac From 52980835a69a5b42cc8244e8b21118ac6593e9f2 Mon Sep 17 00:00:00 2001 From: raimon Date: Sat, 23 Sep 2023 11:06:06 +0900 Subject: [PATCH 3/7] Bump version to v2 in GitHub Actions --- .github/workflows/build.yml | 2 +- .github/workflows/lint.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 591d6ab..09d2706 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: asdf_plugin_test - uses: asdf-vm/actions/plugin-test@v1 + uses: asdf-vm/actions/plugin-test@v2 with: command: hurl --version version: ${{ matrix.hurl-version }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7758aab..c122977 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v2 - name: Install asdf dependencies - uses: asdf-vm/actions/install@v1 + uses: asdf-vm/actions/install@v2 - name: Run ShellCheck run: scripts/shellcheck.bash @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@v2 - name: Install asdf dependencies - uses: asdf-vm/actions/install@v1 + uses: asdf-vm/actions/install@v2 - name: List file to shfmt run: shfmt -f . From edc3f5cb72a7ece627a70bf1bbd09c3b85ea3e7f Mon Sep 17 00:00:00 2001 From: raimon Date: Sat, 23 Sep 2023 11:10:07 +0900 Subject: [PATCH 4/7] Use v3 of actions/checkout --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c122977..f787797 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install asdf dependencies uses: asdf-vm/actions/install@v2 @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install asdf dependencies uses: asdf-vm/actions/install@v2 From 2dff53fb797f39d3736ccebec639c61431f010f4 Mon Sep 17 00:00:00 2001 From: raimon Date: Sat, 23 Sep 2023 12:12:04 +0900 Subject: [PATCH 5/7] Check version with numeric --- bin/download | 3 +-- lib/utils.bash | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/bin/download b/bin/download index c67955c..1ae264d 100755 --- a/bin/download +++ b/bin/download @@ -14,8 +14,7 @@ uname_s="$(uname -s)" uname_m="$(uname -m)" os="" -is_using_rust_toolchain=$(verlte "4.1.0" "${ASDF_INSTALL_VERSION}") -if [ "$is_using_rust_toolchain" ]; then +if [ "$(numeric_version ${ASDF_INSTALL_VERSION})" -ge "$(numeric_version 4.1.0)" ]; then case "$uname_s" in Darwin) os="macos" ;; Linux) os="linux" ;; diff --git a/lib/utils.bash b/lib/utils.bash index 8d92840..1f2e6cd 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -33,12 +33,11 @@ list_all_versions() { list_github_tags } -verlte() { - # verlte 2.5.7 2.5.6 && echo "yes" || echo "no" # no - # verlte 2.5.6 2.5.6 && echo "yes" || echo "no" # yes - printf '%s\n' "$1" "$2" | sort -C -V +numeric_version() { + echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } + download_release() { local version filename url version="$1" From c438b8bea17149cbe15f9eb1204d8889da236859 Mon Sep 17 00:00:00 2001 From: raimon Date: Sat, 23 Sep 2023 12:19:35 +0900 Subject: [PATCH 6/7] Reverse archive naming --- bin/download | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/download b/bin/download index 1ae264d..57b1189 100755 --- a/bin/download +++ b/bin/download @@ -14,13 +14,8 @@ uname_s="$(uname -s)" uname_m="$(uname -m)" os="" -if [ "$(numeric_version ${ASDF_INSTALL_VERSION})" -ge "$(numeric_version 4.1.0)" ]; then - case "$uname_s" in - Darwin) os="macos" ;; - Linux) os="linux" ;; - *) fail "OS not supported: $uname_s" ;; - esac -else +install_numeric_version=$(numeric_version "${ASDF_INSTALL_VERSION}") +if [ "${install_numeric_version}" -ge "$(numeric_version 4.1.0)" ]; then if [ "$uname_m" = "arm64" ]; then uname_m="aarch64" fi @@ -30,6 +25,12 @@ else Linux) os="unknown-linux-gnu" ;; *) fail "OS not supported: $uname_s" ;; esac +else + case "$uname_s" in + Darwin) os="macos" ;; + Linux) os="linux" ;; + *) fail "OS not supported: $uname_s" ;; + esac fi release_file="${TOOL_NAME}-${ASDF_INSTALL_VERSION}-${uname_m}-${os}.tar.gz" From d6663afeef86b17c6aac12d3de467f1471265eed Mon Sep 17 00:00:00 2001 From: raimon Date: Sat, 23 Sep 2023 12:32:00 +0900 Subject: [PATCH 7/7] Fix formatter --- lib/utils.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/utils.bash b/lib/utils.bash index 1f2e6cd..294f0f6 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -34,10 +34,9 @@ list_all_versions() { } numeric_version() { - echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; + echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }' } - download_release() { local version filename url version="$1"