Add comment and use constants

This commit is contained in:
Max Howell 2011-02-13 13:50:44 +00:00 committed by Adam Vandenberg
parent 8abf954bf4
commit 761cbd3dab

View File

@ -50,14 +50,14 @@ at_exit do
end end
end end
ORIGINAL_PATHS = ENV['PATH'].split(':').map{ |p| File.expand_path p }
HOMEBREW_BIN = (HOMEBREW_PREFIX+'bin').to_s
def install f def install f
show_summary_heading = false show_summary_heading = false
paths = ENV['PATH'].split(':').map{ |p| File.expand_path p } # we must do this or tools like pkg-config won't get found by configure scripts etc.
rootbin = (HOMEBREW_PREFIX+'bin').to_s ENV.prepend 'PATH', HOMEBREW_BIN, ':' unless ORIGINAL_PATHS.include? HOMEBREW_BIN
unless paths.include? rootbin
ENV.prepend 'PATH', rootbin, ':'
end
f.deps.uniq.each do |dep| f.deps.uniq.each do |dep|
dep = Formula.factory dep dep = Formula.factory dep
@ -157,10 +157,9 @@ def install f
# warn the user if stuff was installed outside of their PATH # warn the user if stuff was installed outside of their PATH
[f.bin, f.sbin].each do |bin| [f.bin, f.sbin].each do |bin|
if bin.directory? if bin.directory?
rootbin = (HOMEBREW_PREFIX/bin.basename).to_s
bin = File.expand_path bin bin = File.expand_path bin
unless paths.include? rootbin unless ORIGINAL_PATHS.include? HOMEBREW_BIN
opoo "#{rootbin} is not in your PATH" opoo "#{HOMEBREW_BIN} is not in your PATH"
puts "You can amend this by altering your ~/.bashrc file" puts "You can amend this by altering your ~/.bashrc file"
show_summary_heading = true show_summary_heading = true
end end