mirror of
https://github.com/rbenv/rbenv.git
synced 2024-12-28 20:55:38 +01:00
Revert support for user-installed gems (#1443)
This commit is contained in:
parent
a6cf6aeadb
commit
410e05bf8c
4 changed files with 19 additions and 28 deletions
|
@ -104,10 +104,6 @@ list_executable_names() {
|
||||||
echo "${file##*/}"
|
echo "${file##*/}"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
# list user-install'ed executables
|
|
||||||
for file in ~/.gem/ruby/*/bin/*; do
|
|
||||||
echo "${file##*/}"
|
|
||||||
done
|
|
||||||
if [ -n "$GEM_HOME" ]; then
|
if [ -n "$GEM_HOME" ]; then
|
||||||
for file in "$GEM_HOME"/bin/*; do
|
for file in "$GEM_HOME"/bin/*; do
|
||||||
echo "${file##*/}"
|
echo "${file##*/}"
|
||||||
|
|
|
@ -41,17 +41,10 @@ if [ "$RBENV_VERSION" = "system" ]; then
|
||||||
RBENV_COMMAND_PATH="$(command -v "$RBENV_COMMAND" || true)"
|
RBENV_COMMAND_PATH="$(command -v "$RBENV_COMMAND" || true)"
|
||||||
else
|
else
|
||||||
RBENV_COMMAND_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}/bin/${RBENV_COMMAND}"
|
RBENV_COMMAND_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}/bin/${RBENV_COMMAND}"
|
||||||
if [ ! -x "$RBENV_COMMAND_PATH" ]; then
|
fi
|
||||||
# discover user-install'ed gem executables
|
|
||||||
if [ -n "$GEM_HOME" ]; then
|
if [[ ! -x "$RBENV_COMMAND_PATH" && -n "$GEM_HOME" && -x "${GEM_HOME}/bin/${RBENV_COMMAND}" ]]; then
|
||||||
user_install_path="${GEM_HOME}/bin/${RBENV_COMMAND}"
|
RBENV_COMMAND_PATH="${GEM_HOME}/bin/${RBENV_COMMAND}"
|
||||||
else
|
|
||||||
# FIXME: guessing this path is very fragile and works only for C Ruby
|
|
||||||
user_install_path="${HOME}/.gem/ruby/${RBENV_VERSION%.*}.0/bin/${RBENV_COMMAND}"
|
|
||||||
fi
|
|
||||||
[ -x "$user_install_path" ] && RBENV_COMMAND_PATH="$user_install_path"
|
|
||||||
unset user_install_path
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OLDIFS="$IFS"
|
OLDIFS="$IFS"
|
||||||
|
|
|
@ -105,22 +105,17 @@ ruby
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "user-install" {
|
@test "no shims for user-installed gems" {
|
||||||
create_executable "${HOME}/.gem/ruby/3.0.0/bin/lolcat"
|
create_executable "2.7.5" "ruby"
|
||||||
|
create_executable "3.1.2" "ruby"
|
||||||
|
create_executable "${HOME}/.gem/ruby/2.7.0/bin/lolcat"
|
||||||
create_executable "${HOME}/.gem/ruby/3.1.0/bin/pinecone"
|
create_executable "${HOME}/.gem/ruby/3.1.0/bin/pinecone"
|
||||||
|
|
||||||
assert [ ! -e "${RBENV_ROOT}/shims/lolcat" ]
|
|
||||||
assert [ ! -e "${RBENV_ROOT}/shims/pinecone" ]
|
|
||||||
|
|
||||||
run rbenv-rehash
|
run rbenv-rehash
|
||||||
assert_success ""
|
assert_success ""
|
||||||
|
|
||||||
run ls "${RBENV_ROOT}/shims"
|
assert [ ! -e "${RBENV_ROOT}/shims/lolcat" ]
|
||||||
assert_success
|
assert [ ! -e "${RBENV_ROOT}/shims/pinecone" ]
|
||||||
assert_output <<OUT
|
|
||||||
lolcat
|
|
||||||
pinecone
|
|
||||||
OUT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "explicit gem home" {
|
@test "explicit gem home" {
|
||||||
|
|
|
@ -98,11 +98,11 @@ The \`rspec' command exists in these Ruby versions:
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "executable found in user gems" {
|
@test "executable not found in user gems" {
|
||||||
create_executable "2.7.6" "ruby"
|
create_executable "2.7.6" "ruby"
|
||||||
create_executable "${HOME}/.gem/ruby/2.7.0/bin" "rake"
|
create_executable "${HOME}/.gem/ruby/2.7.0/bin" "rake"
|
||||||
GEM_HOME='' RBENV_VERSION=2.7.6 run rbenv-which rake
|
GEM_HOME='' RBENV_VERSION=2.7.6 run rbenv-which rake
|
||||||
assert_success "${HOME}/.gem/ruby/2.7.0/bin/rake"
|
assert_failure
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "executable found in gem home" {
|
@test "executable found in gem home" {
|
||||||
|
@ -113,6 +113,13 @@ OUT
|
||||||
assert_success "${HOME}/mygems/bin/rake"
|
assert_success "${HOME}/mygems/bin/rake"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "executable found in gem home (system ruby)" {
|
||||||
|
create_executable "${HOME}/mygems/bin" "rbenv-test-lolcat"
|
||||||
|
create_executable "${HOME}/.gem/ruby/2.6.0/bin" "rbenv-test-lolcat"
|
||||||
|
GEM_HOME="${HOME}/mygems" RBENV_VERSION=system run rbenv-which rbenv-test-lolcat
|
||||||
|
assert_success "${HOME}/mygems/bin/rbenv-test-lolcat"
|
||||||
|
}
|
||||||
|
|
||||||
@test "carries original IFS within hooks" {
|
@test "carries original IFS within hooks" {
|
||||||
create_hook which hello.bash <<SH
|
create_hook which hello.bash <<SH
|
||||||
hellos=(\$(printf "hello\\tugly world\\nagain"))
|
hellos=(\$(printf "hello\\tugly world\\nagain"))
|
||||||
|
|
Loading…
Reference in a new issue