Display version origin with non-installed versions

This is useful as an indicator where it is coming from.
This commit is contained in:
Daniel Hahler 2015-07-17 17:10:33 +02:00
parent 83ac0fbd94
commit e3982fae38
5 changed files with 5 additions and 5 deletions

View file

@ -23,6 +23,6 @@ if version_exists "$RBENV_VERSION"; then
elif version_exists "${RBENV_VERSION#ruby-}"; then elif version_exists "${RBENV_VERSION#ruby-}"; then
echo "${RBENV_VERSION#ruby-}" echo "${RBENV_VERSION#ruby-}"
else else
echo "rbenv: version \`$RBENV_VERSION' is not installed" >&2 echo "rbenv: version \`$RBENV_VERSION' is not installed (set by $(rbenv-version-origin))" >&2
exit 1 exit 1
fi fi

View file

@ -52,7 +52,7 @@ done
if [ -x "$RBENV_COMMAND_PATH" ]; then if [ -x "$RBENV_COMMAND_PATH" ]; then
echo "$RBENV_COMMAND_PATH" echo "$RBENV_COMMAND_PATH"
elif ! [ -d "${RBENV_ROOT}/versions/${RBENV_VERSION}" ]; then elif ! [ -d "${RBENV_ROOT}/versions/${RBENV_VERSION}" ]; then
echo "rbenv: version \`$RBENV_VERSION' is not installed" >&2 echo "rbenv: version \`$RBENV_VERSION' is not installed (set by $(rbenv-version-origin))" >&2
exit 1 exit 1
else else
echo "rbenv: $RBENV_COMMAND: command not found" >&2 echo "rbenv: $RBENV_COMMAND: command not found" >&2

View file

@ -17,7 +17,7 @@ create_executable() {
@test "fails with invalid version" { @test "fails with invalid version" {
export RBENV_VERSION="2.0" export RBENV_VERSION="2.0"
run rbenv-exec ruby -v run rbenv-exec ruby -v
assert_failure "rbenv: version \`2.0' is not installed" assert_failure "rbenv: version \`2.0' is not installed (set by RBENV_VERSION environment variable)"
} }
@test "completes with names of executables" { @test "completes with names of executables" {

View file

@ -49,7 +49,7 @@ setup() {
@test "missing version" { @test "missing version" {
RBENV_VERSION=1.2 run rbenv-version-name RBENV_VERSION=1.2 run rbenv-version-name
assert_failure "rbenv: version \`1.2' is not installed" assert_failure "rbenv: version \`1.2' is not installed (set by RBENV_VERSION environment variable)"
} }
@test "version with prefix in name" { @test "version with prefix in name" {

View file

@ -59,7 +59,7 @@ create_executable() {
@test "version not installed" { @test "version not installed" {
create_executable "2.0" "rspec" create_executable "2.0" "rspec"
RBENV_VERSION=1.9 run rbenv-which rspec RBENV_VERSION=1.9 run rbenv-which rspec
assert_failure "rbenv: version \`1.9' is not installed" assert_failure "rbenv: version \`1.9' is not installed (set by RBENV_VERSION environment variable)"
} }
@test "no executable found" { @test "no executable found" {