pyenv/libexec/rbenv-rehash

38 lines
645 B
Text
Raw Normal View History

#!/usr/bin/env bash
set -e
2011-08-01 16:50:26 -04:00
create_prototype_shim() {
cat > .rbenv-shim <<SH
#!/usr/bin/env bash
set -e
exec rbenv exec "\${0##*/}" "\$@"
SH
chmod +x .rbenv-shim
}
make_shims() {
local glob="$@"
2011-08-01 16:50:26 -04:00
for file in $glob; do
local shim="${file##*/}"
[ -e "$shim" ] || ln -f .rbenv-shim "$shim"
done
}
mkdir -p "${HOME}/.rbenv/shims"
cd "${HOME}/.rbenv/shims"
rm -f *
create_prototype_shim
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
2011-08-01 16:50:26 -04:00
done
rm -f .rbenv-shim