Ubuntu fix: don't use . in place of source

If `rbenv init -` outputs `.` in place of `source` and that gets eval'd
by the desktop manager via `~/.profile`, it chokes and prevents the user
from logging in.

Fixes #457
This commit is contained in:
Mislav Marohnić 2013-10-03 16:12:24 +02:00
parent 71a6d791c2
commit e97326845c
2 changed files with 7 additions and 2 deletions

View file

@ -101,7 +101,12 @@ if [[ ":${PATH}:" != *:"${RBENV_ROOT}/shims":* ]]; then
fi fi
completion="${root}/completions/rbenv.${shell}" completion="${root}/completions/rbenv.${shell}"
[ -r "$completion" ] && echo ". '$completion'" if [ -r "$completion" ]; then
case "$shell" in
fish ) echo ". '$completion'" ;;
* ) echo "source '$completion'" ;;
esac
fi
if [ -z "$no_rehash" ]; then if [ -z "$no_rehash" ]; then
echo 'rbenv rehash 2>/dev/null' echo 'rbenv rehash 2>/dev/null'

View file

@ -21,7 +21,7 @@ load test_helper
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)" root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
SHELL=/bin/bash run rbenv-init - SHELL=/bin/bash run rbenv-init -
assert_success assert_success
assert_line ". '${root}/libexec/../completions/rbenv.bash'" assert_line "source '${root}/libexec/../completions/rbenv.bash'"
} }
@test "setup shell completions (fish)" { @test "setup shell completions (fish)" {