aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/link.rb
blob: d882ee7ec6ebe317608cf1b5a1995a6e014e59aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module Homebrew extend self
  def link
    raise KegUnspecifiedError if ARGV.named.empty?

    if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
      # note we only abort if Homebrew is *not* installed as sudo and the user
      # calls brew as root. The fix is to chown brew to root.
      abort "Cowardly refusing to `sudo brew link'"
    end

    ARGV.kegs.each do |keg|
      print "Linking #{keg}... "
      puts if ARGV.verbose?
      puts "#{keg.link} symlinks created"
    end
  end
end