summaryrefslogtreecommitdiff
path: root/lib/bundler/resolver.rb
diff options
context:
space:
mode:
authorchrismo <chrismo@clabs.org>2016-06-22 00:04:56 -0500
committerchrismo <chrismo@clabs.org>2016-07-08 19:35:57 -0500
commit861eb2b00b99516f4c43f4be5380bf00e2039416 (patch)
treeff640f14f2762a53a5494c963aa3f9eba90c0747 /lib/bundler/resolver.rb
parent8cbe425e39ec0d710309993956dc37fe8abbb733 (diff)
downloadbundler-861eb2b00b99516f4c43f4be5380bf00e2039416.tar.gz
Fix up major support in GVP.
If GVP handles the default :major case, it now passes all the specs, but that's a lot of existing functionality to hand off to it at this stage, so I kept in the conditional to just roll with existing results if :major. Got rid of a couple of superfluous begin/end I'd included to make RubyMine auto-format the code in a way that made Rubocop happy.
Diffstat (limited to 'lib/bundler/resolver.rb')
-rw-r--r--lib/bundler/resolver.rb42
1 files changed, 20 insertions, 22 deletions
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index eb564f5857..e1df04efb1 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -250,32 +250,30 @@ module Bundler
if vertex = @base_dg.vertex_named(dependency.name)
locked_requirement = vertex.payload.requirement
end
- spec_groups = begin
- if results.any?
- nested = []
- results.each do |spec|
- version, specs = nested.last
- if version == spec.version
- specs << spec
- else
- nested << [spec.version, [spec]]
- end
- end
- nested.reduce([]) do |groups, (version, specs)|
- next groups if locked_requirement && !locked_requirement.satisfied_by?(version)
- groups << SpecGroup.new(specs)
+ spec_groups = if results.any?
+ nested = []
+ results.each do |spec|
+ version, specs = nested.last
+ if version == spec.version
+ specs << spec
+ else
+ nested << [spec.version, [spec]]
end
- else
- []
end
- end
- # MODO: ideally trying to get GVP to sort by major. but some test cases aren't showing consistent order
- # by default. (so we don't have to have this conditional here)
- if @gem_version_promoter.level != :major
- @gem_version_promoter.sort_versions(dependency, spec_groups)
+ nested.reduce([]) do |groups, (version, specs)|
+ next groups if locked_requirement && !locked_requirement.satisfied_by?(version)
+ groups << SpecGroup.new(specs)
+ end
else
+ []
+ end
+ # GVP handles major itself, but it's still a bit risky to trust it with it
+ # until we get it settled with new behavior. For 2.x it can take over all cases.
+ if @gem_version_promoter.major?
spec_groups
- end # .tap {|sg| STDERR.puts "sg>> #{sg.inspect}" }
+ else
+ @gem_version_promoter.sort_versions(dependency, spec_groups)
+ end
end
search.select {|sg| sg.for?(platform, @ruby_version) }.each {|sg| sg.activate_platform!(platform) }
end