class Gem::Tasks::Sign::Checksum


The ‘sign:checksum` task.

def define


Defines the `sign:checksum` tasks.
def define
  sign_task :checksum
  task      :checksum => 'sign:checksum'
end

def initialize(options={})

Options Hash: (**options)
  • :sha512 (Boolean) --
  • :sha2 (Boolean) --
  • :sha1 (Boolean) --
  • :md5 (Boolean) --

Parameters:
  • options (Hash) --
def initialize(options={})
  super()
  @md5    = options.fetch(:md5,   true)
  @sha1   = options.fetch(:sha1,  true)
  @sha2   = options.fetch(:sha2,  false)
  @sha512 = options.fetch(:sha512,false)
  yield self if block_given?
  define
end

def md5?; @md5; end

Returns:
  • (Boolean) -
def md5?; @md5; end

def sha1?; @sha1; end

Returns:
  • (Boolean) -
def sha1?; @sha1; end

def sha2?; @sha2; end

Returns:
  • (Boolean) -
def sha2?; @sha2; end

def sha512?; @sha512; end

Returns:
  • (Boolean) -
def sha512?; @sha512; end

def sign(path)

Parameters:
  • path (String) --
def sign(path)
  status "Checksums for #{File.basename(path)}:"
  puts
  puts "  md5:    #{Digest::MD5.file(path)}"    if @md5
  puts "  sha1:   #{Digest::SHA1.file(path)}"   if @sha1
  puts "  sha2:   #{Digest::SHA2.file(path)}"   if @sha2
  puts "  sha512: #{Digest::SHA512.file(path)}" if @sha512
  puts
end