21 lines
474 B
Ruby
Executable File
21 lines
474 B
Ruby
Executable File
#!/bin/env ruby
|
|
# frozen_string_literal: true
|
|
|
|
require "json"
|
|
require "digest/sha2"
|
|
|
|
hashes = JSON.load_file("hashes.json")
|
|
|
|
violations = []
|
|
|
|
hashes.each do |filename, expected_hash|
|
|
calculated_hash = Digest::SHA384.file(filename).hexdigest
|
|
next if calculated_hash == expected_hash
|
|
|
|
violations << {name: filename, expected: expected_hash, calculated: calculated_hash}
|
|
end
|
|
|
|
puts violations
|
|
|
|
fail "Error during rhizome validation: " + violations.to_s if violations.any?
|