Merge pull request #1203 from jf/fix_misleading_set_by_message_for_system_ruby

libexec/rbenv-version: get rid of misleading "set by $(rbenv-version-origin)" message when system ruby is in use
This commit is contained in:
Mislav Marohnić 2020-01-16 19:47:52 +01:00 committed by GitHub
commit 7795476af1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View file

@ -8,4 +8,11 @@
set -e
[ -n "$RBENV_DEBUG" ] && set -x
echo "$(rbenv-version-name) (set by $(rbenv-version-origin))"
version_name="$(rbenv-version-name)"
version_origin="$(rbenv-version-origin)"
if [ "$version_origin" = "${RBENV_ROOT}/version" ] && [ ! -e "$version_origin" ]; then
echo "$version_name"
else
echo "$version_name (set by $version_origin)"
fi

View file

@ -14,7 +14,7 @@ setup() {
@test "no version selected" {
assert [ ! -d "${RBENV_ROOT}/versions" ]
run rbenv-version
assert_success "system (set by ${RBENV_ROOT}/version)"
assert_success "system"
}
@test "set by RBENV_VERSION" {

View file

@ -21,7 +21,7 @@ stub_system_ruby() {
stub_system_ruby
assert [ ! -d "${RBENV_ROOT}/versions" ]
run rbenv-versions
assert_success "* system (set by ${RBENV_ROOT}/version)"
assert_success "* system"
}
@test "not even system ruby available" {
@ -42,7 +42,7 @@ stub_system_ruby() {
run rbenv-versions
assert_success
assert_output <<OUT
* system (set by ${RBENV_ROOT}/version)
* system
1.9
OUT
}
@ -61,7 +61,7 @@ OUT
run rbenv-versions
assert_success
assert_output <<OUT
* system (set by ${RBENV_ROOT}/version)
* system
1.8.7
1.9.3
2.0.0