Changes warning message to be more explanatory. Adds one more spec.

Previous message was not covering the case where there are only pre-release versions between two stable versions, and user specifies version requirements for the pod such that only possibilities satisfying version requirements are pre-release versions. New message format also includes version requirements set by user in order to give a more explanatory output.
parent 784d6bc6
...@@ -8,13 +8,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -8,13 +8,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* Use watchsimulator when validating pods with the watchOS platform.
* Give a meaningful message for the case where there is no available stable version for a pod, * Give a meaningful message for the case where there is no available stable version for a pod,
and user do not explicitly specify the required version. and user do not explicitly specify the required version.
[Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz) [Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz)
[#4197](https://github.com/CocoaPods/CocoaPods/issues/4197) [#4197](https://github.com/CocoaPods/CocoaPods/issues/4197)
* Use watchsimulator when validatng PodSpecs with watchOS compatibility. * Use watchsimulator when validating pods with the watchOS platform.
[Thomas Kollbach](https://github.com/toto) [Thomas Kollbach](https://github.com/toto)
[#4130](https://github.com/CocoaPods/CocoaPods/issues/4130) [#4130](https://github.com/CocoaPods/CocoaPods/issues/4130)
......
...@@ -390,9 +390,14 @@ module Pod ...@@ -390,9 +390,14 @@ module Pod
conflict.requirement.head?) conflict.requirement.head?)
) )
# Conflict was caused by not specifying an explicit version for the requirement #[name], # Conflict was caused by not specifying an explicit version for the requirement #[name],
# and there is no available stable version for the requirement. # and there is no available stable version satisfying constraints for the requirement.
message = "There is no corresponding stable version for `#{name}`. " \ message = "There are only pre-release versions available satisfying the following requirements:\n"
"You should explicitly specify the version in order to install a pre-release version of `#{name}`" conflict.requirements.values.flatten.each do |r|
unless search_for(r).empty?
message << "\n\t'#{name}', '#{r.requirement}'\n"
end
end
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.each do |r| conflict.requirements.values.flatten.each do |r|
unless search_for(r).empty? unless search_for(r).empty?
......
...@@ -642,15 +642,28 @@ module Pod ...@@ -642,15 +642,28 @@ module Pod
specs.should == ['AFNetworking (1.2.1)'] specs.should == ['AFNetworking (1.2.1)']
end end
it 'raises when there is no explicit version specified and there are only pre-release versions' do it 'raises when no constraints are specified and only pre-release versions are available' do
podfile = Podfile.new do podfile = Podfile.new do
platform :ios platform :ios
pod 'PrereleaseMonkey' pod 'PrereleaseMonkey'
end end
resolver = Resolver.new(config.sandbox, podfile, empty_graph, SourcesManager.all) resolver = Resolver.new(config.sandbox, podfile, empty_graph, SourcesManager.all)
e = lambda { resolver.resolve }.should.raise Informative e = lambda { resolver.resolve }.should.raise Informative
e.message.should.match(/There is no corresponding stable version for `PrereleaseMonkey`/) e.message.should.match(/There are only pre-release versions available satisfying the following requirements/)
e.message.should.match(/You should explicitly specify the version in order to install a pre-release version of `PrereleaseMonkey`/) e.message.should.match(/PrereleaseMonkey.*>= 0/)
e.message.should.match(/You should explicitly specify the version in order to install a pre-release version/)
end
it 'raises when no explicit version is specified and only pre-release versions satisfy constraints' do
podfile = Podfile.new do
platform :ios
pod 'AFNetworking', '< 1.0', '> 0.10.1'
end
resolver = Resolver.new(config.sandbox, podfile, empty_graph, SourcesManager.all)
e = lambda { resolver.resolve }.should.raise Informative
e.message.should.match(/There are only pre-release versions available satisfying the following requirements/)
e.message.should.match(/AFNetworking.*< 1\.0, > 0\.10\.1/)
e.message.should.match(/You should explicitly specify the version in order to install a pre-release version/)
end end
it 'resolves when there is explicit pre-release version specified and there are only pre-release versions' do it 'resolves when there is explicit pre-release version specified and there are only pre-release versions' do
......
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