shell out to shasum instead of using Digest::SHA1
This commit is contained in:
parent
a6f58a8a40
commit
c85f20d248
1 changed files with 3 additions and 4 deletions
7
scrub
7
scrub
|
|
@ -1,6 +1,5 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
require 'digest/sha1'
|
|
||||||
require 'json'
|
require 'json'
|
||||||
|
|
||||||
class Scrubber
|
class Scrubber
|
||||||
|
|
@ -50,7 +49,7 @@ class Scrubber
|
||||||
basename = File.basename(file)
|
basename = File.basename(file)
|
||||||
next if basename == 'scrub.json'
|
next if basename == 'scrub.json'
|
||||||
relative_filename = file.sub(@root_dir + '/', '')
|
relative_filename = file.sub(@root_dir + '/', '')
|
||||||
hash = sha1(open(file, 'rb') { |f| f.read })
|
hash = sha1(file)
|
||||||
if expected_hash = hashes[basename]
|
if expected_hash = hashes[basename]
|
||||||
unless hash == expected_hash
|
unless hash == expected_hash
|
||||||
@failures << {
|
@failures << {
|
||||||
|
|
@ -79,8 +78,8 @@ class Scrubber
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def sha1(s)
|
def sha1(filename)
|
||||||
Digest::SHA1.hexdigest(s)
|
`shasum "#{filename}"`.split.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def hash_filename(dir)
|
def hash_filename(dir)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue