mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 07:26:00 +02:00
parent
10c9ce9d4c
commit
b7ad60a794
Notes:
git
2022-12-26 06:09:40 +00:00
32 changed files with 47 additions and 49 deletions
|
@ -537,7 +537,7 @@ EOF
|
||||||
@gemspec_cache[key] ||= load_gemspec_uncached(file, validate)
|
@gemspec_cache[key] ||= load_gemspec_uncached(file, validate)
|
||||||
# Protect against caching side-effected gemspecs by returning a
|
# Protect against caching side-effected gemspecs by returning a
|
||||||
# new instance each time.
|
# new instance each time.
|
||||||
@gemspec_cache[key].dup if @gemspec_cache[key]
|
@gemspec_cache[key]&.dup
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_gemspec_uncached(file, validate = false)
|
def load_gemspec_uncached(file, validate = false)
|
||||||
|
|
|
@ -11,7 +11,7 @@ module Bundler
|
||||||
def run
|
def run
|
||||||
Bundler.definition.validate_runtime!
|
Bundler.definition.validate_runtime!
|
||||||
path_option = options["path"]
|
path_option = options["path"]
|
||||||
path_option = nil if path_option && path_option.empty?
|
path_option = nil if path_option&.empty?
|
||||||
Bundler.settings.set_command_option :bin, path_option if options["path"]
|
Bundler.settings.set_command_option :bin, path_option if options["path"]
|
||||||
Bundler.settings.set_command_option_if_given :shebang, options["shebang"]
|
Bundler.settings.set_command_option_if_given :shebang, options["shebang"]
|
||||||
installer = Installer.new(Bundler.root, Bundler.definition)
|
installer = Installer.new(Bundler.root, Bundler.definition)
|
||||||
|
|
|
@ -33,7 +33,7 @@ module Bundler
|
||||||
def default_gem_spec(gem_name)
|
def default_gem_spec(gem_name)
|
||||||
return unless Gem::Specification.respond_to?(:find_all_by_name)
|
return unless Gem::Specification.respond_to?(:find_all_by_name)
|
||||||
gem_spec = Gem::Specification.find_all_by_name(gem_name).last
|
gem_spec = Gem::Specification.find_all_by_name(gem_name).last
|
||||||
return gem_spec if gem_spec && gem_spec.respond_to?(:default_gem?) && gem_spec.default_gem?
|
return gem_spec if gem_spec&.default_gem?
|
||||||
end
|
end
|
||||||
|
|
||||||
def spec_not_found(gem_name)
|
def spec_not_found(gem_name)
|
||||||
|
|
|
@ -154,7 +154,7 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
bin_option = options["binstubs"]
|
bin_option = options["binstubs"]
|
||||||
bin_option = nil if bin_option && bin_option.empty?
|
bin_option = nil if bin_option&.empty?
|
||||||
Bundler.settings.set_command_option :bin, bin_option if options["binstubs"]
|
Bundler.settings.set_command_option :bin, bin_option if options["binstubs"]
|
||||||
|
|
||||||
Bundler.settings.set_command_option_if_given :shebang, options["shebang"]
|
Bundler.settings.set_command_option_if_given :shebang, options["shebang"]
|
||||||
|
|
|
@ -194,7 +194,7 @@ module Bundler
|
||||||
end
|
end
|
||||||
current_version = "#{current_spec.version}#{current_spec.git_version}"
|
current_version = "#{current_spec.version}#{current_spec.git_version}"
|
||||||
|
|
||||||
if dependency && dependency.specific?
|
if dependency&.specific?
|
||||||
dependency_version = %(, requested #{dependency.requirement})
|
dependency_version = %(, requested #{dependency.requirement})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,12 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
platforms, ruby_version = Bundler.ui.silence do
|
ruby_version = if Bundler.locked_gems
|
||||||
locked_ruby_version = Bundler.locked_gems && Bundler.locked_gems.ruby_version&.gsub(/p\d+\Z/, "")
|
Bundler.locked_gems.ruby_version&.gsub(/p\d+\Z/, "")
|
||||||
gemfile_ruby_version = Bundler.definition.ruby_version && Bundler.definition.ruby_version.single_version_string
|
else
|
||||||
[Bundler.definition.platforms.map {|p| "* #{p}" },
|
Bundler.definition.ruby_version&.single_version_string
|
||||||
locked_ruby_version || gemfile_ruby_version]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
|
|
||||||
if options[:ruby]
|
if options[:ruby]
|
||||||
|
@ -23,6 +23,8 @@ module Bundler
|
||||||
output << "No ruby version specified"
|
output << "No ruby version specified"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
platforms = Bundler.definition.platforms.map {|p| "* #{p}" }
|
||||||
|
|
||||||
output << "Your platform is: #{Gem::Platform.local}"
|
output << "Your platform is: #{Gem::Platform.local}"
|
||||||
output << "Your app has gems that work on these platforms:\n#{platforms.join("\n")}"
|
output << "Your app has gems that work on these platforms:\n#{platforms.join("\n")}"
|
||||||
|
|
||||||
|
|
|
@ -647,8 +647,8 @@ module Bundler
|
||||||
|
|
||||||
Bundler.settings.local_overrides.map do |k, v|
|
Bundler.settings.local_overrides.map do |k, v|
|
||||||
spec = @dependencies.find {|s| s.name == k }
|
spec = @dependencies.find {|s| s.name == k }
|
||||||
source = spec && spec.source
|
source = spec&.source
|
||||||
if source && source.respond_to?(:local_override!)
|
if source&.respond_to?(:local_override!)
|
||||||
source.unlock! if @unlock[:gems].include?(spec.name)
|
source.unlock! if @unlock[:gems].include?(spec.name)
|
||||||
locals << [source, source.local_override!(v)]
|
locals << [source, source.local_override!(v)]
|
||||||
end
|
end
|
||||||
|
@ -778,7 +778,7 @@ module Bundler
|
||||||
dep = @dependencies.find {|d| s.satisfies?(d) }
|
dep = @dependencies.find {|d| s.satisfies?(d) }
|
||||||
|
|
||||||
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
||||||
s.source = if dep && dep.source
|
s.source = if dep&.source
|
||||||
gemfile_source = dep.source
|
gemfile_source = dep.source
|
||||||
lockfile_source = s.source
|
lockfile_source = s.source
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
def eval_gemfile(gemfile, contents = nil)
|
def eval_gemfile(gemfile, contents = nil)
|
||||||
expanded_gemfile_path = Pathname.new(gemfile).expand_path(@gemfile && @gemfile.parent)
|
expanded_gemfile_path = Pathname.new(gemfile).expand_path(@gemfile&.parent)
|
||||||
original_gemfile = @gemfile
|
original_gemfile = @gemfile
|
||||||
@gemfile = expanded_gemfile_path
|
@gemfile = expanded_gemfile_path
|
||||||
@gemfiles << expanded_gemfile_path
|
@gemfiles << expanded_gemfile_path
|
||||||
|
|
|
@ -122,7 +122,7 @@ module Bundler
|
||||||
specs = Bundler.rubygems.find_name(name)
|
specs = Bundler.rubygems.find_name(name)
|
||||||
out << [" #{name}", "(#{specs.map(&:version).join(",")})"] unless specs.empty?
|
out << [" #{name}", "(#{specs.map(&:version).join(",")})"] unless specs.empty?
|
||||||
end
|
end
|
||||||
if (exe = caller.last.split(":").first) && exe =~ %r{(exe|bin)/bundler?\z}
|
if (exe = caller.last.split(":").first)&.match? %r{(exe|bin)/bundler?\z}
|
||||||
shebang = File.read(exe).lines.first
|
shebang = File.read(exe).lines.first
|
||||||
shebang.sub!(/^#!\s*/, "")
|
shebang.sub!(/^#!\s*/, "")
|
||||||
unless shebang.start_with?(Gem.ruby, "/usr/bin/env ruby")
|
unless shebang.start_with?(Gem.ruby, "/usr/bin/env ruby")
|
||||||
|
|
|
@ -40,7 +40,7 @@ module Bundler
|
||||||
deps = begin
|
deps = begin
|
||||||
parallel_compact_index_client.dependencies(remaining_gems)
|
parallel_compact_index_client.dependencies(remaining_gems)
|
||||||
rescue TooManyRequestsError
|
rescue TooManyRequestsError
|
||||||
@bundle_worker.stop if @bundle_worker
|
@bundle_worker&.stop
|
||||||
@bundle_worker = nil # reset it. Not sure if necessary
|
@bundle_worker = nil # reset it. Not sure if necessary
|
||||||
serial_compact_index_client.dependencies(remaining_gems)
|
serial_compact_index_client.dependencies(remaining_gems)
|
||||||
end
|
end
|
||||||
|
@ -49,7 +49,7 @@ module Bundler
|
||||||
complete_gems.concat(deps.map(&:first)).uniq!
|
complete_gems.concat(deps.map(&:first)).uniq!
|
||||||
remaining_gems = next_gems - complete_gems
|
remaining_gems = next_gems - complete_gems
|
||||||
end
|
end
|
||||||
@bundle_worker.stop if @bundle_worker
|
@bundle_worker&.stop
|
||||||
@bundle_worker = nil # reset it. Not sure if necessary
|
@bundle_worker = nil # reset it. Not sure if necessary
|
||||||
|
|
||||||
gem_info
|
gem_info
|
||||||
|
|
|
@ -95,7 +95,7 @@ module Bundler
|
||||||
def serialized_exception_for(e)
|
def serialized_exception_for(e)
|
||||||
<<-EOS.gsub(/^ {8}/, "")
|
<<-EOS.gsub(/^ {8}/, "")
|
||||||
#{e.class}: #{e.message}
|
#{e.class}: #{e.message}
|
||||||
#{e.backtrace && e.backtrace.join("\n ").chomp}
|
#{e.backtrace&.join("\n ")&.chomp}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ module Bundler
|
||||||
|
|
||||||
def gemspec(&block)
|
def gemspec(&block)
|
||||||
gemspec = instance.gemspec
|
gemspec = instance.gemspec
|
||||||
block.call(gemspec) if block
|
block&.call(gemspec)
|
||||||
gemspec
|
gemspec
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -152,8 +152,7 @@ module Bundler
|
||||||
|
|
||||||
def gem_push_host
|
def gem_push_host
|
||||||
env_rubygems_host = ENV["RUBYGEMS_HOST"]
|
env_rubygems_host = ENV["RUBYGEMS_HOST"]
|
||||||
env_rubygems_host = nil if
|
env_rubygems_host = nil if env_rubygems_host&.empty?
|
||||||
env_rubygems_host && env_rubygems_host.empty?
|
|
||||||
|
|
||||||
allowed_push_host || env_rubygems_host || "rubygems.org"
|
allowed_push_host || env_rubygems_host || "rubygems.org"
|
||||||
end
|
end
|
||||||
|
@ -218,7 +217,7 @@ module Bundler
|
||||||
SharedHelpers.chdir(base) do
|
SharedHelpers.chdir(base) do
|
||||||
outbuf = IO.popen(cmd, :err => [:child, :out], &:read)
|
outbuf = IO.popen(cmd, :err => [:child, :out], &:read)
|
||||||
status = $?
|
status = $?
|
||||||
block.call(outbuf) if status.success? && block
|
block&.call(outbuf) if status.success?
|
||||||
[outbuf, status]
|
[outbuf, status]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -96,7 +96,7 @@ module Bundler
|
||||||
handle_error if failed_specs.any?
|
handle_error if failed_specs.any?
|
||||||
@specs
|
@specs
|
||||||
ensure
|
ensure
|
||||||
worker_pool && worker_pool.stop
|
worker_pool&.stop
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_for_unmet_dependencies
|
def check_for_unmet_dependencies
|
||||||
|
|
|
@ -146,7 +146,7 @@ module Bundler
|
||||||
# @param [Boolean] is the index file global index
|
# @param [Boolean] is the index file global index
|
||||||
def load_index(index_file, global = false)
|
def load_index(index_file, global = false)
|
||||||
SharedHelpers.filesystem_access(index_file, :read) do |index_f|
|
SharedHelpers.filesystem_access(index_file, :read) do |index_f|
|
||||||
valid_file = index_f && index_f.exist? && !index_f.size.zero?
|
valid_file = index_f&.exist? && !index_f.size.zero?
|
||||||
break unless valid_file
|
break unless valid_file
|
||||||
|
|
||||||
data = index_f.read
|
data = index_f.read
|
||||||
|
|
|
@ -28,8 +28,8 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
@gem_version = Gem::Requirement.create(@versions.first).requirements.first.last
|
@gem_version = Gem::Requirement.create(@versions.first).requirements.first.last
|
||||||
@input_engine = engine && engine.to_s
|
@input_engine = engine&.to_s
|
||||||
@engine = engine && engine.to_s || "ruby"
|
@engine = engine&.to_s || "ruby"
|
||||||
@engine_versions = (engine_version && Array(engine_version)) || @versions
|
@engine_versions = (engine_version && Array(engine_version)) || @versions
|
||||||
@engine_gem_version = Gem::Requirement.create(@engine_versions.first).requirements.first.last
|
@engine_gem_version = Gem::Requirement.create(@engine_versions.first).requirements.first.last
|
||||||
@patchlevel = patchlevel || (@gem_version.prerelease? ? "-1" : nil)
|
@patchlevel = patchlevel || (@gem_version.prerelease? ? "-1" : nil)
|
||||||
|
|
|
@ -243,7 +243,7 @@ module Bundler
|
||||||
kernel = (class << ::Kernel; self; end)
|
kernel = (class << ::Kernel; self; end)
|
||||||
[kernel, ::Kernel].each do |kernel_class|
|
[kernel, ::Kernel].each do |kernel_class|
|
||||||
redefine_method(kernel_class, :gem) do |dep, *reqs|
|
redefine_method(kernel_class, :gem) do |dep, *reqs|
|
||||||
if executables && executables.include?(File.basename(caller.first.split(":").first))
|
if executables&.include?(File.basename(caller.first.split(":").first))
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
def say(message)
|
def say(message)
|
||||||
@ui && @ui.debug(message)
|
@ui&.debug(message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: false
|
# frozen_string_literal: false
|
||||||
|
|
||||||
module Bundler
|
module Bundler
|
||||||
VERSION = "2.4.1".freeze
|
VERSION = "2.5.0.dev".freeze
|
||||||
|
|
||||||
def self.bundler_major_version
|
def self.bundler_major_version
|
||||||
@bundler_major_version ||= VERSION.split(".").first.to_i
|
@bundler_major_version ||= VERSION.split(".").first.to_i
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
require "rbconfig"
|
require "rbconfig"
|
||||||
|
|
||||||
module Gem
|
module Gem
|
||||||
VERSION = "3.4.1".freeze
|
VERSION = "3.5.0.dev".freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
# Must be first since it unloads the prelude from 1.9.2
|
# Must be first since it unloads the prelude from 1.9.2
|
||||||
|
@ -857,8 +857,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
||||||
# Returns the version of the latest release-version of gem +name+
|
# Returns the version of the latest release-version of gem +name+
|
||||||
|
|
||||||
def self.latest_version_for(name)
|
def self.latest_version_for(name)
|
||||||
spec = latest_spec_for name
|
latest_spec_for(name)&.version
|
||||||
spec && spec.version
|
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -47,7 +47,7 @@ module Gem::BundlerVersionFinder
|
||||||
|
|
||||||
def self.lockfile_contents
|
def self.lockfile_contents
|
||||||
gemfile = ENV["BUNDLE_GEMFILE"]
|
gemfile = ENV["BUNDLE_GEMFILE"]
|
||||||
gemfile = nil if gemfile && gemfile.empty?
|
gemfile = nil if gemfile&.empty?
|
||||||
|
|
||||||
unless gemfile
|
unless gemfile
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -70,8 +70,7 @@ module Gem::GemcutterUtilities
|
||||||
@host ||=
|
@host ||=
|
||||||
begin
|
begin
|
||||||
env_rubygems_host = ENV["RUBYGEMS_HOST"]
|
env_rubygems_host = ENV["RUBYGEMS_HOST"]
|
||||||
env_rubygems_host = nil if
|
env_rubygems_host = nil if env_rubygems_host&.empty?
|
||||||
env_rubygems_host && env_rubygems_host.empty?
|
|
||||||
|
|
||||||
env_rubygems_host || configured_host
|
env_rubygems_host || configured_host
|
||||||
end
|
end
|
||||||
|
|
|
@ -616,8 +616,7 @@ EOM
|
||||||
|
|
||||||
verify_checksums @digests, @checksums
|
verify_checksums @digests, @checksums
|
||||||
|
|
||||||
@security_policy.verify_signatures @spec, @digests, @signatures if
|
@security_policy&.verify_signatures @spec, @digests, @signatures
|
||||||
@security_policy
|
|
||||||
|
|
||||||
true
|
true
|
||||||
rescue Gem::Security::Exception
|
rescue Gem::Security::Exception
|
||||||
|
|
|
@ -331,7 +331,7 @@ class Gem::RequestSet::Lockfile::Parser
|
||||||
set.find_all(requirement)
|
set.find_all(requirement)
|
||||||
end.compact.first
|
end.compact.first
|
||||||
|
|
||||||
specification && specification.version
|
specification&.version
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -1041,7 +1041,7 @@ class Gem::Specification < Gem::BasicSpecification
|
||||||
next if s.activated?
|
next if s.activated?
|
||||||
s.contains_requirable_file? path
|
s.contains_requirable_file? path
|
||||||
end
|
end
|
||||||
stub && stub.to_spec
|
stub&.to_spec
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.find_active_stub_by_path(path)
|
def self.find_active_stub_by_path(path)
|
||||||
|
@ -1626,7 +1626,7 @@ class Gem::Specification < Gem::BasicSpecification
|
||||||
builder.build_extensions
|
builder.build_extensions
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
ui.close if ui
|
ui&.close
|
||||||
Gem::Specification.unresolved_deps.replace unresolved_deps
|
Gem::Specification.unresolved_deps.replace unresolved_deps
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -290,7 +290,7 @@ class Gem::StreamUI
|
||||||
@outs.flush
|
@outs.flush
|
||||||
|
|
||||||
result = @ins.gets
|
result = @ins.gets
|
||||||
result.chomp! if result
|
result&.chomp!
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ class Gem::StreamUI
|
||||||
|
|
||||||
password = _gets_noecho
|
password = _gets_noecho
|
||||||
@outs.puts
|
@outs.puts
|
||||||
password.chomp! if password
|
password&.chomp!
|
||||||
password
|
password
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -27,4 +27,4 @@ DEPENDENCIES
|
||||||
warbler (~> 2.0)
|
warbler (~> 2.0)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.0.dev
|
2.5.0.dev
|
||||||
|
|
|
@ -42,7 +42,7 @@ class BundlerVCRHTTP < Net::HTTP
|
||||||
response.uri = request.uri
|
response.uri = request.uri
|
||||||
|
|
||||||
response.reading_body(response_io, request.response_body_permitted?) do
|
response.reading_body(response_io, request.response_body_permitted?) do
|
||||||
response_block.call(response) if response_block
|
response_block&.call(response)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1612,7 +1612,7 @@ class Object
|
||||||
if val_or_callable.respond_to? :call
|
if val_or_callable.respond_to? :call
|
||||||
val_or_callable.call(*args, &blk)
|
val_or_callable.call(*args, &blk)
|
||||||
else
|
else
|
||||||
blk.call(*block_args) if blk
|
blk&.call(*block_args)
|
||||||
val_or_callable
|
val_or_callable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -54,4 +54,4 @@ DEPENDENCIES
|
||||||
webrick (~> 1.6)
|
webrick (~> 1.6)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.1
|
2.5.0.dev
|
||||||
|
|
|
@ -70,4 +70,4 @@ DEPENDENCIES
|
||||||
test-unit
|
test-unit
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.1
|
2.5.0.dev
|
||||||
|
|
|
@ -78,4 +78,4 @@ DEPENDENCIES
|
||||||
test-unit
|
test-unit
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.1
|
2.5.0.dev
|
||||||
|
|
|
@ -42,4 +42,4 @@ DEPENDENCIES
|
||||||
webrick (= 1.7.0)
|
webrick (= 1.7.0)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.1
|
2.5.0.dev
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue