Sha256: 7c9bc4ab731ce8a729604a23e7dacebf7aa51fddd316cae82c255d549860d4f2
Contents?: true
Size: 735 Bytes
Versions: 6
Compression:
Stored size: 735 Bytes
Contents
module Backup module FileItem class Base def semantic_path(path) if Dir.exists? path path += '/' else path end end def stat(file, timestamp = nil) files = {} stat = File.new(file).stat files[file] = { :uid => stat.uid, :gid => stat.gid, :mode => stat.mode } files[file][:timestamp] = timestamp if timestamp unless Dir.exists?(file) files[file][:checksum] = Digest::MD5.hexdigest(File.open(file).read) end files rescue Exception => e STDERR.puts e end def file_hash(file) Digest::MD5.hexdigest file end end end end
Version data entries
6 entries across 6 versions & 2 rubygems