Class: FRM::Package
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#md5 ⇒ Object
readonly
Returns the value of attribute md5.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#release ⇒ Object
readonly
Returns the value of attribute release.
-
#repo_filename ⇒ Object
Returns the value of attribute repo_filename.
-
#sha1 ⇒ Object
readonly
Returns the value of attribute sha1.
-
#sha2 ⇒ Object
readonly
Returns the value of attribute sha2.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
-
#initialize(path, release = 'natty') ⇒ Package
constructor
A new instance of Package.
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.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/frm/package.rb', line 5 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
#content ⇒ Object (readonly)
Returns the value of attribute content.
4 5 6 |
# File 'lib/frm/package.rb', line 4 def content @content end |
#md5 ⇒ Object (readonly)
Returns the value of attribute md5.
4 5 6 |
# File 'lib/frm/package.rb', line 4 def md5 @md5 end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/frm/package.rb', line 4 def path @path end |
#release ⇒ Object (readonly)
Returns the value of attribute release.
4 5 6 |
# File 'lib/frm/package.rb', line 4 def release @release end |
#repo_filename ⇒ Object
Returns the value of attribute repo_filename.
3 4 5 |
# File 'lib/frm/package.rb', line 3 def repo_filename @repo_filename end |
#sha1 ⇒ Object (readonly)
Returns the value of attribute sha1.
4 5 6 |
# File 'lib/frm/package.rb', line 4 def sha1 @sha1 end |
#sha2 ⇒ Object (readonly)
Returns the value of attribute sha2.
4 5 6 |
# File 'lib/frm/package.rb', line 4 def sha2 @sha2 end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
4 5 6 |
# File 'lib/frm/package.rb', line 4 def size @size end |