from 72fd3dd209
This commit is contained in:
Hiroshi SHIBATA 2022-12-26 14:00:11 +09:00
Родитель 10c9ce9d4c
Коммит b7ad60a794
32 изменённых файлов: 47 добавлений и 49 удалений

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

@ -537,7 +537,7 @@ EOF
@gemspec_cache[key] ||= load_gemspec_uncached(file, validate)
# Protect against caching side-effected gemspecs by returning a
# new instance each time.
@gemspec_cache[key].dup if @gemspec_cache[key]
@gemspec_cache[key]&.dup
end
def load_gemspec_uncached(file, validate = false)

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

@ -11,7 +11,7 @@ module Bundler
def run
Bundler.definition.validate_runtime!
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_if_given :shebang, options["shebang"]
installer = Installer.new(Bundler.root, Bundler.definition)

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

@ -33,7 +33,7 @@ module Bundler
def default_gem_spec(gem_name)
return unless Gem::Specification.respond_to?(:find_all_by_name)
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
def spec_not_found(gem_name)

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

@ -154,7 +154,7 @@ module Bundler
end
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_if_given :shebang, options["shebang"]

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

@ -194,7 +194,7 @@ module Bundler
end
current_version = "#{current_spec.version}#{current_spec.git_version}"
if dependency && dependency.specific?
if dependency&.specific?
dependency_version = %(, requested #{dependency.requirement})
end

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

@ -8,12 +8,12 @@ module Bundler
end
def run
platforms, ruby_version = Bundler.ui.silence do
locked_ruby_version = Bundler.locked_gems && Bundler.locked_gems.ruby_version&.gsub(/p\d+\Z/, "")
gemfile_ruby_version = Bundler.definition.ruby_version && Bundler.definition.ruby_version.single_version_string
[Bundler.definition.platforms.map {|p| "* #{p}" },
locked_ruby_version || gemfile_ruby_version]
ruby_version = if Bundler.locked_gems
Bundler.locked_gems.ruby_version&.gsub(/p\d+\Z/, "")
else
Bundler.definition.ruby_version&.single_version_string
end
output = []
if options[:ruby]
@ -23,6 +23,8 @@ module Bundler
output << "No ruby version specified"
end
else
platforms = Bundler.definition.platforms.map {|p| "* #{p}" }
output << "Your platform is: #{Gem::Platform.local}"
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|
spec = @dependencies.find {|s| s.name == k }
source = spec && spec.source
if source && source.respond_to?(:local_override!)
source = spec&.source
if source&.respond_to?(:local_override!)
source.unlock! if @unlock[:gems].include?(spec.name)
locals << [source, source.local_override!(v)]
end
@ -778,7 +778,7 @@ module Bundler
dep = @dependencies.find {|d| s.satisfies?(d) }
# 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
lockfile_source = s.source

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

@ -41,7 +41,7 @@ module Bundler
end
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
@gemfile = expanded_gemfile_path
@gemfiles << expanded_gemfile_path

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

@ -122,7 +122,7 @@ module Bundler
specs = Bundler.rubygems.find_name(name)
out << [" #{name}", "(#{specs.map(&:version).join(",")})"] unless specs.empty?
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.sub!(/^#!\s*/, "")
unless shebang.start_with?(Gem.ruby, "/usr/bin/env ruby")

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

@ -40,7 +40,7 @@ module Bundler
deps = begin
parallel_compact_index_client.dependencies(remaining_gems)
rescue TooManyRequestsError
@bundle_worker.stop if @bundle_worker
@bundle_worker&.stop
@bundle_worker = nil # reset it. Not sure if necessary
serial_compact_index_client.dependencies(remaining_gems)
end
@ -49,7 +49,7 @@ module Bundler
complete_gems.concat(deps.map(&:first)).uniq!
remaining_gems = next_gems - complete_gems
end
@bundle_worker.stop if @bundle_worker
@bundle_worker&.stop
@bundle_worker = nil # reset it. Not sure if necessary
gem_info

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

@ -95,7 +95,7 @@ module Bundler
def serialized_exception_for(e)
<<-EOS.gsub(/^ {8}/, "")
#{e.class}: #{e.message}
#{e.backtrace && e.backtrace.join("\n ").chomp}
#{e.backtrace&.join("\n ")&.chomp}
EOS
end

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

@ -21,7 +21,7 @@ module Bundler
def gemspec(&block)
gemspec = instance.gemspec
block.call(gemspec) if block
block&.call(gemspec)
gemspec
end
end
@ -152,8 +152,7 @@ module Bundler
def gem_push_host
env_rubygems_host = ENV["RUBYGEMS_HOST"]
env_rubygems_host = nil if
env_rubygems_host && env_rubygems_host.empty?
env_rubygems_host = nil if env_rubygems_host&.empty?
allowed_push_host || env_rubygems_host || "rubygems.org"
end
@ -218,7 +217,7 @@ module Bundler
SharedHelpers.chdir(base) do
outbuf = IO.popen(cmd, :err => [:child, :out], &:read)
status = $?
block.call(outbuf) if status.success? && block
block&.call(outbuf) if status.success?
[outbuf, status]
end
end

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

@ -96,7 +96,7 @@ module Bundler
handle_error if failed_specs.any?
@specs
ensure
worker_pool && worker_pool.stop
worker_pool&.stop
end
def check_for_unmet_dependencies

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

@ -146,7 +146,7 @@ module Bundler
# @param [Boolean] is the index file global index
def load_index(index_file, global = false)
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
data = index_f.read

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

@ -28,8 +28,8 @@ module Bundler
end
@gem_version = Gem::Requirement.create(@versions.first).requirements.first.last
@input_engine = engine && engine.to_s
@engine = engine && engine.to_s || "ruby"
@input_engine = engine&.to_s
@engine = engine&.to_s || "ruby"
@engine_versions = (engine_version && Array(engine_version)) || @versions
@engine_gem_version = Gem::Requirement.create(@engine_versions.first).requirements.first.last
@patchlevel = patchlevel || (@gem_version.prerelease? ? "-1" : nil)

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

@ -243,7 +243,7 @@ module Bundler
kernel = (class << ::Kernel; self; end)
[kernel, ::Kernel].each do |kernel_class|
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
end

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

@ -12,7 +12,7 @@ module Bundler
end
def say(message)
@ui && @ui.debug(message)
@ui&.debug(message)
end
end
end

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

@ -1,7 +1,7 @@
# frozen_string_literal: false
module Bundler
VERSION = "2.4.1".freeze
VERSION = "2.5.0.dev".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.1".freeze
VERSION = "3.5.0.dev".freeze
end
# 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+
def self.latest_version_for(name)
spec = latest_spec_for name
spec && spec.version
latest_spec_for(name)&.version
end
##

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

@ -47,7 +47,7 @@ module Gem::BundlerVersionFinder
def self.lockfile_contents
gemfile = ENV["BUNDLE_GEMFILE"]
gemfile = nil if gemfile && gemfile.empty?
gemfile = nil if gemfile&.empty?
unless gemfile
begin

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

@ -70,8 +70,7 @@ module Gem::GemcutterUtilities
@host ||=
begin
env_rubygems_host = ENV["RUBYGEMS_HOST"]
env_rubygems_host = nil if
env_rubygems_host && env_rubygems_host.empty?
env_rubygems_host = nil if env_rubygems_host&.empty?
env_rubygems_host || configured_host
end

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

@ -616,8 +616,7 @@ EOM
verify_checksums @digests, @checksums
@security_policy.verify_signatures @spec, @digests, @signatures if
@security_policy
@security_policy&.verify_signatures @spec, @digests, @signatures
true
rescue Gem::Security::Exception

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

@ -331,7 +331,7 @@ class Gem::RequestSet::Lockfile::Parser
set.find_all(requirement)
end.compact.first
specification && specification.version
specification&.version
end
##

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

@ -1041,7 +1041,7 @@ class Gem::Specification < Gem::BasicSpecification
next if s.activated?
s.contains_requirable_file? path
end
stub && stub.to_spec
stub&.to_spec
end
def self.find_active_stub_by_path(path)
@ -1626,7 +1626,7 @@ class Gem::Specification < Gem::BasicSpecification
builder.build_extensions
end
ensure
ui.close if ui
ui&.close
Gem::Specification.unresolved_deps.replace unresolved_deps
end
end

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

@ -290,7 +290,7 @@ class Gem::StreamUI
@outs.flush
result = @ins.gets
result.chomp! if result
result&.chomp!
result
end
@ -305,7 +305,7 @@ class Gem::StreamUI
password = _gets_noecho
@outs.puts
password.chomp! if password
password&.chomp!
password
end

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

@ -27,4 +27,4 @@ DEPENDENCIES
warbler (~> 2.0)
BUNDLED WITH
2.4.0.dev
2.5.0.dev

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

@ -42,7 +42,7 @@ class BundlerVCRHTTP < Net::HTTP
response.uri = request.uri
response.reading_body(response_io, request.response_body_permitted?) do
response_block.call(response) if response_block
response_block&.call(response)
end
end
end

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

@ -1612,7 +1612,7 @@ class Object
if val_or_callable.respond_to? :call
val_or_callable.call(*args, &blk)
else
blk.call(*block_args) if blk
blk&.call(*block_args)
val_or_callable
end
end

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

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

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

@ -70,4 +70,4 @@ DEPENDENCIES
test-unit
BUNDLED WITH
2.4.1
2.5.0.dev

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

@ -78,4 +78,4 @@ DEPENDENCIES
test-unit
BUNDLED WITH
2.4.1
2.5.0.dev

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

@ -42,4 +42,4 @@ DEPENDENCIES
webrick (= 1.7.0)
BUNDLED WITH
2.4.1
2.5.0.dev