From d39280bdf7aca09ea7c6d9acf927bd95b6d1e499 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 10 Mar 2013 17:02:06 +0000 Subject: Add current Ruby globals. Allows access to the Ruby path. Needed for Linux porting. --- Library/Homebrew/extend/fileutils.rb | 6 ++---- Library/Homebrew/formula_installer.rb | 2 +- Library/Homebrew/global.rb | 5 +++++ 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb index a7a1ae41c..231d3b769 100644 --- a/Library/Homebrew/extend/fileutils.rb +++ b/Library/Homebrew/extend/fileutils.rb @@ -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 diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 0a1eba69e..a84502ed8 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -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', diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index de08f9267..761dd1eb7 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -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 -- cgit v1.2.3