Merge pull request #96 from sstephenson/plugin-config

Plugin Config
This commit is contained in:
Sam Stephenson 2011-09-21 11:09:32 -07:00
commit 7d9989ff58
5 changed files with 34 additions and 18 deletions

View file

@ -27,6 +27,9 @@ else
fi
export RBENV_ROOT
export RBENV_PLUGIN_PATH="${RBENV_PLUGIN_PATH}:/etc/rbenv.d:${RBENV_ROOT}/rbenv.d"
libexec_path="$(abs_dirname "$0")"
export PATH="${libexec_path}:${PATH}"

View file

@ -16,12 +16,8 @@ fi
RBENV_COMMAND_PATH="$(rbenv-which "$RBENV_COMMAND")"
RBENV_BIN_PATH="${RBENV_COMMAND_PATH%/*}"
shopt -s nullglob
RBENV_EXEC_PLUGINS=(/etc/rbenv.d/exec/*.bash ${RBENV_ROOT}/rbenv.d/exec/*.bash)
shopt -u nullglob
for script in ${RBENV_EXEC_PLUGINS[@]}; do
source $script
for script in $(rbenv-plugin-scripts exec); do
source "$script"
done
shift 1

25
libexec/rbenv-plugin-scripts Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -e
[ -n "$RBENV_DEBUG" ] && set -x
# Provide rbenv completions
if [ "$1" = "--complete" ]; then
echo exec
echo rehash
echo which
exit
fi
RBENV_COMMAND="$1"
if [ -z "$RBENV_COMMAND" ]; then
echo "usage: rbenv plugin-scripts COMMAND" >&2
exit 1
fi
shopt -s nullglob
for path in ${RBENV_PLUGIN_PATH//:/$'\n'}; do
for script in $path/"$RBENV_COMMAND"/*.bash; do
echo $script
done
done
shopt -u nullglob

View file

@ -67,13 +67,9 @@ create_prototype_shim
shopt -s nullglob
make_shims ../versions/*/bin/*
# Find and run any plugins that might want to make shims too.
RBENV_REHASH_PLUGINS=(/etc/rbenv.d/rehash/*.bash ${RBENV_ROOT}/rbenv.d/rehash/*.bash)
shopt -u nullglob
# Restore the previous working directory.
cd "$CUR_PATH"
for script in ${RBENV_REHASH_PLUGINS[@]}; do
source $script
for script in $(rbenv-plugin-scripts rehash); do
source "$script"
done

View file

@ -52,12 +52,8 @@ else
RBENV_COMMAND_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}/bin/${RBENV_COMMAND}"
fi
shopt -s nullglob
RBENV_WHICH_PLUGINS=(/etc/rbenv.d/which/*.bash ${RBENV_ROOT}/rbenv.d/which/*.bash)
shopt -u nullglob
for script in ${RBENV_WHICH_PLUGINS[@]}; do
source $script
for script in $(rbenv-plugin-scripts which); do
source "$script"
done
if [ -x "$RBENV_COMMAND_PATH" ]; then