mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Allow bundle update
to downgrade gems by changing the Gemfile
https://github.com/rubygems/rubygems/commit/6a19cca7e5
This commit is contained in:
parent
55f574136c
commit
80f39d78df
2 changed files with 62 additions and 1 deletions
|
@ -853,7 +853,7 @@ module Bundler
|
||||||
def additional_base_requirements_for_resolve
|
def additional_base_requirements_for_resolve
|
||||||
return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
|
return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
|
||||||
dependencies_by_name = dependencies.inject({}) {|memo, dep| memo.update(dep.name => dep) }
|
dependencies_by_name = dependencies.inject({}) {|memo, dep| memo.update(dep.name => dep) }
|
||||||
@locked_gems.specs.reduce({}) do |requirements, locked_spec|
|
converge_specs(@locked_gems.specs).reduce({}) do |requirements, locked_spec|
|
||||||
name = locked_spec.name
|
name = locked_spec.name
|
||||||
dependency = dependencies_by_name[name]
|
dependency = dependencies_by_name[name]
|
||||||
next requirements if @locked_gems.dependencies[name] != dependency
|
next requirements if @locked_gems.dependencies[name] != dependency
|
||||||
|
|
|
@ -354,6 +354,67 @@ RSpec.describe "bundle update" do
|
||||||
|
|
||||||
expect(the_bundle).to include_gems("a 1.0", "b 1.0")
|
expect(the_bundle).to include_gems("a 1.0", "b 1.0")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should still downgrade if forced by the Gemfile, when transitive dependencies also need downgrade" do
|
||||||
|
build_repo4 do
|
||||||
|
build_gem "activesupport", "6.1.4.1" do |s|
|
||||||
|
s.add_dependency "tzinfo", "~> 2.0"
|
||||||
|
end
|
||||||
|
|
||||||
|
build_gem "activesupport", "6.0.4.1" do |s|
|
||||||
|
s.add_dependency "tzinfo", "~> 1.1"
|
||||||
|
end
|
||||||
|
|
||||||
|
build_gem "tzinfo", "2.0.4"
|
||||||
|
build_gem "tzinfo", "1.2.9"
|
||||||
|
end
|
||||||
|
|
||||||
|
install_gemfile <<-G
|
||||||
|
source "#{file_uri_for(gem_repo4)}"
|
||||||
|
gem "activesupport", "~> 6.1.0"
|
||||||
|
G
|
||||||
|
|
||||||
|
expect(the_bundle).to include_gems("activesupport 6.1.4.1", "tzinfo 2.0.4")
|
||||||
|
|
||||||
|
gemfile <<-G
|
||||||
|
source "#{file_uri_for(gem_repo4)}"
|
||||||
|
gem "activesupport", "~> 6.0.0"
|
||||||
|
G
|
||||||
|
|
||||||
|
original_lockfile = lockfile
|
||||||
|
|
||||||
|
expected_lockfile = <<~L
|
||||||
|
GEM
|
||||||
|
remote: #{file_uri_for(gem_repo4)}/
|
||||||
|
specs:
|
||||||
|
activesupport (6.0.4.1)
|
||||||
|
tzinfo (~> 1.1)
|
||||||
|
tzinfo (1.2.9)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
#{lockfile_platforms}
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
activesupport (~> 6.0.0)
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
|
|
||||||
|
bundle "update activesupport"
|
||||||
|
expect(the_bundle).to include_gems("activesupport 6.0.4.1", "tzinfo 1.2.9")
|
||||||
|
expect(lockfile).to eq(expected_lockfile)
|
||||||
|
|
||||||
|
lockfile original_lockfile
|
||||||
|
bundle "update"
|
||||||
|
expect(the_bundle).to include_gems("activesupport 6.0.4.1", "tzinfo 1.2.9")
|
||||||
|
expect(lockfile).to eq(expected_lockfile)
|
||||||
|
|
||||||
|
lockfile original_lockfile
|
||||||
|
bundle "lock --update"
|
||||||
|
expect(the_bundle).to include_gems("activesupport 6.0.4.1", "tzinfo 1.2.9")
|
||||||
|
expect(lockfile).to eq(expected_lockfile)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "with --local option" do
|
describe "with --local option" do
|
||||||
|
|
Loading…
Add table
Reference in a new issue