From e26387656d833ae7321c06415a65118af08b6d89 Mon Sep 17 00:00:00 2001 From: Alexey Zapparov Date: Mon, 12 Feb 2018 04:28:51 +0100 Subject: [PATCH] Don't double-source chruby If chruby was installed using default way, most likely chruby and auto-switching will be already sourced (at least on most Linuxes). --- modules/ruby/init.zsh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/ruby/init.zsh b/modules/ruby/init.zsh index 3f666c3..4ede366 100644 --- a/modules/ruby/init.zsh +++ b/modules/ruby/init.zsh @@ -25,9 +25,14 @@ elif (( $+commands[rbenv] )); then # Load package manager installed chruby into the shell session. elif (( $+commands[chruby-exec] )); then - source "${commands[chruby-exec]:h:h}/share/chruby/chruby.sh" + if (( ! $+functions[chruby] )); then + source "${commands[chruby-exec]:h:h}/share/chruby/chruby.sh" + fi + if zstyle -t ':prezto:module:ruby:chruby' auto-switch; then - source "${commands[chruby-exec]:h:h}/share/chruby/auto.sh" + if (( ! $+functions[chruby_auto] )); then + source "${commands[chruby-exec]:h:h}/share/chruby/auto.sh" + fi # If a default Ruby is set, switch to it. chruby_auto