aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-06-09 21:36:36 -0500
committerJack Nagel2014-06-09 21:36:36 -0500
commit2d8d065d0219846bf4168ecebc3d79111dcd094e (patch)
tree37499712bf7e27f5a2ca4dbfe591231925194643
parentace78b1f3a59a893c7068e485555acf792470080 (diff)
downloadhomebrew-2d8d065d0219846bf4168ecebc3d79111dcd094e.tar.bz2
Use RbConfig.ruby if it's available
-rw-r--r--Library/Homebrew/global.rb10
-rw-r--r--Library/Homebrew/test/testing_env.rb10
2 files changed, 16 insertions, 4 deletions
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index 6fd01d149..e8e865976 100644
--- a/Library/Homebrew/global.rb
+++ b/Library/Homebrew/global.rb
@@ -68,8 +68,14 @@ HOMEBREW_LOGS = Pathname.new(ENV['HOMEBREW_LOGS'] || '~/Library/Logs/Homebrew/')
HOMEBREW_TEMP = Pathname.new(ENV.fetch('HOMEBREW_TEMP', '/tmp'))
-RUBY_BIN = Pathname.new(RbConfig::CONFIG['bindir'])
-RUBY_PATH = RUBY_BIN + RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']
+if RbConfig.respond_to?(:ruby)
+ RUBY_PATH = Pathname.new(RbConfig.ruby)
+else
+ RUBY_PATH = Pathname.new(RbConfig::CONFIG["bindir"]).join(
+ RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]
+ )
+end
+RUBY_BIN = RUBY_PATH.dirname
if RUBY_PLATFORM =~ /darwin/
MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp
diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb
index c3dcf8957..f0bd1726d 100644
--- a/Library/Homebrew/test/testing_env.rb
+++ b/Library/Homebrew/test/testing_env.rb
@@ -29,8 +29,14 @@ HOMEBREW_VERSION = '0.9-test'
require 'tap_constants'
-RUBY_BIN = Pathname.new(RbConfig::CONFIG['bindir'])
-RUBY_PATH = RUBY_BIN + RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']
+if RbConfig.respond_to?(:ruby)
+ RUBY_PATH = Pathname.new(RbConfig.ruby)
+else
+ RUBY_PATH = Pathname.new(RbConfig::CONFIG["bindir"]).join(
+ RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]
+ )
+end
+RUBY_BIN = RUBY_PATH.dirname
MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp
MACOS_VERSION = ENV.fetch('MACOS_VERSION') { MACOS_FULL_VERSION[/10\.\d+/] }