зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Fix checksum
Calculate the checksum of the content, not the given pathname at the build time itself. https://github.com/rubygems/rubygems/commit/b60ee97ee9
This commit is contained in:
Родитель
67612dadbc
Коммит
c2e8e1f6a4
|
@ -107,7 +107,7 @@ module Bundler
|
|||
SharedHelpers.filesystem_access(File.join(base, "checksums")) {|p| FileUtils.mkdir_p(p) }
|
||||
file_name = "#{File.basename(built_gem_path)}.sha512"
|
||||
require "digest/sha2"
|
||||
checksum = ::Digest::SHA512.new.hexdigest(built_gem_path.to_s)
|
||||
checksum = ::Digest::SHA512.file(built_gem_path).hexdigest
|
||||
target = File.join(base, "checksums", file_name)
|
||||
File.write(target, checksum)
|
||||
Bundler.ui.confirm "#{name} #{version} checksum written to checksums/#{file_name}."
|
||||
|
|
|
@ -169,6 +169,12 @@ RSpec.describe Bundler::GemHelper do
|
|||
end
|
||||
|
||||
describe "#build_checksum" do
|
||||
it "calculates SHA512 of the content" do
|
||||
subject.build_checksum(Pathname(IO::NULL))
|
||||
sha_path = app_path.join("checksums", "#{File.basename(IO::NULL)}.sha512")
|
||||
expect(File.read(sha_path)).to eql(Digest::SHA512.hexdigest(""))
|
||||
end
|
||||
|
||||
context "when build was successful" do
|
||||
it "creates .sha512 file" do
|
||||
mock_build_message app_name, app_version
|
||||
|
|
Загрузка…
Ссылка в новой задаче