mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
Add rbenv's own rbenv.d
directory to hook paths
This allows rbenv source code to ship with built-in hooks.
This commit is contained in:
parent
bf39d88d11
commit
632263568e
3 changed files with 14 additions and 4 deletions
|
@ -71,15 +71,20 @@ shopt -s nullglob
|
|||
|
||||
bin_path="$(abs_dirname "$0")"
|
||||
for plugin_bin in "${RBENV_ROOT}/plugins/"*/bin; do
|
||||
bin_path="${bin_path}:${plugin_bin}"
|
||||
PATH="${plugin_bin}:${PATH}"
|
||||
done
|
||||
export PATH="${bin_path}:${PATH}"
|
||||
|
||||
hook_path="${RBENV_HOOK_PATH}:${RBENV_ROOT}/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks"
|
||||
RBENV_HOOK_PATH="${RBENV_HOOK_PATH}:${RBENV_ROOT}/rbenv.d"
|
||||
if [ "${bin_path%/*}" != "$RBENV_ROOT" ]; then
|
||||
# Add rbenv's own `rbenv.d` unless rbenv was cloned to RBENV_ROOT
|
||||
RBENV_HOOK_PATH="${RBENV_HOOK_PATH}:${bin_path%/*}/rbenv.d"
|
||||
fi
|
||||
RBENV_HOOK_PATH="${RBENV_HOOK_PATH}:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks"
|
||||
for plugin_hook in "${RBENV_ROOT}/plugins/"*/etc/rbenv.d; do
|
||||
hook_path="${hook_path}:${plugin_hook}"
|
||||
RBENV_HOOK_PATH="${RBENV_HOOK_PATH}:${plugin_hook}"
|
||||
done
|
||||
export RBENV_HOOK_PATH="$hook_path"
|
||||
export RBENV_HOOK_PATH
|
||||
|
||||
shopt -u nullglob
|
||||
|
||||
|
|
Binary file not shown.
|
@ -68,3 +68,8 @@ load test_helper
|
|||
assert_line 1 "/other/hooks"
|
||||
assert_line 2 "${RBENV_ROOT}/rbenv.d"
|
||||
}
|
||||
|
||||
@test "RBENV_HOOK_PATH includes rbenv built-in plugins" {
|
||||
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"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue