Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #6570 - akihiro17:prerelease-dependency, r=segiddins
Browse files Browse the repository at this point in the history
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 a97917c)
  • Loading branch information
bundlerbot authored and colby-swandale committed Aug 16, 2018
1 parent aa65090 commit 2932f88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/bundler/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@ def name_for_locking_dependency_source

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
Expand Down
7 changes: 7 additions & 0 deletions spec/resolver/basic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@
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"
Expand Down

0 comments on commit 2932f88

Please sign in to comment.