Skip to content

Commit

Permalink
Merge pull request rbenv#102 from sstephenson/plugins
Browse files Browse the repository at this point in the history
Plugin bundles
  • Loading branch information
sstephenson committed Sep 23, 2011
2 parents a817016 + 11725bf commit c451292
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
18 changes: 15 additions & 3 deletions libexec/rbenv
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,22 @@ fi
export RBENV_ROOT


export RBENV_PLUGIN_PATH="${RBENV_PLUGIN_PATH}:${RBENV_ROOT}/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d"
shopt -s nullglob

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

libexec_path="$(abs_dirname "$0")"
export PATH="${libexec_path}:${PATH}"

command="$1"
case "$command" in
Expand Down
2 changes: 1 addition & 1 deletion libexec/rbenv-exec
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions libexec/rbenv-plugin-scripts → libexec/rbenv-hooks
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libexec/rbenv-rehash
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion libexec/rbenv-which
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c451292

Please sign in to comment.