diff options
author | chrismo <chrismo@clabs.org> | 2016-06-21 17:43:41 -0500 |
---|---|---|
committer | chrismo <chrismo@clabs.org> | 2016-07-08 19:35:57 -0500 |
commit | 93fac82496e17b16717cd2d1f7a3ab8fec66a51e (patch) | |
tree | 8fa9052b643b412743eadb0edf38d8d9ea6bf543 | |
parent | 3d3aeda062896d71396e9529decc60acf15f108b (diff) | |
download | bundler-93fac82496e17b16717cd2d1f7a3ab8fec66a51e.tar.gz |
Remove minimal option
-rw-r--r-- | lib/bundler/gem_version_promoter.rb | 10 | ||||
-rw-r--r-- | spec/bundler/gem_version_promoter_spec.rb | 26 | ||||
-rw-r--r-- | spec/resolver/basic_spec.rb | 15 | ||||
-rw-r--r-- | spec/support/indexes.rb | 1 |
4 files changed, 3 insertions, 49 deletions
diff --git a/lib/bundler/gem_version_promoter.rb b/lib/bundler/gem_version_promoter.rb index 3bacd6002d..98e7ef9394 100644 --- a/lib/bundler/gem_version_promoter.rb +++ b/lib/bundler/gem_version_promoter.rb @@ -2,13 +2,12 @@ module Bundler class GemVersionPromoter attr_reader :level, :locked_specs, :unlock_gems - attr_accessor :strict, :minimal + attr_accessor :strict def initialize(locked_specs = SpecSet.new([]), unlock_gems = []) @level_default = :major @level = @level_default @strict = false - @minimal = false @locked_specs = locked_specs @unlock_gems = unlock_gems @sort_versions = {} @@ -93,11 +92,6 @@ module Bundler b_ver <=> a_ver when !(@level == :minor) && (a_ver.segments[1] != b_ver.segments[1]) b_ver <=> a_ver - when @minimal && !unlocking_gem?(gem_name) - b_ver <=> a_ver - when @minimal && unlocking_gem?(gem_name) && - ![a_ver, b_ver].include?(locked_version) # MODO: revisit this case - b_ver <=> a_ver else a_ver <=> b_ver end @@ -123,7 +117,7 @@ module Bundler a = [dep.to_s, res.map {|sg| [sg.version, sg.dependencies_for_activated_platforms.map {|dp| [dp.name, dp.requirement.to_s] }] }] [a.first, a.last.map {|sg_data| [sg_data.first.version, sg_data.last.map {|aa| aa.join(" ") }] }, - @level, @strict ? :strict : :not_strict, @minimal ? :minimal : :not_minimal] + @level, @strict ? :strict : :not_strict] end end end diff --git a/spec/bundler/gem_version_promoter_spec.rb b/spec/bundler/gem_version_promoter_spec.rb index c34de89bf3..aab06367c3 100644 --- a/spec/bundler/gem_version_promoter_spec.rb +++ b/spec/bundler/gem_version_promoter_spec.rb @@ -17,7 +17,6 @@ describe Bundler::GemVersionPromoter do make_instance(Bundler::SpecSet.new([]), ["foo"]).tap do |p| p.level = options[:level] if options[:level] p.strict = options[:strict] if options[:strict] - p.minimal = options[:minimal] if options[:minimal] end end @@ -25,7 +24,6 @@ describe Bundler::GemVersionPromoter do make_instance(Bundler::SpecSet.new([]), ["bar"]).tap do |p| p.level = options[:level] if options[:level] p.strict = options[:strict] if options[:strict] - p.minimal = options[:minimal] if options[:minimal] end end @@ -69,7 +67,7 @@ describe Bundler::GemVersionPromoter do end context "filter specs (strict) (minor preferred)" do - it "should have specs" + it "should have specs" # MODO: so, y'know, like, maybe ... make some? end context "sort specs (not strict) (minor not allowed)" do @@ -104,24 +102,6 @@ describe Bundler::GemVersionPromoter do build_spec("foo", "1.7.9").first) expect(versions(res)).to eq %w(2.0.0 1.8.0 1.7.9) end - - it "when prefer_minimal, and not updating this gem, order is strictly oldest to newest" do - keep_locked(:minimal => true) - versions = %w(1.7.5 1.7.8 1.7.9 1.8.0 2.0.0 2.1.0 3.0.0 3.0.1 3.1.0) - res = @gvp.sort_dep_specs( - build_spec_group("foo", versions), - build_spec("foo", "1.7.5").first) - expect(versions(res)).to eq versions.reverse - end - - it "when prefer_minimal, and updating this gem, order is oldest to newest except current" do - unlocking(:minimal => true) - versions = %w(1.7.5 1.7.8 1.7.9 1.8.0 2.0.0 2.1.0 3.0.0 3.0.1 3.1.0) - res = @gvp.sort_dep_specs( - build_spec_group("foo", versions), - build_spec("foo", "1.7.5").first) - expect(versions(res)).to eq %w(3.1.0 3.0.1 3.0.0 2.1.0 2.0.0 1.8.0 1.7.5 1.7.9 1.7.8) - end end context "sort specs (not strict) (minor allowed)" do @@ -132,10 +112,6 @@ describe Bundler::GemVersionPromoter do build_spec("foo", "0.2.0").first) expect(versions(res)).to eq %w(2.0.0 2.0.1 1.0.0 0.2.0 0.3.0 0.3.1 0.9.0) end - - it "new version specified" - - it "new version specified, prefer_minimal" end context "caching search results" do diff --git a/spec/resolver/basic_spec.rb b/spec/resolver/basic_spec.rb index d65bab49ac..90233d0389 100644 --- a/spec/resolver/basic_spec.rb +++ b/spec/resolver/basic_spec.rb @@ -134,12 +134,6 @@ describe "Resolving" do should_conservative_resolve_and_include [:patch, :strict], [], %w(foo-1.4.4 bar-2.0.5) end - it "resolves all gems to latest patch minimal" do - # MODO: remove minimal - # minimal is set, so foo goes up the next available to 1.4.4 and bar goes up to next available 2.0.4 - should_conservative_resolve_and_include [:patch, :minimal], [], %w(foo-1.4.4 bar-2.0.4) - end - it "resolves foo only to latest patch - same dependency case" do @locked = locked(%w(foo 1.3.7), %w(bar 2.0.3)) # bar is locked, and the lock holds here because the dependency on bar doesn't change on the matching foo version. @@ -185,15 +179,6 @@ describe "Resolving" do should_conservative_resolve_and_include [:minor, :strict], [], %w(foo-1.5.0 bar-2.1.1) end - it "resolves all gems to latest minor minimal" do - # MODO: remove minimal - # minimal is set, and it takes precedence over minor. not sure what is the PoLS in this case. Not sure - # if minimal is a great option in the first place. It exists to help a case where there are many, many - # versions and I'd rather go from 1.0.2 to 1.0.3 instead of 1.0.45. But, we could consider killing the - # minimal option altogether. If that's what you need, use the Gemfile dependency. - should_conservative_resolve_and_include [:minor, :minimal], [], %w(foo-1.4.4 bar-2.0.4) - end - it "could revert to a previous version" it "will not revert to a previous version in strict mode" diff --git a/spec/support/indexes.rb b/spec/support/indexes.rb index 59ee91ca52..9a7879bc74 100644 --- a/spec/support/indexes.rb +++ b/spec/support/indexes.rb @@ -61,7 +61,6 @@ module Spec search = Bundler::GemVersionPromoter.new(@locked, unlock).tap do |s| s.level = opts.first s.strict = opts.include?(:strict) - s.minimal = opts.include?(:minimal) end should_resolve_and_include specs, [{}, @base, nil, search] end |