Method: Cnvrg::Datafiles#check_file_sha1
- Defined in:
- lib/cnvrg/datafiles.rb
#check_file_sha1(filename, org_sha1, tag: 'conflict') ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/cnvrg/datafiles.rb', line 23 def check_file_sha1(filename, org_sha1, tag: 'conflict') file_loc = "#{Dir.pwd}/#{filename}" sha1 = OpenSSL::Digest::SHA1.file(file_loc).hexdigest return 0 if sha1 == org_sha1 FileUtils.cp(file_loc, "#{file_loc}.#{tag}") return 1 end |