Commit 9cfdb093 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #3072 from CalQL8ed-K-OS/master

implemented Xcode license check for `pod setup`
parents 5a201487 242d3a3d
......@@ -202,6 +202,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
* Check for Xcode License Agreement before running commands.
[Xavi Matos](https://github.com/CalQL8ed-K-OS)
[#3002](https://github.com/CocoaPods/CocoaPods/issues/3002)
* Do not generate targets for Pods without sources.
[Boris Bügling](https://github.com/neonichu)
[#2918](https://github.com/CocoaPods/CocoaPods/issues/2918)
......
......@@ -41,6 +41,7 @@ module Pod
def self.run(argv)
help! 'You cannot run CocoaPods as root.' if Process.uid == 0
verify_xcode_license_approved!
super(argv)
UI.print_warnings
......@@ -121,5 +122,24 @@ module Pod
raise Informative, "No `Podfile.lock' found in the project directory, run `pod install'."
end
end
def self.verify_xcode_license_approved!
unless xcode_license_approved?
raise Informative, xcode_license_message
end
end
def self.xcode_license_approved?
!(`/usr/bin/xcrun clang 2>&1` =~ /license/ && !$?.success?)
end
def self.xcode_license_message
<<-EOS.strip_heredoc
You have not agreed to the Xcode license.
The setup command requires you do so.
Agree to the license by running:
`xcodebuild -license`
EOS
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment