Unverified Commit 39a41037 authored by Orta Therox's avatar Orta Therox Committed by Samuel Giddins

Improve messaging when dependencies conflict

parent 66b37f69
...@@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
[#5218](https://github.com/CocoaPods/CocoaPods/issues/5218) [#5218](https://github.com/CocoaPods/CocoaPods/issues/5218)
* Improvements to the error messaging around missing dependencies.
[Orta Therox](https://github.com/orta)
[#5260](https://github.com/CocoaPods/CocoaPods/issues/5260)
##### Bug Fixes ##### Bug Fixes
* None. * None.
......
...@@ -419,20 +419,22 @@ module Pod ...@@ -419,20 +419,22 @@ module Pod
end end
message << "\nYou should explicitly specify the version in order to install a pre-release version" message << "\nYou should explicitly specify the version in order to install a pre-release version"
elsif !conflict.existing elsif !conflict.existing
conflict.requirements.values.flatten.uniq.each do |r| conflicts = conflict.requirements.values.flatten.uniq
if search_for(r).empty? found_conflicted_specs = conflicts.reject { |c| search_for(c).empty? }
# There are no existing specification inside any of the spec repos with given requirements. if found_conflicted_specs.empty?
message << "\n\nNone of your spec sources contain a spec satisfying the dependency: `#{r}`." \ # There are no existing specification inside any of the spec repos with given requirements.
"\n\nYou have either:" \ dependencies = conflicts.count == 1 ? 'dependency' : 'dependencies'
"\n * out-of-date source repos which you can update with `pod repo update`." \ message << "\n\nNone of your spec sources contain a spec satisfying "\
"\n * mistyped the name or version." \ "the #{dependencies}: `#{conflicts.join(', ')}`." \
"\n * not added the source repo that hosts the Podspec to your Podfile." \ "\n\nYou have either:" \
"\n\nNote: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default." "\n * out-of-date source repos which you can update with `pod repo update`." \
"\n * mistyped the name or version." \
else "\n * not added the source repo that hosts the Podspec to your Podfile." \
message << "\n\nSpecs satisfying the `#{r}` dependency were found, " \ "\n\nNote: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default."
'but they required a higher minimum deployment target.'
end else
message << "\n\nSpecs satisfying the `#{conflicts.join(', ')}` dependency were found, " \
'but they required a higher minimum deployment target.'
end end
end end
end end
......
...@@ -369,6 +369,27 @@ module Pod ...@@ -369,6 +369,27 @@ module Pod
e.message.should.match(/Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default./) e.message.should.match(/Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default./)
end end
it 'raises with a list of dependencies if there are many dependencies but no versions of a dependency exists' do
podfile = Podfile.new do
platform :ios
pod 'AFNetworking', '3.0.1'
end
locked_deps = dependency_graph_from_array([Dependency.new('AFNetworking', '= 1.4')])
resolver = Resolver.new(config.sandbox, podfile, locked_deps, config.sources_manager.all)
e = lambda { resolver.resolve }.should.raise Informative
e.message.should.match(/Unable to satisfy the following requirements/)
e.message.should.match(/`AFNetworking \(= 3.0.1\)` required by `Podfile`/)
e.message.should.match(/`AFNetworking \(= 1.4\)` required by `Podfile.lock`/)
e.message.should.match(/None of your spec sources contain a spec satisfying the dependencies:/)
e.message.should.match(/`AFNetworking \(= 3.0.1\), AFNetworking \(= 1.4\)`/)
e.message.should.match(/You have either:/)
e.message.should.match(/ * out-of-date source repos which you can update with `pod repo update`/)
e.message.should.match(/ * not added the source repo that hosts the Podspec to your Podfile./)
e.message.should.match(/ * out-of-date source repos which you can update with `pod repo update`/)
e.message.should.match(/Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default./)
end
it 'takes into account locked dependencies' do it 'takes into account locked dependencies' do
podfile = Podfile.new do podfile = Podfile.new do
platform :ios platform :ios
......
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