From e378f02a08c6ddb45d354b7e5b2a34d33c5842bf Mon Sep 17 00:00:00 2001 From: jmcubel Date: Wed, 25 Oct 2023 13:36:44 +0200 Subject: [PATCH 1/3] feat: Adapt scripts to jfrog-cli-v2-jf --- README.md | 9 +++++---- bin/download | 7 +++++-- lib/utils.bash | 16 ++++++++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 67849d2..d4f4a24 100644 --- a/README.md +++ b/README.md @@ -22,22 +22,23 @@ Plugin: ```shell -asdf plugin add jfrog-cli +asdf plugin add jfrog-cli-v2-jf # or asdf plugin add jfrog-cli https://github.com/LozanoMatheus/asdf-jfrog-cli.git +asdf plugin add jfrog-cli-v2-jf https://github.com/jmcubel/asdf-jfrog-cli.git ``` jfrog-cli: ```shell # Show all installable versions -asdf list-all jfrog-cli +asdf list-all jfrog-cli-v2-jf # Install specific version -asdf install jfrog-cli latest +asdf install jfrog-cli-v2-jf latest # Set a version globally (on your ~/.tool-versions file) -asdf global jfrog-cli latest +asdf global jfrog-cli-v2-jf latest # Now jfrog-cli commands are available Please, check the official documentation in the section Commands Summary: diff --git a/bin/download b/bin/download index 4e9432d..34a92b3 100755 --- a/bin/download +++ b/bin/download @@ -15,8 +15,11 @@ os_name="$(get_os_name)" arch="$(get_arch)" release_file="${ASDF_DOWNLOAD_PATH}/${TOOL_NAME}" - -download_release "${ASDF_INSTALL_VERSION}" "${os_name}" "${arch}" "${release_file}" +if [ "$os_name" == "mac" ] && [ "$arch" != "arm64" ] ; then + download_release "${ASDF_INSTALL_VERSION}" "${os_name}" "386" "${release_file}" +else + download_release "${ASDF_INSTALL_VERSION}" "${os_name}" "${arch}" "${release_file}" +fi \mv "${ASDF_DOWNLOAD_PATH}/${TOOL_NAME}" "${ASDF_DOWNLOAD_PATH}/${TOOL_SHORT_NAME}" diff --git a/lib/utils.bash b/lib/utils.bash index cb7f814..2749564 100755 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -3,8 +3,7 @@ set -euo pipefail REPO="jfrog/jfrog-cli" -TOOL_LONG_NAME="jfrog-cli" -TOOL_NAME="jfrog" +TOOL_NAME="jfrog-cli-v2-jf" TOOL_SHORT_NAME="jf" TOOL_TEST="${TOOL_SHORT_NAME} --version" @@ -31,7 +30,7 @@ list_github_tags() { local RC="0" set +euo pipefail while [ ${RC} -eq 0 ]; do - GH_RELEASES_PAGE=$((${GH_RELEASES_PAGE} + 1)) + GH_RELEASES_PAGE=$((GH_RELEASES_PAGE + 1)) GH_RELEASES="${GH_RELEASES}$(curl "${CURL_OPTS[@]}" "https://api.github.com/repos/${REPO}/releases?per_page=100&page=${GH_RELEASES_PAGE}" | awk '/tag_name/{ rc = 1; gsub(/,|"/,"") ; print $2 }; END { exit !rc }')" RC="${?}" done @@ -52,7 +51,16 @@ download_release() { arch="$3" filename="$4" - url="https://releases.jfrog.io/artifactory/jfrog-cli/v${cli_major_version}/${version}/jfrog-cli-${os_name}-${arch}/jfrog" + if [ "$cli_major_version" -eq 2 ]; then + effective_cli_major_version=2-jf + jfrog_client=jf + else + effective_cli_major_version=$cli_major_version + jfrog_client=jfrog + fi + + #url="https://releases.jfrog.io/artifactory/jfrog-cli/v${cli_major_version}/${version}/jfrog-cli-${os_name}-${arch}/jfrog" + url="https://releases.jfrog.io/artifactory/jfrog-cli/v${effective_cli_major_version}/${version}/jfrog-cli-${os_name}-${arch}/${jfrog_client}" echo "* Downloading $TOOL_NAME release $version..." curl "${CURL_OPTS[@]}" -o "$filename" -C - "$url" || fail "Could not download $url" From 8773b4d89382c85b573c2f78009f6445122bc027 Mon Sep 17 00:00:00 2001 From: jmcubel Date: Wed, 25 Oct 2023 14:06:31 +0200 Subject: [PATCH 2/3] feat: Undo unnecesary changes. Remove comments --- README.md | 9 ++++----- lib/utils.bash | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d4f4a24..67849d2 100644 --- a/README.md +++ b/README.md @@ -22,23 +22,22 @@ Plugin: ```shell -asdf plugin add jfrog-cli-v2-jf +asdf plugin add jfrog-cli # or asdf plugin add jfrog-cli https://github.com/LozanoMatheus/asdf-jfrog-cli.git -asdf plugin add jfrog-cli-v2-jf https://github.com/jmcubel/asdf-jfrog-cli.git ``` jfrog-cli: ```shell # Show all installable versions -asdf list-all jfrog-cli-v2-jf +asdf list-all jfrog-cli # Install specific version -asdf install jfrog-cli-v2-jf latest +asdf install jfrog-cli latest # Set a version globally (on your ~/.tool-versions file) -asdf global jfrog-cli-v2-jf latest +asdf global jfrog-cli latest # Now jfrog-cli commands are available Please, check the official documentation in the section Commands Summary: diff --git a/lib/utils.bash b/lib/utils.bash index 2749564..b541eb6 100755 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -3,7 +3,7 @@ set -euo pipefail REPO="jfrog/jfrog-cli" -TOOL_NAME="jfrog-cli-v2-jf" +TOOL_NAME="jfrog-cli" TOOL_SHORT_NAME="jf" TOOL_TEST="${TOOL_SHORT_NAME} --version" @@ -53,14 +53,13 @@ download_release() { if [ "$cli_major_version" -eq 2 ]; then effective_cli_major_version=2-jf - jfrog_client=jf + jfrog_cli_name=jf else effective_cli_major_version=$cli_major_version - jfrog_client=jfrog + jfrog_cli_name=jfrog fi - #url="https://releases.jfrog.io/artifactory/jfrog-cli/v${cli_major_version}/${version}/jfrog-cli-${os_name}-${arch}/jfrog" - url="https://releases.jfrog.io/artifactory/jfrog-cli/v${effective_cli_major_version}/${version}/jfrog-cli-${os_name}-${arch}/${jfrog_client}" + url="https://releases.jfrog.io/artifactory/jfrog-cli/v${effective_cli_major_version}/${version}/jfrog-cli-${os_name}-${arch}/${jfrog_cli_name}" echo "* Downloading $TOOL_NAME release $version..." curl "${CURL_OPTS[@]}" -o "$filename" -C - "$url" || fail "Could not download $url" From 4f2df94817e4a3608113091ecfb2ac65c50c6490 Mon Sep 17 00:00:00 2001 From: Matheus Lozano Date: Wed, 25 Oct 2023 23:16:08 +0200 Subject: [PATCH 3/3] feat: Fix shfmt --- bin/download | 8 ++++---- lib/utils.bash | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/download b/bin/download index 34a92b3..3554f1a 100755 --- a/bin/download +++ b/bin/download @@ -15,10 +15,10 @@ os_name="$(get_os_name)" arch="$(get_arch)" release_file="${ASDF_DOWNLOAD_PATH}/${TOOL_NAME}" -if [ "$os_name" == "mac" ] && [ "$arch" != "arm64" ] ; then - download_release "${ASDF_INSTALL_VERSION}" "${os_name}" "386" "${release_file}" -else - download_release "${ASDF_INSTALL_VERSION}" "${os_name}" "${arch}" "${release_file}" +if [ "$os_name" == "mac" ] && [ "$arch" != "arm64" ]; then + download_release "${ASDF_INSTALL_VERSION}" "${os_name}" "386" "${release_file}" +else + download_release "${ASDF_INSTALL_VERSION}" "${os_name}" "${arch}" "${release_file}" fi \mv "${ASDF_DOWNLOAD_PATH}/${TOOL_NAME}" "${ASDF_DOWNLOAD_PATH}/${TOOL_SHORT_NAME}" diff --git a/lib/utils.bash b/lib/utils.bash index b541eb6..82b50e4 100755 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -57,7 +57,7 @@ download_release() { else effective_cli_major_version=$cli_major_version jfrog_cli_name=jfrog - fi + fi url="https://releases.jfrog.io/artifactory/jfrog-cli/v${effective_cli_major_version}/${version}/jfrog-cli-${os_name}-${arch}/${jfrog_cli_name}"