[rubygems/rubygems] Preserve the previous behavior of raising an error when in frozen mode
https://github.com/rubygems/rubygems/commit/6e35a6edfe
This commit is contained in:
parent
bc90090672
commit
3e4fedca4e
@ -108,7 +108,11 @@ module Bundler
|
|||||||
(spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
|
(spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
|
||||||
spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
|
spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
|
||||||
end
|
end
|
||||||
search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
|
if search.nil? && Bundler.frozen_bundle?
|
||||||
|
search = candidates.last
|
||||||
|
else
|
||||||
|
search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
|
||||||
|
end
|
||||||
search
|
search
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -241,55 +241,68 @@ RSpec.describe "bundle install with install-time dependencies" do
|
|||||||
expect(the_bundle).to include_gems("rack 1.2")
|
expect(the_bundle).to include_gems("rack 1.2")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "automatically updates lockfile to use the older version" do
|
context "when there is a lockfile using the newer incompatible version" do
|
||||||
build_repo2 do
|
before do
|
||||||
build_gem "parallel_tests", "3.7.0" do |s|
|
build_repo2 do
|
||||||
s.required_ruby_version = ">= #{current_ruby_minor}"
|
build_gem "parallel_tests", "3.7.0" do |s|
|
||||||
|
s.required_ruby_version = ">= #{current_ruby_minor}"
|
||||||
|
end
|
||||||
|
|
||||||
|
build_gem "parallel_tests", "3.8.0" do |s|
|
||||||
|
s.required_ruby_version = ">= #{next_ruby_minor}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
build_gem "parallel_tests", "3.8.0" do |s|
|
gemfile <<-G
|
||||||
s.required_ruby_version = ">= #{next_ruby_minor}"
|
source "http://localgemserver.test/"
|
||||||
end
|
gem 'parallel_tests'
|
||||||
|
G
|
||||||
|
|
||||||
|
lockfile <<~L
|
||||||
|
GEM
|
||||||
|
remote: http://localgemserver.test/
|
||||||
|
specs:
|
||||||
|
parallel_tests (3.8.0)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
#{lockfile_platforms}
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
parallel_tests
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
end
|
end
|
||||||
|
|
||||||
gemfile <<-G
|
it "automatically updates lockfile to use the older version" do
|
||||||
source "http://localgemserver.test/"
|
bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
|
||||||
gem 'parallel_tests'
|
|
||||||
G
|
|
||||||
|
|
||||||
lockfile <<~L
|
expect(lockfile).to eq <<~L
|
||||||
GEM
|
GEM
|
||||||
remote: http://localgemserver.test/
|
remote: http://localgemserver.test/
|
||||||
specs:
|
specs:
|
||||||
parallel_tests (3.8.0)
|
parallel_tests (3.7.0)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
#{lockfile_platforms}
|
#{lockfile_platforms}
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
parallel_tests
|
parallel_tests
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
#{Bundler::VERSION}
|
#{Bundler::VERSION}
|
||||||
L
|
L
|
||||||
|
end
|
||||||
|
|
||||||
bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
|
it "gives a meaningful error if we're in frozen mode" do
|
||||||
|
expect do
|
||||||
|
bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s, "BUNDLE_FROZEN" => "true" }, :raise_on_error => false
|
||||||
|
end.not_to change { lockfile }
|
||||||
|
|
||||||
expect(lockfile).to eq <<~L
|
expect(err).to include("parallel_tests-3.8.0 requires ruby version >= #{next_ruby_minor}")
|
||||||
GEM
|
expect(err).not_to include("That means the author of parallel_tests (3.8.0) has removed it.")
|
||||||
remote: http://localgemserver.test/
|
end
|
||||||
specs:
|
|
||||||
parallel_tests (3.7.0)
|
|
||||||
|
|
||||||
PLATFORMS
|
|
||||||
#{lockfile_platforms}
|
|
||||||
|
|
||||||
DEPENDENCIES
|
|
||||||
parallel_tests
|
|
||||||
|
|
||||||
BUNDLED WITH
|
|
||||||
#{Bundler::VERSION}
|
|
||||||
L
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "gives a meaningful error on ruby version mismatches between dependencies" do
|
it "gives a meaningful error on ruby version mismatches between dependencies" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user