Update Bundler to 2.4.1 & and RubyGems to 3.4.1

This commit is contained in:
David Rodríguez 2022-12-24 20:42:50 +01:00 коммит произвёл Hiroshi SHIBATA
Родитель 3cbe37bd35
Коммит 8f05e4f54b
12 изменённых файлов: 91 добавлений и 22 удалений

Просмотреть файл

@ -311,7 +311,16 @@ module Bundler
def prepare_dependencies(requirements, packages)
to_dependency_hash(requirements, packages).map do |dep_package, dep_constraint|
name = dep_package.name
next if dep_package.platforms.empty?
# If a dependency is scoped to a platform different from the current
# one, we ignore it. However, it may reappear during resolution as a
# transitive dependency of another package, so we need to reset the
# package so the proper versions are considered if reintroduced later.
if dep_package.platforms.empty?
@packages.delete(name)
next
end
next [dep_package, dep_constraint] if name == "bundler"
next [dep_package, dep_constraint] unless versions_for(dep_package, dep_constraint.range).empty?
next unless dep_package.current_platform?

Просмотреть файл

@ -58,6 +58,7 @@ module Bundler
@explicit_ref = branch || tag || ref
@revision = revision
@git = git
@commit_ref = nil
end
def revision
@ -116,7 +117,7 @@ module Bundler
end
end
git "fetch", "--force", "--quiet", *extra_fetch_args, :dir => destination
git "fetch", "--force", "--quiet", *extra_fetch_args, :dir => destination if @commit_ref
git "reset", "--hard", @revision, :dir => destination
@ -185,11 +186,16 @@ module Bundler
end
def refspec
return ref if pinned_to_full_sha?
commit = pinned_to_full_sha? ? ref : @revision
ref_to_fetch = @revision || fully_qualified_ref
if commit
@commit_ref = "refs/#{commit}-sha"
return "#{commit}:#{@commit_ref}"
end
ref_to_fetch ||= if ref.include?("~")
reference = fully_qualified_ref
reference ||= if ref.include?("~")
ref.split("~").first
elsif ref.start_with?("refs/")
ref
@ -197,7 +203,7 @@ module Bundler
"refs/*"
end
"#{ref_to_fetch}:#{ref_to_fetch}"
"#{reference}:#{reference}"
end
def fully_qualified_ref
@ -218,10 +224,6 @@ module Bundler
ref =~ /\A\h{40}\z/
end
def legacy_locked_revision?
!@revision.nil? && @revision =~ /\A\h{7}\z/
end
def git_null(*command, dir: nil)
check_allowed(command)
@ -241,9 +243,9 @@ module Bundler
out, err, status = capture(command, dir)
Bundler.ui.warn err unless err.empty?
raise GitCommandError.new(command_with_no_credentials, dir || SharedHelpers.pwd, err) unless status.success?
raise GitCommandError.new(command_with_no_credentials, dir || SharedHelpers.pwd, out) unless status.success?
Bundler.ui.warn err unless err.empty?
out
end
@ -344,9 +346,10 @@ module Bundler
end
def extra_clone_args
return [] if full_clone?
args = depth_args
return [] if args.empty?
args = ["--depth", depth.to_s, "--single-branch"]
args += ["--single-branch"]
args.unshift("--no-tags") if supports_cloning_with_no_tags?
args += ["--branch", branch || tag] if branch || tag
@ -361,7 +364,7 @@ module Bundler
def extra_fetch_args
extra_args = [path.to_s, *depth_args]
extra_args.push(revision) unless legacy_locked_revision?
extra_args.push(@commit_ref)
extra_args
end

Просмотреть файл

@ -1,7 +1,7 @@
# frozen_string_literal: false
module Bundler
VERSION = "2.4.0".freeze
VERSION = "2.4.1".freeze
def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i

Просмотреть файл

@ -8,7 +8,7 @@
require "rbconfig"
module Gem
VERSION = "3.4.0".freeze
VERSION = "3.4.1".freeze
end
# Must be first since it unloads the prelude from 1.9.2

Просмотреть файл

@ -15,7 +15,7 @@ else
require "bundler"
end
if Gem.rubygems_version < Gem::Version.new("3.2.3") && Gem.ruby_version < Gem::Version.new("3.0.a") && !ENV["BUNDLER_NO_OLD_RUBYGEMS_WARNING"]
if Gem.rubygems_version < Gem::Version.new("3.2.3") && Gem.ruby_version < Gem::Version.new("2.7.a") && !ENV["BUNDLER_NO_OLD_RUBYGEMS_WARNING"]
Bundler.ui.warn \
"Your RubyGems version (#{Gem::VERSION}) has a bug that prevents " \
"`required_ruby_version` from working for Bundler. Any scripts that use " \

Просмотреть файл

@ -193,6 +193,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
expect(err).to be_empty
run <<-RUBY
require 'foo'

Просмотреть файл

@ -572,6 +572,26 @@ RSpec.describe "bundle install with platform conditionals" do
#{Bundler::VERSION}
L
end
it "resolves fine when a dependency is unused on a platform different from the current one, but reintroduced transitively" do
bundle "config set --local force_ruby_platform true"
build_repo4 do
build_gem "listen", "3.7.1" do |s|
s.add_dependency "ffi"
end
build_gem "ffi", "1.15.5"
end
install_gemfile <<~G
source "#{file_uri_for(gem_repo4)}"
gem "listen"
gem "ffi", :platform => :windows
G
expect(err).to be_empty
end
end
RSpec.describe "when a gem has no architecture" do

Просмотреть файл

@ -90,6 +90,42 @@ RSpec.describe "bundle lock with git gems" do
expect(err).to be_empty
end
it "properly fetches a git source locked to an annotated tag" do
# Create an annotated tag
git("tag -a v1.0 -m 'Annotated v1.0'", lib_path("foo-1.0"))
annotated_tag = git("rev-parse v1.0", lib_path("foo-1.0"))
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'foo', :git => "#{lib_path("foo-1.0")}"
G
lockfile <<-L
GIT
remote: #{lib_path("foo-1.0")}
revision: #{annotated_tag}
specs:
foo (1.0)
GEM
remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
#{lockfile_platforms}
DEPENDENCIES
foo!
BUNDLED WITH
#{Bundler::VERSION}
L
bundle "install"
expect(err).to be_empty
end
it "provides correct #full_gem_path" do
run <<-RUBY
puts Bundler.rubygems.find_name('foo').first.full_gem_path

Просмотреть файл

@ -54,4 +54,4 @@ DEPENDENCIES
webrick (~> 1.6)
BUNDLED WITH
2.4.0
2.4.1

Просмотреть файл

@ -70,4 +70,4 @@ DEPENDENCIES
test-unit
BUNDLED WITH
2.4.0
2.4.1

Просмотреть файл

@ -78,4 +78,4 @@ DEPENDENCIES
test-unit
BUNDLED WITH
2.4.0
2.4.1

Просмотреть файл

@ -42,4 +42,4 @@ DEPENDENCIES
webrick (= 1.7.0)
BUNDLED WITH
2.4.0
2.4.1