class Vara::MD5Creator

Public Class Methods

md5(path) click to toggle source
# File lib/vara/md5_creator.rb, line 7
def self.md5(path)
  expanded_path = File.expand_path(path)
  md5_file = "#{expanded_path}.md5"

  md5_string = Digest::MD5.file(expanded_path).hexdigest

  log.warn("File #{md5_file} already exists, overwriting!") if File.exist?(md5_file)
  File.open(md5_file, 'w') do |file|
    file.write(md5_string)
    log.info("Created md5 file: #{md5_file} with contents #{md5_string}")
  end

  md5_file
end