From 1d4d36024f5ef9c920e5d6359d2dfce33cf63649 Mon Sep 17 00:00:00 2001 From: Shane O'Grady Date: Wed, 4 Jun 2014 11:41:11 -0300 Subject: [PATCH] If a default ruby is set for the user, switch to it If a default ruby is set for the user, switch to it automatically. This sets the PATH variables and allows gems such as `bundler` to be found, allowing the `bundler` aliases to be enabled. This only matters when a default ruby is _not_ the system ruby, and/or when bundler is not installed for the system ruby but is installed for the default ruby. This also fixes an issue where the `ruby-info` function has the wrong info for the initial prompt. A `.ruby-version` file must exist in the users $HOME directory (as recommended here for auto-switching: https://github.com/postmodern/chruby#default-ruby) --- modules/ruby/init.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/ruby/init.zsh b/modules/ruby/init.zsh index eb18dd37..1b7220ad 100644 --- a/modules/ruby/init.zsh +++ b/modules/ruby/init.zsh @@ -28,6 +28,8 @@ elif (( $+commands[chruby-exec] )); then source "${commands[chruby-exec]:h:h}/share/chruby/chruby.sh" if zstyle -t ':prezto:module:ruby:chruby' auto-switch; then source "${commands[chruby-exec]:h:h}/share/chruby/auto.sh" + # If a default ruby is configured for the user, switch to it + chruby_auto fi # Prepend local gems bin directories to PATH.