Class: Gem::Tasks::Sign::Checksum
- Defined in:
- lib/rubygems/tasks/sign/checksum.rb
Overview
The sign:checksum
task.
Constant Summary
Constants included from Printing
Printing::ANSI_BRIGHT, Printing::ANSI_CLEAR, Printing::ANSI_GREEN, Printing::ANSI_RED, Printing::ANSI_YELLOW, Printing::DEBUG_PREFIX, Printing::ERROR_PREFIX, Printing::STATUS_PREFIX
Instance Attribute Summary collapse
-
#md5 ⇒ Object
writeonly
Enables or disables MD5 checksums.
-
#sha1 ⇒ Object
writeonly
Enables or disables SHA1 checksums.
-
#sha2 ⇒ Object
writeonly
Enables or disables SHA2 checksums.
-
#sha512 ⇒ Object
writeonly
Enables or disables SHA512 checksums.
Attributes inherited from Task
Instance Method Summary collapse
-
#define ⇒ Object
Defines the
sign:checksum
tasks. -
#initialize(options = {}) {|_self| ... } ⇒ Checksum
constructor
Initializes the
sign:checksum
task. -
#md5? ⇒ Boolean
Specifies whether MD5 checksums are enabled.
-
#sha1? ⇒ Boolean
Specifies whether SHA1 checksums are enabled.
-
#sha2? ⇒ Boolean
Specifies whether SHA2 checksums are enabled.
-
#sha512? ⇒ Boolean
Specifies whether SHA512 checksums are enabled.
-
#sign(path) ⇒ Object
Prints the checksums of a package.
Methods inherited from Task
#bundle, #gem, #gemspec_tasks, #invoke, #namespaced_tasks, #run, #task?
Methods included from Printing
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Checksum
Initializes the sign:checksum
task.
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rubygems/tasks/sign/checksum.rb', line 43 def initialize(={}) super() @md5 = .fetch(:md5, true) @sha1 = .fetch(:sha1, true) @sha2 = .fetch(:sha2, false) @sha512 = .fetch(:sha512,false) yield self if block_given? define end |
Instance Attribute Details
#md5=(value) ⇒ Object (writeonly)
Enables or disables MD5 checksums.
14 15 16 |
# File 'lib/rubygems/tasks/sign/checksum.rb', line 14 def md5=(value) @md5 = value end |
#sha1=(value) ⇒ Object (writeonly)
Enables or disables SHA1 checksums.
17 18 19 |
# File 'lib/rubygems/tasks/sign/checksum.rb', line 17 def sha1=(value) @sha1 = value end |
#sha2=(value) ⇒ Object (writeonly)
Enables or disables SHA2 checksums.
20 21 22 |
# File 'lib/rubygems/tasks/sign/checksum.rb', line 20 def sha2=(value) @sha2 = value end |
#sha512=(value) ⇒ Object (writeonly)
Enables or disables SHA512 checksums.
23 24 25 |
# File 'lib/rubygems/tasks/sign/checksum.rb', line 23 def sha512=(value) @sha512 = value end |
Instance Method Details
#define ⇒ Object
Defines the sign:checksum
tasks.
86 87 88 89 90 |
# File 'lib/rubygems/tasks/sign/checksum.rb', line 86 def define super(:checksum) task :checksum => 'sign:checksum' end |
#md5? ⇒ Boolean
Specifies whether MD5 checksums are enabled.
60 |
# File 'lib/rubygems/tasks/sign/checksum.rb', line 60 def md5?; @md5; end |
#sha1? ⇒ Boolean
Specifies whether SHA1 checksums are enabled.
67 |
# File 'lib/rubygems/tasks/sign/checksum.rb', line 67 def sha1?; @sha1; end |
#sha2? ⇒ Boolean
Specifies whether SHA2 checksums are enabled.
74 |
# File 'lib/rubygems/tasks/sign/checksum.rb', line 74 def sha2?; @sha2; end |
#sha512? ⇒ Boolean
Specifies whether SHA512 checksums are enabled.
81 |
# File 'lib/rubygems/tasks/sign/checksum.rb', line 81 def sha512?; @sha512; end |
#sign(path) ⇒ Object
Prints the checksums of a package.
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/rubygems/tasks/sign/checksum.rb', line 100 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 |