Replace /usr/bin/ruby with full Framework path

Rationale: some users insist on replacing the /usr/bin/ruby symlink
to point to another ruby on their system, which may break homebrew.
Use the full Framework path instead, which is less likely to be tampered with.

This also reorganizes the brew --config checks to reflect the different path.

Fixes Homebrew/homebrew#12009.

Closes Homebrew/homebrew#12333.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
This commit is contained in:
Misty De Meo 2012-05-19 19:57:56 -05:00
parent 1a47306467
commit 7af4622b0f
7 changed files with 7 additions and 11 deletions

View File

@ -95,7 +95,7 @@ __brew_complete_tapped ()
__brew_complete_taps ()
{
if [[ -z "$__brew_cached_taps" ]]; then
__brew_cached_taps="$(/usr/bin/ruby -e '
__brew_cached_taps="$(/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -e '
require "open-uri"
require "yaml"

View File

@ -1,4 +1,4 @@
#!/usr/bin/ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
## brew server: Run a local webserver for browsing available and installed brews.
# Note: this external command is ruby, but set up as a shell script, so that it gets exec'd.

View File

@ -1,4 +1,4 @@
#!/usr/bin/ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
# This script installs to /usr/local only. To install elsewhere you can just
# untar https://github.com/mxcl/homebrew/tarball/master anywhere you like.

View File

@ -1,4 +1,4 @@
#!/usr/bin/ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
# This script is called by formula_installer as a separate instance.
# Rationale: Formula can use __END__, Formula can change ENV

View File

@ -91,10 +91,7 @@ module Homebrew extend self
puts hardware
puts "MacOS: #{MACOS_FULL_VERSION}-#{kernel}"
puts "Xcode: #{xcode_version}"
puts "/usr/bin/ruby: #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}" if RUBY_VERSION.to_f != 1.8
ruby = Pathname.new("/usr/bin/ruby")
puts "/usr/bin/ruby => #{ruby.realpath}" unless ruby.realpath.to_s =~ %r{^/System}
puts "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby:\n #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}" if RUBY_VERSION.to_f != 1.8
ponk = macports_or_fink_installed?
puts "MacPorts/Fink: #{ponk}" if ponk
@ -119,7 +116,6 @@ module Homebrew extend self
MacPorts or Fink? #{macports_or_fink_installed?}
X11: #{describe_x11}
System Ruby: #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}
/usr/bin/ruby => #{real_path("/usr/bin/ruby")}
Which Perl: #{describe_perl}
Which Python: #{describe_python}
Which Ruby: #{describe_ruby}

View File

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

View File

@ -1,4 +1,4 @@
#!/usr/bin/ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
# -*- coding: utf-8 -*-
HOMEBREW_BREW_FILE = ENV['HOMEBREW_BREW_FILE'] = File.expand_path(__FILE__)