mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-16 23:33:45 -05:00
Switch back to resolving symlinks for rbenv executable (#1439)
Considerations: - `./libexec/rbenv` executable is the entrypoint to the program; - BASH_SOURCE might be the path to a symlink that has activated `./libexec/rbenv`; - We must resolve the symlink to learn where rbenv's libexec directory is; - It's not guaranteed that rbenv commands will always remain directly under their own "libexec" directory, since a package maintainer can change that, e.g. rbenv commands are sometimes placed into `/usr/libexec/rbenv/*`; - Resolving symlinks might fail and in that case we just assume rbenv project layout.
This commit is contained in:
@@ -48,7 +48,7 @@ load test_helper
|
||||
|
||||
@test "adds its own libexec to PATH" {
|
||||
run rbenv echo "PATH"
|
||||
assert_success "${BATS_TEST_DIRNAME%/*}/libexec:$PATH"
|
||||
assert_success "${BATS_TEST_DIRNAME}/../libexec:$PATH"
|
||||
}
|
||||
|
||||
@test "adds plugin bin dirs to PATH" {
|
||||
@@ -56,7 +56,7 @@ load test_helper
|
||||
mkdir -p "$RBENV_ROOT"/plugins/rbenv-each/bin
|
||||
run rbenv echo -F: "PATH"
|
||||
assert_success
|
||||
assert_line 0 "${BATS_TEST_DIRNAME%/*}/libexec"
|
||||
assert_line 0 "${BATS_TEST_DIRNAME}/../libexec"
|
||||
assert_line 1 "${RBENV_ROOT}/plugins/ruby-build/bin"
|
||||
assert_line 2 "${RBENV_ROOT}/plugins/rbenv-each/bin"
|
||||
}
|
||||
@@ -72,5 +72,5 @@ load test_helper
|
||||
@test "RBENV_HOOK_PATH includes rbenv built-in plugins" {
|
||||
unset RBENV_HOOK_PATH
|
||||
run rbenv echo "RBENV_HOOK_PATH"
|
||||
assert_success "${RBENV_ROOT}/rbenv.d:${BATS_TEST_DIRNAME%/*}/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks"
|
||||
assert_success "${RBENV_ROOT}/rbenv.d:${BATS_TEST_DIRNAME}/../rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user