From 2202f7f6e3d751dfb4889f451fb6fc04990a31b9 Mon Sep 17 00:00:00 2001 From: James Hegedus Date: Thu, 6 Apr 2023 22:10:15 +1000 Subject: [PATCH] fix!: rm asdf update release candidate & sort_versions --- defaults | 1 - docs/manage/configuration.md | 9 --------- docs/pt-br/manage/configuration.md | 1 - docs/zh-hans/manage/configuration.md | 10 ---------- lib/commands/command-update.bash | 19 ++++++------------- 5 files changed, 6 insertions(+), 34 deletions(-) diff --git a/defaults b/defaults index 38227805..14fc8d4b 100644 --- a/defaults +++ b/defaults @@ -1,7 +1,6 @@ # See the docs for explanations: https://asdf-vm.com/manage/configuration.html legacy_version_file = no -use_release_candidates = no always_keep_download = no plugin_repository_last_check_duration = 60 disable_plugin_short_name_repository = no diff --git a/docs/manage/configuration.md b/docs/manage/configuration.md index 2e714b90..9a1474d0 100644 --- a/docs/manage/configuration.md +++ b/docs/manage/configuration.md @@ -69,15 +69,6 @@ Plugins **with support** can read the versions files used by other version manag | `no` | Use `.tool-versions` to read versions | | `yes` | Use plugin fallback to legacy version files (`.ruby-version`) if available | -### `use_release_candidates` - -Configure the `asdf update` command to upgrade to the latest Release Candidate instead of the latest Semantic Version. - -| Options | Description | -| :--------------------------------------------------------- | :------------------------ | -| `no` | Semantic Version is used | -| `yes` | Release Candidate is used | - ### `always_keep_download` Configure the `asdf install` command to keep or delete the source code or binary it downloads. diff --git a/docs/pt-br/manage/configuration.md b/docs/pt-br/manage/configuration.md index d0b2f968..da5aa1a8 100644 --- a/docs/pt-br/manage/configuration.md +++ b/docs/pt-br/manage/configuration.md @@ -48,7 +48,6 @@ legacy_version_file = yes **Configurações** - `legacy_version_file` - por padrão é `no`. Se definido como `yes`, fará com que os plug-ins que suportam esse recurso leiam os arquivos de versão usados por outros gerenciadores de versão (por exemplo, `.ruby-version` no caso do `rbenv` do Ruby). -- `use_release_candidates` - por padrão é `no`. Se definido como `yes`, fará com que o comando `asdf update` atualize para o mais recente em vez da versão semântica mais recente. - `always_keep_download` - por padrão é `no`. Se definido como `yes`, fará com que o `asdf install` sempre mantenha o código-fonte ou binário baixado. Se definido como `no`, o código fonte ou binário baixado por `asdf install` será excluído após a instalação bem sucedida. diff --git a/docs/zh-hans/manage/configuration.md b/docs/zh-hans/manage/configuration.md index 2923c4dd..ed64340d 100644 --- a/docs/zh-hans/manage/configuration.md +++ b/docs/zh-hans/manage/configuration.md @@ -54,7 +54,6 @@ python 3.7.2 2.7.15 system ```:no-line-numbers legacy_version_file = no -use_release_candidates = no always_keep_download = no plugin_repository_last_check_duration = 60 ``` @@ -68,15 +67,6 @@ plugin_repository_last_check_duration = 60 | `no` | 从 `.tool-versions` 文件读取版本 | | `yes` | 如果可行的话,从传统版本文件读取版本(`.ruby-versions`) | -### `use_release_candidates` - -配置 `asdf update` 命令以升级到最新的候选版本,而不是最新的语义版本。 - -| 选项 | 描述 | -| :------------------------------------------------------ | :------------- | -| `no` | 语义版本被使用 | -| `yes` | 候选版本被使用 | - ### `always_keep_download` 配置 `asdf install` 命令以保留或删除下载的源代码或二进制文件。 diff --git a/lib/commands/command-update.bash b/lib/commands/command-update.bash index f9912645..f5078e55 100644 --- a/lib/commands/command-update.bash +++ b/lib/commands/command-update.bash @@ -26,15 +26,14 @@ do_update() { printf "Updated asdf to latest on the master branch\n" else # Update to latest release + local sha_of_tag + local tag + + # fetch tags from remote git fetch origin --tags || exit 1 - if [ "$(get_asdf_config_value "use_release_candidates")" = "yes" ]; then - # Use the latest tag whether or not it is an RC - tag=$(git tag | sort_versions | sed '$!d') || exit 1 - else - # Exclude RC tags when selecting latest tag - tag=$(git tag | sort_versions | grep -vi "rc" | sed '$!d') || exit 1 - fi + sha_of_tag=$(git rev-list --tags --max-count=1) || exit 1 + tag=$(git describe --tags "$sha_of_tag") || exit 1 # Update git checkout "$tag" || exit 1 @@ -42,10 +41,4 @@ do_update() { fi } -# stolen from https://github.com/rbenv/ruby-build/pull/631/files#diff-fdcfb8a18714b33b07529b7d02b54f1dR942 -sort_versions() { - sed 'h; s/[+-]/./g; s/.p\([[:digit:]]\)/.z\1/; s/$/.z/; G; s/\n/ /' | - LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n | awk '{print $2}' -} - update_command "$@"