Add current Ruby globals.

Allows access to the Ruby path. Needed for Linux
porting.
This commit is contained in:
Mike McQuaid 2013-03-10 17:02:06 +00:00
parent cac86a4f0b
commit d39280bdf7
3 changed files with 8 additions and 5 deletions

View File

@ -81,13 +81,11 @@ module FileUtils extend self
end
end
RUBY_BIN = '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin'
def rake *args
system "#{RUBY_BIN}/rake", *args
system RUBY_BIN/'rake', *args
end
def ruby *args
system "#{RUBY_BIN}/ruby", *args
system RUBY_PATH, *args
end
end

View File

@ -285,7 +285,7 @@ class FormulaInstaller
begin
read.close
exec '/usr/bin/nice',
'/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby',
RUBY_PATH,
'-W0',
'-I', Pathname.new(__FILE__).dirname,
'-rbuild',

View File

@ -7,6 +7,7 @@ require 'extend/object'
require 'utils'
require 'exceptions'
require 'set'
require 'rbconfig'
ARGV.extend(HomebrewArgvExtension)
@ -63,6 +64,10 @@ end
HOMEBREW_LOGS = Pathname.new('~/Library/Logs/Homebrew/').expand_path
RUBY_CONFIG = RbConfig::CONFIG
RUBY_BIN = Pathname.new("#{RUBY_CONFIG['bindir']}")
RUBY_PATH = RUBY_BIN/RUBY_CONFIG['ruby_install_name'] + RUBY_CONFIG['EXEEXT']
if RUBY_PLATFORM =~ /darwin/
MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp
MACOS_VERSION = /(10\.\d+)(\.\d+)?/.match(MACOS_FULL_VERSION).captures.first.to_f