Sha256: f3019b08dd6c8163ddc10f1383d344d85f7aeb22f78ceb30d6a6a4b3228a4ad2

Contents?: true

Size: 665 Bytes

Versions: 3

Compression:

Stored size: 665 Bytes

Contents

module Backup
	module FileItem
  	class Base
      def semantic_path(path)
        if Dir.exists? path
          path += '/'
        else
          path
        end
      end

      def stat(file)
        files = {}

        stat = File.new(file).stat
        files[file] = {
          :uid => stat.uid,
          :gid => stat.gid,
          :mode => stat.mode
        }
        unless Dir.exists?(file)
          files[file][:checksum] = Digest::MD5.hexdigest File.open(file, 'rb').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

3 entries across 3 versions & 1 rubygems

Version Path
encbs-0.2.1.beta1 lib/backup/file_item/base.rb
encbs-0.2.1.alpha lib/backup/file_item/base.rb
encbs-0.2.0.alpha lib/backup/file_item/base.rb