Permalink
Browse files

Fix autodetection of the RVM Ruby string if the GEM_HOME contains mor…

…e subpaths after the Ruby string part.
  • Loading branch information...
1 parent 7ef6059 commit dd1feb64baacde8e11ad2bd181a60e641d7440c0 @FooBarWidget FooBarWidget committed Apr 4, 2013
Showing with 7 additions and 2 deletions.
  1. +1 −0 NEWS
  2. +6 −2 lib/phusion_passenger/platform_info/ruby.rb
View
1 NEWS
@@ -2,6 +2,7 @@ Release 4.0.0 release candidate 6
---------------------------------
* WebSocket support on Nginx. Requires Nginx >= 1.3.15.
+ * Improved RVM support.
* Various bug fixes.
View
8 lib/phusion_passenger/platform_info/ruby.rb
@@ -235,8 +235,12 @@ def self.rvm_ruby_string
# try various strategies...
# $GEM_HOME usually contains the gem set name.
- if GEM_HOME && GEM_HOME.include?("rvm/gems/")
- return File.basename(GEM_HOME)
+ # It may be something like:
+ # /Users/hongli/.rvm/gems/ruby-1.9.3-p392
+ # But also:
+ # /home/bitnami/.rvm/gems/ruby-1.9.3-p385-perf@njist325/ruby/1.9.1
+ if GEM_HOME && GEM_HOME =~ %r{rvm/gems/(.+)}
+ return $1.sub(/\/.*/, '')
end
# User somehow managed to nuke $GEM_HOME. Extract info

0 comments on commit dd1feb6

Please sign in to comment.