From 262a9f1fbcae755dc2e3b1269fca9f0b036531fb Mon Sep 17 00:00:00 2001 From: Postmodern Date: Fri, 17 Aug 2012 00:20:10 -0700 Subject: [PATCH] Use the RUBY_ENGINE constant instead of the name of the ruby. --- etc/profile.d/chruby.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/profile.d/chruby.sh b/etc/profile.d/chruby.sh index 5310fd74..b1a68e62 100644 --- a/etc/profile.d/chruby.sh +++ b/etc/profile.d/chruby.sh @@ -22,15 +22,15 @@ function chruby_use() export PATH="$1/bin:$PATH" export RUBYOPT="$2" - local versions=( `ruby -e "require 'rbconfig'; puts RUBY_VERSION; puts RbConfig::CONFIG['ruby_version']"` ) + local ruby_version=( `ruby -e "require 'rbconfig'; puts defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'; puts RUBY_VERSION; puts RbConfig::CONFIG['ruby_version']"` ) export RUBY_PATH="$1" - export RUBY_ENGINE=`echo $name | cut -f1 -d-` - export RUBY_VERSION=${versions[0]} + export RUBY_ENGINE=${ruby_version[0]} + export RUBY_VERSION=${ruby_version[1]} if [[ ! $UID -eq 0 ]]; then export GEM_HOME="$HOME/.gem/$RUBY_ENGINE/$RUBY_VERSION" - export GEM_PATH="$RUBY_PATH/lib/ruby/gems/${versions[1]}" + export GEM_PATH="$RUBY_PATH/lib/ruby/gems/${ruby_version[2]}" export PATH="$GEM_HOME/bin:$GEM_PATH/bin:$PATH" export GEM_PATH="$GEM_HOME:$GEM_PATH"