mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge rubygems master targeted RubyGems 3.1.0.
1172320540
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
59a6215af6
commit
3dc6efbe9c
18 changed files with 105 additions and 78 deletions
|
@ -19,29 +19,6 @@ class Gem::Validator
|
|||
require 'find'
|
||||
end
|
||||
|
||||
##
|
||||
# Given a gem file's contents, validates against its own MD5 checksum
|
||||
# gem_data:: [String] Contents of the gem file
|
||||
|
||||
def verify_gem(gem_data)
|
||||
# TODO remove me? The code here only validate an MD5SUM that was
|
||||
# in some old formatted gems, but hasn't been for a long time.
|
||||
end
|
||||
|
||||
##
|
||||
# Given the path to a gem file, validates against its own MD5 checksum
|
||||
#
|
||||
# gem_path:: [String] Path to gem file
|
||||
|
||||
def verify_gem_file(gem_path)
|
||||
File.open gem_path, Gem.binary_mode do |file|
|
||||
gem_data = file.read
|
||||
verify_gem gem_data
|
||||
end
|
||||
rescue Errno::ENOENT, Errno::EINVAL
|
||||
raise Gem::VerificationError, "missing gem file #{gem_path}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_files_for_gem(gem_directory)
|
||||
|
@ -105,7 +82,9 @@ class Gem::Validator
|
|||
end
|
||||
|
||||
begin
|
||||
verify_gem_file(gem_path)
|
||||
unless File.readable?(gem_path)
|
||||
raise Gem::VerificationError, "missing gem file #{gem_path}"
|
||||
end
|
||||
|
||||
good, gone, unreadable = nil, nil, nil, nil
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue