From f9fb3c934e2242d82e67e173162f1dfde792fa65 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Fri, 23 Sep 2011 10:43:06 -0500 Subject: [PATCH 1/3] rbenv-plugin-scripts -> rbenv-hooks; RBENV_PLUGIN_PATH -> RBENV_HOOK_PATH --- libexec/rbenv | 2 +- libexec/rbenv-exec | 2 +- libexec/{rbenv-plugin-scripts => rbenv-hooks} | 4 ++-- libexec/rbenv-rehash | 2 +- libexec/rbenv-which | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename libexec/{rbenv-plugin-scripts => rbenv-hooks} (87%) diff --git a/libexec/rbenv b/libexec/rbenv index 8c298493..6fd6d7e4 100755 --- a/libexec/rbenv +++ b/libexec/rbenv @@ -28,7 +28,7 @@ fi export RBENV_ROOT -export RBENV_PLUGIN_PATH="${RBENV_PLUGIN_PATH}:${RBENV_ROOT}/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d" +export RBENV_HOOK_PATH="${RBENV_HOOK_PATH}:${RBENV_ROOT}/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d" libexec_path="$(abs_dirname "$0")" export PATH="${libexec_path}:${PATH}" diff --git a/libexec/rbenv-exec b/libexec/rbenv-exec index 892e17a9..92ecb72b 100755 --- a/libexec/rbenv-exec +++ b/libexec/rbenv-exec @@ -16,7 +16,7 @@ fi RBENV_COMMAND_PATH="$(rbenv-which "$RBENV_COMMAND")" RBENV_BIN_PATH="${RBENV_COMMAND_PATH%/*}" -for script in $(rbenv-plugin-scripts exec); do +for script in $(rbenv-hooks exec); do source "$script" done diff --git a/libexec/rbenv-plugin-scripts b/libexec/rbenv-hooks similarity index 87% rename from libexec/rbenv-plugin-scripts rename to libexec/rbenv-hooks index 34d10809..47ee910a 100755 --- a/libexec/rbenv-plugin-scripts +++ b/libexec/rbenv-hooks @@ -12,7 +12,7 @@ fi RBENV_COMMAND="$1" if [ -z "$RBENV_COMMAND" ]; then - echo "usage: rbenv plugin-scripts COMMAND" >&2 + echo "usage: rbenv hooks COMMAND" >&2 exit 1 fi @@ -36,7 +36,7 @@ realpath() { } shopt -s nullglob -for path in ${RBENV_PLUGIN_PATH//:/$'\n'}; do +for path in ${RBENV_HOOK_PATH//:/$'\n'}; do for script in $path/"$RBENV_COMMAND"/*.bash; do echo $(realpath $script) done diff --git a/libexec/rbenv-rehash b/libexec/rbenv-rehash index ca83c54b..cb7713ef 100755 --- a/libexec/rbenv-rehash +++ b/libexec/rbenv-rehash @@ -70,6 +70,6 @@ make_shims ../versions/*/bin/* # Restore the previous working directory. cd "$CUR_PATH" -for script in $(rbenv-plugin-scripts rehash); do +for script in $(rbenv-hooks rehash); do source "$script" done diff --git a/libexec/rbenv-which b/libexec/rbenv-which index d22a91eb..768e8451 100755 --- a/libexec/rbenv-which +++ b/libexec/rbenv-which @@ -52,7 +52,7 @@ else RBENV_COMMAND_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}/bin/${RBENV_COMMAND}" fi -for script in $(rbenv-plugin-scripts which); do +for script in $(rbenv-hooks which); do source "$script" done From 8ce5e84c218f715c05961b4b6d772a6865e1a2a4 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Fri, 23 Sep 2011 10:44:00 -0500 Subject: [PATCH 2/3] Automatically add ${RBENV_ROOT}/plugins/*/bin to $PATH --- libexec/rbenv | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libexec/rbenv b/libexec/rbenv index 6fd6d7e4..5d087860 100755 --- a/libexec/rbenv +++ b/libexec/rbenv @@ -30,8 +30,16 @@ export RBENV_ROOT export RBENV_HOOK_PATH="${RBENV_HOOK_PATH}:${RBENV_ROOT}/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d" -libexec_path="$(abs_dirname "$0")" -export PATH="${libexec_path}:${PATH}" + +shopt -s nullglob +rbenv_path="$(abs_dirname "$0")" +for plugin_bin in "${RBENV_ROOT}/plugins/"*/bin; do + rbenv_path="${rbenv_path}:${plugin_bin}" +done +shopt -u nullglob + +export PATH="${rbenv_path}:${PATH}" + command="$1" case "$command" in From 10084ae020704f8f364c72461f44b24ffab66534 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Fri, 23 Sep 2011 10:47:45 -0500 Subject: [PATCH 3/3] Automatically add ${RBENV_ROOT}/plugins/*/etc/rbenv.d to $RBENV_HOOK_PATH --- libexec/rbenv | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libexec/rbenv b/libexec/rbenv index 5d087860..2c00d7d7 100755 --- a/libexec/rbenv +++ b/libexec/rbenv @@ -28,17 +28,21 @@ fi export RBENV_ROOT -export RBENV_HOOK_PATH="${RBENV_HOOK_PATH}:${RBENV_ROOT}/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d" - - shopt -s nullglob -rbenv_path="$(abs_dirname "$0")" -for plugin_bin in "${RBENV_ROOT}/plugins/"*/bin; do - rbenv_path="${rbenv_path}:${plugin_bin}" -done -shopt -u nullglob -export PATH="${rbenv_path}:${PATH}" +bin_path="$(abs_dirname "$0")" +for plugin_bin in "${RBENV_ROOT}/plugins/"*/bin; do + bin_path="${bin_path}:${plugin_bin}" +done +export PATH="${bin_path}:${PATH}" + +hook_path="${RBENV_HOOK_PATH}:${RBENV_ROOT}/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d" +for plugin_hook in "${RBENV_ROOT}/plugins/"*/etc/rbenv.d; do + hook_path="${hook_path}:${plugin_hook}" +done +export RBENV_HOOK_PATH="$hook_path" + +shopt -u nullglob command="$1"