mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Speed up rbenv-rehash by using hard links
This commit is contained in:
parent
7ce04a6e03
commit
fffb29d695
1 changed files with 12 additions and 5 deletions
|
@ -1,15 +1,19 @@
|
|||
#!/usr/bin/env bash -e
|
||||
|
||||
create_prototype_shim() {
|
||||
cat > .rbenv-shim <<SH
|
||||
#!/usr/bin/env bash -e
|
||||
exec rbenv exec "\${0##*/}" "\$@"
|
||||
SH
|
||||
chmod +x .rbenv-shim
|
||||
}
|
||||
|
||||
make_shims() {
|
||||
local glob="$@"
|
||||
|
||||
for file in $glob; do
|
||||
local shim="${file##*/}"
|
||||
cat > "$shim" <<SH
|
||||
#!/bin/sh
|
||||
exec rbenv exec $shim "\$@"
|
||||
SH
|
||||
chmod +x "$shim"
|
||||
[ -e "$shim" ] || ln -f .rbenv-shim "$shim"
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -17,6 +21,7 @@ mkdir -p "${HOME}/.rbenv/shims"
|
|||
cd "${HOME}/.rbenv/shims"
|
||||
rm -f *
|
||||
|
||||
create_prototype_shim
|
||||
make_shims ../versions/*/bin/*
|
||||
|
||||
shopt -s nullglob
|
||||
|
@ -26,3 +31,5 @@ shopt -u nullglob
|
|||
for script in ${RBENV_REHASH_PLUGINS[@]}; do
|
||||
source $script
|
||||
done
|
||||
|
||||
rm -f .rbenv-shim
|
||||
|
|
Loading…
Reference in a new issue