diff options
| author | Max Howell | 2012-08-31 10:20:20 -0400 |
|---|---|---|
| committer | Max Howell | 2012-08-31 10:22:11 -0400 |
| commit | d414d9b613dc938772254afc236f5e3f97a8ad92 (patch) | |
| tree | a16cbe53e775485fc8c519cfcf92c4aa6c0c55b5 /Library | |
| parent | bbe75d3efbfe9cece5ee161882c0002c9697a047 (diff) | |
| download | homebrew-d414d9b613dc938772254afc236f5e3f97a8ad92.tar.bz2 | |
Doctor check for unlicensed Xcode
Checking the license text is probably the most future proofed method. Though for future reference other possible methods are listed in the below ticket.
Closes #14558.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/doctor.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/install.rb | 7 |
2 files changed, 15 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 0786d7c99..39fed18d9 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -925,6 +925,16 @@ def check_os_version end end + def check_xcode_license_approved + # If the user installs Xcode-only, they have to approve the + # license or no "xc*" tool will work. + <<-EOS.undent if `/usr/bin/xcrun clang 2>&1` =~ /license/ and not $?.success? + You have not agreed to the Xcode license. + Builds will fail! Agree to the license by opening Xcode.app or running: + xcodebuild -license + EOS + end + end # end class Checks module Homebrew extend self diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 85b502d1d..b01866958 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -37,8 +37,11 @@ module Homebrew extend self def check_xcode require 'cmd/doctor' - xcode = Checks.new.check_for_latest_xcode - opoo xcode unless xcode.nil? + checks = Checks.new + %w{check_for_latest_xcode check_xcode_license_approved}.each do |check| + out = checks.send(check) + opoo out unless out.nil? + end end def check_macports |
