diff options
author | Hiroshi SHIBATA <[email protected]> | 2023-12-22 07:01:12 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2023-12-22 07:24:04 +0900 |
commit | 82496f2b389278a569fa7680ee6faa55a97410d7 () | |
tree | acce0c98431a9f617be3d5c971b4c684155c5b94 /lib | |
parent | fc549b2b3a65a95a734ee8679293a30284f84622 (diff) |
Merge RubyGems-3.5.2 and Bundler-2.5.2
-rw-r--r-- | lib/bundler/definition.rb | 30 | ||||
-rw-r--r-- | lib/bundler/lazy_specification.rb | 2 | ||||
-rw-r--r-- | lib/bundler/remote_specification.rb | 4 | ||||
-rw-r--r-- | lib/bundler/self_manager.rb | 2 | ||||
-rw-r--r-- | lib/bundler/spec_set.rb | 42 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/shell/color.rb | 3 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/shell/html.rb | 3 | ||||
-rw-r--r-- | lib/bundler/vendor/thor/lib/thor/shell/lcs_diff.rb | 49 | ||||
-rw-r--r-- | lib/bundler/version.rb | 2 | ||||
-rw-r--r-- | lib/rubygems.rb | 9 | ||||
-rw-r--r-- | lib/rubygems/basic_specification.rb | 8 | ||||
-rw-r--r-- | lib/rubygems/package.rb | 14 | ||||
-rw-r--r-- | lib/rubygems/request.rb | 8 |
13 files changed, 93 insertions, 83 deletions
@@ -496,7 +496,15 @@ module Bundler private :sources def nothing_changed? - !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@missing_lockfile_dep && !@unlocking_bundler && !@invalid_lockfile_dep end def no_resolve_needed? @@ -653,7 +661,8 @@ module Bundler [@local_changes, "the gemspecs for git local gems changed"], [@missing_lockfile_dep, "your lock file is missing \"#{@missing_lockfile_dep}\""], [@unlocking_bundler, "an update to the version of Bundler itself was requested"], - [@invalid_lockfile_dep, "your lock file has an invalid dependency \"#{@invalid_lockfile_dep}\""], ].select(&:first).map(&:last).join(", ") end @@ -708,26 +717,25 @@ module Bundler end def check_lockfile - @invalid_lockfile_dep = nil @missing_lockfile_dep = nil - locked_names = @locked_specs.map(&:name) missing = [] invalid = [] @locked_specs.each do |s| - s.dependencies.each do |dep| - next if dep.name == "bundler" - missing << s unless locked_names.include?(dep.name) - invalid << s if @locked_specs.none? {|spec| dep.matches_spec?(spec) } - end end if missing.any? @locked_specs.delete(missing) - @missing_lockfile_dep = missing.first.name elsif !@dependency_changes @missing_lockfile_dep = current_dependencies.find do |d| @locked_specs[d.name].empty? && d.name != "bundler" @@ -737,7 +745,7 @@ module Bundler if invalid.any? @locked_specs.delete(invalid) - @invalid_lockfile_dep = invalid.first.name end end @@ -10,6 +10,8 @@ module Bundler attr_reader :name, :version, :platform attr_accessor :source, :remote, :force_ruby_platform, :dependencies, :required_ruby_version, :required_rubygems_version def self.from_spec(s) lazy_spec = new(s.name, s.version, s.platform, s.source) lazy_spec.dependencies = s.dependencies @@ -88,6 +88,10 @@ module Bundler end end def git_version return unless loaded_from && source.is_a?(Bundler::Source::Git) " #{source.revision[0..6]}" @@ -121,7 +121,7 @@ module Bundler source = Bundler::Source::Rubygems.new("remotes" => "https://rubygems.org") source.remote! source.add_dependency_names("bundler") - source.specs end end @@ -37,7 +37,7 @@ module Bundler specs_for_dep.first.dependencies.each do |d| next if d.type == :development - incomplete = true if d.name != "bundler" && lookup[d.name].empty? deps << [d, dep[1]] end else @@ -45,7 +45,7 @@ module Bundler end if incomplete && check - @incomplete_specs += lookup[name].any? ? lookup[name] : [LazySpecification.new(name, nil, nil)] end end @@ -64,7 +64,9 @@ module Bundler valid_platform = lookup.all? do |_, specs| spec = specs.first matching_specs = spec.source.specs.search([spec.name, spec.version]) - platform_spec = GemHelpers.select_best_platform_match(matching_specs, platform).find(&:matches_current_metadata?) if platform_spec new_specs << LazySpecification.from_spec(platform_spec) @@ -90,9 +92,20 @@ module Bundler platforms end def [](key) key = key.name if key.respond_to?(:name) - lookup[key].reverse end def []=(key, value) @@ -167,7 +180,7 @@ module Bundler end def what_required(spec) - unless req = find {|s| s.dependencies.any? {|d| d.type == :runtime && d.name == spec.name } } return [spec] end what_required(req) << spec @@ -193,8 +206,16 @@ module Bundler sorted.each(&b) end private def sorted rake = @specs.find {|s| s.name == "rake" } begin @@ -213,8 +234,9 @@ module Bundler def lookup @lookup ||= begin - lookup = Hash.new {|h, k| h[k] = [] } @specs.each do |s| lookup[s.name] << s end lookup @@ -228,6 +250,8 @@ module Bundler def specs_for_dependency(dep, platform) specs_for_name = lookup[dep.name] matching_specs = if dep.force_ruby_platform GemHelpers.force_ruby_platform(specs_for_name) else @@ -240,7 +264,11 @@ module Bundler def tsort_each_child(s) s.dependencies.sort_by(&:name).each do |d| next if d.type == :development - lookup[d.name].each {|s2| yield s2 } end end end @@ -1,5 +1,4 @@ require_relative "basic" -require_relative "lcs_diff" class Bundler::Thor module Shell @@ -7,8 +6,6 @@ class Bundler::Thor # Bundler::Thor::Shell::Basic to see all available methods. # class Color < Basic - include LCSDiff - # Embed in a String to clear all previous ANSI sequences. CLEAR = "\e[0m" # The start of an ANSI bold sequence. @@ -1,5 +1,4 @@ require_relative "basic" -require_relative "lcs_diff" class Bundler::Thor module Shell @@ -7,8 +6,6 @@ class Bundler::Thor # Bundler::Thor::Shell::Basic to see all available methods. # class HTML < Basic - include LCSDiff - # The start of an HTML bold sequence. BOLD = "font-weight: bold" @@ -1,49 +0,0 @@ -module LCSDiff -protected - - # Overwrite show_diff to show diff with colors if Diff::LCS is - # available. - def show_diff(destination, content) #:nodoc: - if diff_lcs_loaded? && ENV["THOR_DIFF"].nil? && ENV["RAILS_DIFF"].nil? - actual = File.binread(destination).to_s.split("\n") - content = content.to_s.split("\n") - - Diff::LCS.sdiff(actual, content).each do |diff| - output_diff_line(diff) - end - else - super - end - end - -private - - def output_diff_line(diff) #:nodoc: - case diff.action - when "-" - say "- #{diff.old_element.chomp}", :red, true - when "+" - say "+ #{diff.new_element.chomp}", :green, true - when "!" - say "- #{diff.old_element.chomp}", :red, true - say "+ #{diff.new_element.chomp}", :green, true - else - say " #{diff.old_element.chomp}", nil, true - end - end - - # Check if Diff::LCS is loaded. If it is, use it to create pretty output - # for diff. - def diff_lcs_loaded? #:nodoc: - return true if defined?(Diff::LCS) - return @diff_lcs_loaded unless @diff_lcs_loaded.nil? - - @diff_lcs_loaded = begin - require "diff/lcs" - true - rescue LoadError - false - end - end - -end @@ -1,7 +1,7 @@ # frozen_string_literal: false module Bundler - VERSION = "2.5.1".freeze def self.bundler_major_version @bundler_major_version ||= VERSION.split(".").first.to_i @@ -9,7 +9,7 @@ require "rbconfig" module Gem - VERSION = "3.5.1" end # Must be first since it unloads the prelude from 1.9.2 @@ -943,6 +943,13 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} end ## # Prints the amount of time the supplied block takes to run using the debug # UI output. @@ -84,7 +84,13 @@ class Gem::BasicSpecification return false end - have_file? file, Gem.suffixes end def default_gem? @@ -268,7 +268,7 @@ class Gem::Package tar.add_file_simple file, stat.mode, stat.size do |dst_io| File.open file, "rb" do |src_io| - dst_io.write src_io.read 16_384 until src_io.eof? end end end @@ -453,7 +453,7 @@ EOM end if entry.file? - File.open(destination, "wb") {|out| out.write entry.read } FileUtils.chmod file_mode(entry.header.mode), destination end @@ -714,6 +714,16 @@ EOM rescue Zlib::GzipFile::Error => e raise Gem::Package::FormatError.new(e.message, entry.full_name) end end require_relative "package/digest_io" @@ -30,7 +30,7 @@ class Gem::Request @uri = uri @request_class = request_class @last_modified = last_modified - @requests = Hash.new 0 @user_agent = user_agent @connection_pool = pool @@ -196,7 +196,7 @@ class Gem::Request bad_response = false begin - @requests[connection.object_id] += 1 verbose "#{request.method} #{Gem::Uri.redact(@uri)}" @@ -247,7 +247,7 @@ class Gem::Request rescue EOFError, Gem::Timeout::Error, Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE - requests = @requests[connection.object_id] verbose "connection reset after #{requests} requests, retrying" raise Gem::RemoteFetcher::FetchError.new("too many connection resets", @uri) if retried @@ -267,7 +267,7 @@ class Gem::Request # Resets HTTP connection +connection+. def reset(connection) - @requests.delete connection.object_id connection.finish connection.start |