From 4dc4fd0110ad7286104633a36f8578680ecca2cc Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Thu, 19 Jul 2018 22:33:58 +0100 Subject: [PATCH] Lazy load rbenv --- shell/ruby.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/shell/ruby.sh b/shell/ruby.sh index 529115c..c14a5f4 100755 --- a/shell/ruby.sh +++ b/shell/ruby.sh @@ -47,10 +47,16 @@ if [ -n "$BASH_VERSION" ]; then alias bcn="bundle clean" fi -if [ -n "$(command -v rbenv)" ]; then - eval "$(rbenv init --no-rehash -)" +# lazy-load rbenv +if [ -d "$HOME/.rbenv/shims" ]; then + path_prepend "$HOME/.rbenv/shims" fi +rbenv() { + eval "$(command rbenv init -)" + rbenv "$@" +} + # lunchy auto-completion if [ -n "$BASH_VERSION" ]; then if which gem &> /dev/null && gem which lunchy &> /dev/null; then