diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 6fd01d1494..e8e865976f 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 c3dcf89578..f0bd1726df 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+/] }