mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
look for plugins to extend rehash and which
This commit is contained in:
parent
a9837f3a06
commit
b6ebc2f08b
2 changed files with 29 additions and 7 deletions
|
@ -1,14 +1,28 @@
|
||||||
#!/usr/bin/env bash -e
|
#!/usr/bin/env bash -e
|
||||||
|
|
||||||
mkdir -p "${HOME}/.rbenv/shims"
|
make_shims() {
|
||||||
cd "${HOME}/.rbenv/shims"
|
local glob="$@"
|
||||||
rm -f *
|
|
||||||
|
|
||||||
for file in ../versions/*/bin/*; do
|
for file in $glob; do
|
||||||
shim="${file##*/}"
|
local shim="${file##*/}"
|
||||||
cat > "$shim" <<SH
|
cat > "$shim" <<SH
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
exec rbenv exec $shim "\$@"
|
exec rbenv exec $shim "\$@"
|
||||||
SH
|
SH
|
||||||
chmod +x "$shim"
|
chmod +x "$shim"
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
mkdir -p "${HOME}/.rbenv/shims"
|
||||||
|
cd "${HOME}/.rbenv/shims"
|
||||||
|
rm -f *
|
||||||
|
|
||||||
|
make_shims ../versions/*/bin/*
|
||||||
|
|
||||||
|
shopt -s nullglob
|
||||||
|
RBENV_REHASH_PLUGINS=(/etc/rbenv.d/rehash/*.bash ${HOME}/.rbenv/rbenv.d/rehash/*.bash)
|
||||||
|
shopt -u nullglob
|
||||||
|
|
||||||
|
for script in $RBENV_REHASH_PLUGINS; do
|
||||||
|
source $script
|
||||||
|
done
|
||||||
|
|
|
@ -4,6 +4,14 @@ RBENV_VERSION="$(rbenv-version)"
|
||||||
RBENV_COMMAND="$1"
|
RBENV_COMMAND="$1"
|
||||||
RBENV_COMMAND_PATH="${HOME}/.rbenv/versions/${RBENV_VERSION}/bin/${RBENV_COMMAND}"
|
RBENV_COMMAND_PATH="${HOME}/.rbenv/versions/${RBENV_VERSION}/bin/${RBENV_COMMAND}"
|
||||||
|
|
||||||
|
shopt -s nullglob
|
||||||
|
RBENV_WHICH_PLUGINS=(/etc/rbenv.d/which/*.bash ${HOME}/.rbenv/rbenv.d/which/*.bash)
|
||||||
|
shopt -u nullglob
|
||||||
|
|
||||||
|
for script in $RBENV_WHICH_PLUGINS; do
|
||||||
|
source $script
|
||||||
|
done
|
||||||
|
|
||||||
if [ -x "$RBENV_COMMAND_PATH" ]; then
|
if [ -x "$RBENV_COMMAND_PATH" ]; then
|
||||||
echo "$RBENV_COMMAND_PATH"
|
echo "$RBENV_COMMAND_PATH"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue