Commit 4ab76e80 authored by Kyle Fuller's avatar Kyle Fuller

Ensure that git 1.7.5 or newer is installed

Fixes #2651
parent 70ee408b
...@@ -49,6 +49,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -49,6 +49,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Kyle Fuller](https://github.com/kylef) [Kyle Fuller](https://github.com/kylef)
[#2083](https://github.com/CocoaPods/CocoaPods/issues/2083) [#2083](https://github.com/CocoaPods/CocoaPods/issues/2083)
* Ensure that git 1.7.5 or newer is installed when running pod.
[Kyle Fuller](https://github.com/kylef)
[#2651](https://github.com/CocoaPods/CocoaPods/issues/2651)
## 0.34.2 ## 0.34.2
......
...@@ -42,6 +42,8 @@ module Pod ...@@ -42,6 +42,8 @@ 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_git_version!
super(argv) super(argv)
UI.print_warnings UI.print_warnings
end end
...@@ -111,5 +113,18 @@ module Pod ...@@ -111,5 +113,18 @@ 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_git_version!
begin
git_version = `git version`.strip
rescue Errno::ENOENT
help! 'CocoaPods requires you to have `git` installed.'
end
git_version = Version.new(git_version.split[2])
if git_version < Pod::Version.new('1.7.5')
help! 'CocoaPods requires git version 1.7.5 or newer. Please update git.'
end
end
end end
end end
...@@ -17,5 +17,15 @@ module Pod ...@@ -17,5 +17,15 @@ module Pod
Process.stubs(:uid).returns(0) Process.stubs(:uid).returns(0)
lambda { Pod::Command.run(['--version']) }.should.raise CLAide::Help lambda { Pod::Command.run(['--version']) }.should.raise CLAide::Help
end end
it "doesn't let you run without git installed" do
Pod::Command.expects(:`).with('git version').raises(Errno::ENOENT)
lambda { Pod::Command.run(['--version']) }.should.raise CLAide::Help
end
it "doesn't let you run with git version < 1.7.5" do
Pod::Command.expects(:`).with('git version').returns('git version 1.7.4.1 (Apple Git-50)')
lambda { Pod::Command.run(['--version']) }.should.raise CLAide::Help
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