class Suppository::MasterDeb
Attributes
dirname[R]
md5sum[R]
sha1[R]
sha256[R]
Public Class Methods
new(path)
click to toggle source
# File lib/suppository/master_deb.rb, line 10 def initialize(path) @path = path assert_in_suppository checksums = checksums_from_name @md5sum = checksums['md5'] @sha1 = checksums['sha1'] @sha256 = checksums['sha256'] @dirname = File.dirname(path) @attr = Suppository::DpkgDeb.new(path).attibutes end
Public Instance Methods
filename()
click to toggle source
# File lib/suppository/master_deb.rb, line 24 def filename "#{@attr['Package']}_#{@attr['Version']}_#{@attr['Architecture']}.deb" end
full_attr()
click to toggle source
# File lib/suppository/master_deb.rb, line 28 def full_attr full_attrs = @attr full_attrs['Size'] = size full_attrs['MD5Sum'] = @md5sum full_attrs['SHA1'] = @sha1 full_attrs['SHA256'] = @sha256 full_attrs end
size()
click to toggle source
# File lib/suppository/master_deb.rb, line 37 def size File.size(@path) end
Private Instance Methods
assert_in_suppository()
click to toggle source
# File lib/suppository/master_deb.rb, line 43 def assert_in_suppository message = 'Master deb must be in the .suppository folder' raise InvalidMasterDeb, message unless suppository_file? end
checksums_from_name()
click to toggle source
# File lib/suppository/master_deb.rb, line 52 def checksums_from_name file_name = File.basename(@path) matches = filename_regex.match(file_name) message = 'Master deb must have the following name {md5}_{sha1}_{sha256}.deb' raise InvalidMasterDeb, message unless matches matches end
filename_regex()
click to toggle source
# File lib/suppository/master_deb.rb, line 60 def filename_regex /^(?<md5>[a-f0-9]{32})_(?<sha1>[a-f0-9]{40})_(?<sha256>[a-f0-9]{64})\.deb$/ end
suppository_file?()
click to toggle source
# File lib/suppository/master_deb.rb, line 48 def suppository_file? File.dirname(@path).end_with?('.suppository') end