Commit 0bf5f435 authored by Samuel E. Giddins's avatar Samuel E. Giddins
parent cbf504ca
...@@ -11,6 +11,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -11,6 +11,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Fabio Pelosin][irrationalfab] [Fabio Pelosin][irrationalfab]
[Xcodeproj#105](https://github.com/CocoaPods/Xcodeproj/pull/150) [Xcodeproj#105](https://github.com/CocoaPods/Xcodeproj/pull/150)
* Show a helpful error message when reading version information with merge conflict
[Samuel E. Giddins][segiddins]
[#1853](https://github.com/CocoaPods/CocoaPods/issues/1853)
## 0.32.1 ## 0.32.1
##### Bug Fixes ##### Bug Fixes
......
...@@ -259,7 +259,16 @@ module Pod ...@@ -259,7 +259,16 @@ module Pod
def version_information(dir) def version_information(dir)
require 'yaml' require 'yaml'
yaml_file = dir + 'CocoaPods-version.yml' yaml_file = dir + 'CocoaPods-version.yml'
yaml_file.exist? ? YAML.load_file(yaml_file) : {} return {} unless yaml_file.exist?
begin
yaml = Pathname.new(yaml_file).read
YAMLHelper.load(yaml)
rescue Informative => e
raise Informative, "There was an error reading '#{yaml_file}'.\n" \
'Please consult http://blog.cocoapods.org/' \
'Repairing-Our-Broken-Specs-Repository/ ' \
'for more information.'
end
end end
public public
......
...@@ -14,6 +14,18 @@ def set_up_test_repo_for_update ...@@ -14,6 +14,18 @@ def set_up_test_repo_for_update
config.repos_dir = SpecHelper.tmp_repos_path config.repos_dir = SpecHelper.tmp_repos_path
end end
def merge_conflict_version_yaml
text = <<-VERSION.strip_heredoc
---
<<<<<<< HEAD
min: 0.18.1
=======
min: 0.29.0
>>>>>>> 8365d0ad18508175bbde31b9dd2bdaf1be49214f
last: 0.29.0
VERSION
end
module Pod module Pod
describe SourcesManager do describe SourcesManager do
...@@ -146,6 +158,12 @@ module Pod ...@@ -146,6 +158,12 @@ module Pod
e.message.should.match /Update CocoaPods/ e.message.should.match /Update CocoaPods/
end end
it 'raises when reading version information with merge conflict' do
Pathname.any_instance.stubs(:read).returns(merge_conflict_version_yaml)
e = lambda { SourcesManager.version_information(SourcesManager.master_repo_dir) }.should.raise Informative
e.message.should.match /Repairing-Our-Broken-Specs-Repository/
end
it "returns whether a repository is compatible" do it "returns whether a repository is compatible" do
SourcesManager.stubs(:version_information).returns({ 'min' => '0.0.1' }) SourcesManager.stubs(:version_information).returns({ 'min' => '0.0.1' })
SourcesManager.repo_compatible?('stub').should.be.true SourcesManager.repo_compatible?('stub').should.be.true
......
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