Class: FRM::Package

Inherits:
Base
  • Object
show all
Defined in:
lib/frm/deb.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#compute_md5, #compute_sha1, #compute_sha2, #generate_gzip_pipe, #gpg_clearsign, #gpg_detached, #gunzip_pipe, #merge_package_file, #parse_package_stub

Constructor Details

#initialize(path, release = 'natty') ⇒ Package

Returns a new instance of Package.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/frm/deb.rb', line 9

def initialize(path,release='natty')
  raise "you need to specify a path!!!" if path.nil?
  @path = path
  raise "Can not find file '#{path}'" unless File.exists?(path)
  @release = release
  begin
    @content = File.read(path)
  rescue Object => o
    STDERR.puts "Could not open file '#{path}'. Exiting..."
    STDERR.puts o.inspect
    STDERR.puts o.backtrace
    raise "Could not open file '#{path}'. Exiting..."
  end
  @size = File.size(@path)
  @md5 = compute_md5(@content)
  @sha1 = compute_sha1(@content)
  @sha2 = compute_sha2(@content)
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



8
9
10
# File 'lib/frm/deb.rb', line 8

def content
  @content
end

#md5Object (readonly)

Returns the value of attribute md5.



8
9
10
# File 'lib/frm/deb.rb', line 8

def md5
  @md5
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/frm/deb.rb', line 8

def path
  @path
end

#releaseObject (readonly)

Returns the value of attribute release.



8
9
10
# File 'lib/frm/deb.rb', line 8

def release
  @release
end

#repo_filenameObject

Returns the value of attribute repo_filename.



7
8
9
# File 'lib/frm/deb.rb', line 7

def repo_filename
  @repo_filename
end

#sha1Object (readonly)

Returns the value of attribute sha1.



8
9
10
# File 'lib/frm/deb.rb', line 8

def sha1
  @sha1
end

#sha2Object (readonly)

Returns the value of attribute sha2.



8
9
10
# File 'lib/frm/deb.rb', line 8

def sha2
  @sha2
end

#sizeObject (readonly)

Returns the value of attribute size.



8
9
10
# File 'lib/frm/deb.rb', line 8

def size
  @size
end