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
|
#!/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() {
|
make_shims() {
|
||||||
local glob="$@"
|
local glob="$@"
|
||||||
|
|
||||||
for file in $glob; do
|
for file in $glob; do
|
||||||
local shim="${file##*/}"
|
local shim="${file##*/}"
|
||||||
cat > "$shim" <<SH
|
[ -e "$shim" ] || ln -f .rbenv-shim "$shim"
|
||||||
#!/bin/sh
|
|
||||||
exec rbenv exec $shim "\$@"
|
|
||||||
SH
|
|
||||||
chmod +x "$shim"
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +21,7 @@ mkdir -p "${HOME}/.rbenv/shims"
|
||||||
cd "${HOME}/.rbenv/shims"
|
cd "${HOME}/.rbenv/shims"
|
||||||
rm -f *
|
rm -f *
|
||||||
|
|
||||||
|
create_prototype_shim
|
||||||
make_shims ../versions/*/bin/*
|
make_shims ../versions/*/bin/*
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
@ -26,3 +31,5 @@ shopt -u nullglob
|
||||||
for script in ${RBENV_REHASH_PLUGINS[@]}; do
|
for script in ${RBENV_REHASH_PLUGINS[@]}; do
|
||||||
source $script
|
source $script
|
||||||
done
|
done
|
||||||
|
|
||||||
|
rm -f .rbenv-shim
|
||||||
|
|
Loading…
Reference in a new issue