mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Add support for RC versions to asdf update command
This commit is contained in:
parent
c418eb5976
commit
85057b6969
@ -41,6 +41,7 @@ legacy_version_file = yes
|
||||
**Settings**
|
||||
|
||||
- `legacy_version_file` - defaults to `no`. If set to yes it will cause plugins that support this feature to read the version files used by other version managers (e.g. `.ruby-version` in the case of Ruby's `rbenv`).
|
||||
- `use_release_candidates` - defaults to `no`. If set to yes it will cause the `asdf update` command to upgrade to the latest release candidate release instead of the latest semantic version.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
|
@ -26,7 +26,14 @@ do_update() {
|
||||
else
|
||||
# Update to latest release
|
||||
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
|
||||
|
||||
# Update
|
||||
git checkout "$tag" || exit 1
|
||||
|
@ -29,11 +29,22 @@ teardown() {
|
||||
[ $(git rev-parse --abbrev-ref HEAD) = "master" ]
|
||||
}
|
||||
|
||||
@test "update_command should checkout the latest tag" {
|
||||
@test "update_command should checkout the latest non-RC tag" {
|
||||
local tag=$(git tag | grep -vi "rc" | head -1)
|
||||
run update_command
|
||||
[ "$status" -eq 0 ]
|
||||
cd $ASDF_DIR
|
||||
echo $(git tag) | grep $tag
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "update_command should checkout the latest tag when configured with use_release_candidates = yes" {
|
||||
local tag=$(git tag | head -1)
|
||||
export ASDF_CONFIG_DEFAULT_FILE=$BATS_TMPDIR/asdfrc_defaults
|
||||
echo "use_release_candidates = yes" > $ASDF_CONFIG_DEFAULT_FILE
|
||||
run update_command
|
||||
[ "$status" -eq 0 ]
|
||||
cd $ASDF_DIR
|
||||
local tag=$(git describe --tag)
|
||||
echo $(git tag) | grep $tag
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user