Commit dc14b95a authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4198 from manuyavuz/master

[Resolver] Give a meaningful message for the case where there is no stable version for a pod, and user do not explicitly specify the required version.
parents 5a735580 325cc689
......@@ -8,7 +8,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### 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,
and user do not explicitly specify the required version.
[Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz)
[#4197](https://github.com/CocoaPods/CocoaPods/issues/4197)
* Use watchsimulator when validating pods with the watchOS platform.
[Thomas Kollbach](https://github.com/toto)
[#4130](https://github.com/CocoaPods/CocoaPods/issues/4130)
......
......@@ -383,6 +383,21 @@ module Pod
'version requirement to your Podfile ' \
"(e.g. `pod '#{name}', '#{lockfile_reqs.map(&:requirement).join("', '")}'`) " \
"or revert to a stable version by running `pod update #{name}`."
elsif (conflict.possibility && conflict.possibility.version.prerelease?) &&
(conflict.requirement && !(
conflict.requirement.prerelease? ||
conflict.requirement.external_source ||
conflict.requirement.head?)
)
# Conflict was caused by not specifying an explicit version for the requirement #[name],
# and there is no available stable version satisfying constraints for the requirement.
message = "There are only pre-release versions available satisfying the following requirements:\n"
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
conflict.requirements.values.flatten.each do |r|
unless search_for(r).empty?
......
Pod::Spec.new do |s|
s.name = "PrereleaseMonkey"
s.version = "1.0-alpha1"
s.author = { "Funky Monkey" => "funky@monkey.local" }
s.summary = "🙈🙉🙊"
s.description = "See no evil! Hear no evil! Speak no evil!"
s.homepage = "http://httpbin.org/html"
s.source = { :git => "http://monkey.local/monkey.git", :tag => s.version.to_s }
s.license = 'MIT'
s.vendored_library = 'monkey.a'
end
Pod::Spec.new do |s|
s.name = "PrereleaseMonkey"
s.version = "1.0-beta1"
s.author = { "Funky Monkey" => "funky@monkey.local" }
s.summary = "🙈🙉🙊"
s.description = "See no evil! Hear no evil! Speak no evil!"
s.homepage = "http://httpbin.org/html"
s.source = { :git => "http://monkey.local/monkey.git", :tag => s.version.to_s }
s.license = 'MIT'
s.vendored_library = 'monkey.a'
end
......@@ -641,6 +641,40 @@ module Pod
specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)']
end
it 'raises when no constraints are specified and only pre-release versions are available' do
podfile = Podfile.new do
platform :ios
pod 'PrereleaseMonkey'
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(/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
it 'resolves when there is explicit pre-release version specified and there are only pre-release versions' do
podfile = Podfile.new do
platform :ios
pod 'PrereleaseMonkey', '1.0-beta1'
end
resolver = Resolver.new(config.sandbox, podfile, empty_graph, SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should == ['PrereleaseMonkey (1.0-beta1)']
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