diff options
| author | Mike McQuaid | 2016-01-10 19:35:16 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2016-01-17 19:48:02 +0000 |
| commit | 6f91b429ceee780088b659e519e19262bcfd48cf (patch) | |
| tree | b069d347bd4c45cda0160fabfeed39ff7e64e8db /Library | |
| parent | b01ce411641c64d36688a58999c3644ab0daf4a7 (diff) | |
| download | brew-6f91b429ceee780088b659e519e19262bcfd48cf.tar.bz2 | |
Move some brew.rb logic to bin/brew.
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/brew.rb | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/Library/brew.rb b/Library/brew.rb index df83df120..f8fa07f27 100755 --- a/Library/brew.rb +++ b/Library/brew.rb @@ -4,11 +4,6 @@ std_trap = trap("INT") { exit! 130 } # no backtrace thanks HOMEBREW_BREW_FILE = ENV["HOMEBREW_BREW_FILE"] -if ARGV == %w[--prefix] - puts File.dirname(File.dirname(HOMEBREW_BREW_FILE)) - exit 0 -end - require "pathname" HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent.join("Homebrew") $:.unshift(HOMEBREW_LIBRARY_PATH.to_s) @@ -22,38 +17,6 @@ elsif ARGV.first == "-v" ARGV << ARGV.shift end -if OS.mac? - # Check for bad xcode-select before other checks, because `doctor` and - # many other things will hang. Note that this bug was fixed in 10.9 - if MacOS.version < :mavericks && MacOS.active_developer_dir == "/" - odie <<-EOS.undent - Your xcode-select path is currently set to '/'. - This causes the `xcrun` tool to hang, and can render Homebrew unusable. - If you are using Xcode, you should: - sudo xcode-select -switch /Applications/Xcode.app - Otherwise, you should: - sudo rm -rf /usr/share/xcode-select - EOS - end - - # Check for user agreement of the Xcode license before permitting - # any other brew usage to continue. This prevents the situation where - # people are instructed to "please re-run as root via sudo" on brew commands. - # The check can only fail when Xcode is installed & the active developer dir. - if MacOS::Xcode.installed? && `/usr/bin/xcrun clang 2>&1` =~ /license/ && !$?.success? - odie <<-EOS.undent - You have not agreed to the Xcode license. Please resolve this by running: - sudo xcodebuild -license - EOS - end -end - -case HOMEBREW_PREFIX.to_s -when "/", "/usr" - # it may work, but I only see pain this route and don't want to support it - abort "Cowardly refusing to continue at this prefix: #{HOMEBREW_PREFIX}" -end - if OS.mac? && MacOS.version < "10.6" abort <<-EOABORT.undent Homebrew requires Snow Leopard or higher. For Tiger and Leopard support, see: @@ -61,10 +24,6 @@ if OS.mac? && MacOS.version < "10.6" EOABORT end -# Many Pathname operations use getwd when they shouldn't, and then throw -# odd exceptions. Reduce our support burden by showing a user-friendly error. -Dir.getwd rescue abort "The current working directory doesn't exist, cannot proceed." - def require?(path) require path rescue LoadError => e @@ -94,20 +53,6 @@ begin cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd) - sudo_check = %w[ install reinstall postinstall link pin unpin - update upgrade create migrate tap switch ] - - if sudo_check.include? cmd - if Process.uid.zero? && !File.stat(HOMEBREW_BREW_FILE).uid.zero? - raise <<-EOS.undent - Cowardly refusing to `sudo brew #{cmd}` - You can use brew with sudo, but only if the brew executable is owned by root. - However, this is both not recommended and completely unsupported so do so at - your own risk. - EOS - end - end - # Add contributed commands to PATH before checking. Dir["#{HOMEBREW_LIBRARY}/Taps/*/*/cmd"].each do |tap_cmd_dir| ENV["PATH"] += "#{File::PATH_SEPARATOR}#{tap_cmd_dir}" |
