Commit 242d3a3d authored by Xavi Matos's avatar Xavi Matos Committed by Xavi Matos

implemented Xcode license check for all Commands

parent a286e377
...@@ -134,6 +134,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -134,6 +134,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements ##### 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. * Do not generate targets for Pods without sources.
[Boris Bügling](https://github.com/neonichu) [Boris Bügling](https://github.com/neonichu)
[#2918](https://github.com/CocoaPods/CocoaPods/issues/2918) [#2918](https://github.com/CocoaPods/CocoaPods/issues/2918)
......
...@@ -41,6 +41,7 @@ module Pod ...@@ -41,6 +41,7 @@ module Pod
def self.run(argv) def self.run(argv)
help! 'You cannot run CocoaPods as root.' if Process.uid == 0 help! 'You cannot run CocoaPods as root.' if Process.uid == 0
verify_xcode_license_approved!
super(argv) super(argv)
UI.print_warnings UI.print_warnings
...@@ -121,5 +122,24 @@ module Pod ...@@ -121,5 +122,24 @@ module Pod
raise Informative, "No `Podfile.lock' found in the project directory, run `pod install'." raise Informative, "No `Podfile.lock' found in the project directory, run `pod install'."
end end
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
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