diff options
author | The Bundler Bot <bot@bundler.io> | 2018-06-20 05:16:08 +0000 |
---|---|---|
committer | Colby Swandale <hello@colby.fyi> | 2018-08-16 21:42:28 +1000 |
commit | 2932f888d2a2e7acd8445c79e60e0596e8782a2b (patch) | |
tree | 41edbd49aeb8761b31b3b72f53788f35dbe49854 | |
parent | aa65090c78cc7e0b07bce4ef965bf2eb95839a58 (diff) | |
download | bundler-2932f888d2a2e7acd8445c79e60e0596e8782a2b.tar.gz |
Auto merge of #6570 - akihiro17:prerelease-dependency, r=segiddins
select a pre-release if it's specified in the Gemfile
### What was the end-user problem that led to this PR?
The problem was #6449
Closes #6449
### What was your diagnosis of the problem?
My diagnosis was that Bundler didn't select a pre-release even if one of the dependencies of a gem was specified with a pre-release version in the Gemfile.
### What is your fix for the problem, implemented in this PR?
My fix is to change `Bundler::Resolver#requirement_satisfied_by?` so that it does not reject a pre-release if at least one of the dependencies is pre-released.
### Why did you choose this fix out of the possible options?
(cherry picked from commit a97917cdf609d8de93bd887eabdf45465019a5f2)
-rw-r--r-- | lib/bundler/resolver.rb | 4 | ||||
-rw-r--r-- | spec/resolver/basic_spec.rb | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 052d776183..f8cb1a34c3 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -179,10 +179,6 @@ module Bundler def requirement_satisfied_by?(requirement, activated, spec) return false unless requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec) - if spec.version.prerelease? && !requirement.prerelease? && search_for(requirement).any? {|sg| !sg.version.prerelease? } - vertex = activated.vertex_named(spec.name) - return false if vertex.requirements.none?(&:prerelease?) - end spec.activate_platform!(requirement.__platform) if !@platforms || @platforms.include?(requirement.__platform) true end diff --git a/spec/resolver/basic_spec.rb b/spec/resolver/basic_spec.rb index 623d092644..0577a718b9 100644 --- a/spec/resolver/basic_spec.rb +++ b/spec/resolver/basic_spec.rb @@ -80,6 +80,13 @@ RSpec.describe "Resolving" do should_resolve_as %w[need-pre-1.0.0 activesupport-3.0.0.beta1] end + it "selects a pre-release if it's specified in the Gemfile" do + dep "activesupport", "= 3.0.0.beta" + dep "actionpack" + + should_resolve_as %w[activesupport-3.0.0.beta actionpack-3.0.0.beta rack-1.1 rack-mount-0.6] + end + it "raises an exception if a child dependency is not resolved" do @index = a_unresovable_child_index dep "chef_app_error" |