2011-08-12 05:33:45 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2011-08-01 16:50:26 -04:00
|
|
|
|
2011-08-03 23:57:27 -04:00
|
|
|
create_prototype_shim() {
|
|
|
|
cat > .rbenv-shim <<SH
|
2011-08-12 05:33:45 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2011-08-03 23:57:27 -04:00
|
|
|
exec rbenv exec "\${0##*/}" "\$@"
|
|
|
|
SH
|
|
|
|
chmod +x .rbenv-shim
|
|
|
|
}
|
|
|
|
|
2011-08-03 13:17:28 -04:00
|
|
|
make_shims() {
|
|
|
|
local glob="$@"
|
2011-08-01 16:50:26 -04:00
|
|
|
|
2011-08-03 13:17:28 -04:00
|
|
|
for file in $glob; do
|
|
|
|
local shim="${file##*/}"
|
2011-08-03 23:57:27 -04:00
|
|
|
[ -e "$shim" ] || ln -f .rbenv-shim "$shim"
|
2011-08-03 13:17:28 -04:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
mkdir -p "${HOME}/.rbenv/shims"
|
|
|
|
cd "${HOME}/.rbenv/shims"
|
|
|
|
rm -f *
|
|
|
|
|
2011-08-03 23:57:27 -04:00
|
|
|
create_prototype_shim
|
2011-08-03 13:17:28 -04:00
|
|
|
make_shims ../versions/*/bin/*
|
|
|
|
|
|
|
|
shopt -s nullglob
|
|
|
|
RBENV_REHASH_PLUGINS=(/etc/rbenv.d/rehash/*.bash ${HOME}/.rbenv/rbenv.d/rehash/*.bash)
|
|
|
|
shopt -u nullglob
|
|
|
|
|
2011-08-03 22:55:03 -04:00
|
|
|
for script in ${RBENV_REHASH_PLUGINS[@]}; do
|
2011-08-03 13:17:28 -04:00
|
|
|
source $script
|
2011-08-01 16:50:26 -04:00
|
|
|
done
|
2011-08-03 23:57:27 -04:00
|
|
|
|
|
|
|
rm -f .rbenv-shim
|