debeasy 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDc5OWViMzc1NWRmMzA5ZmFjODYzYzNlYjllNDE5OTFlMjI4MDA0ZQ==
4
+ NGFlNDM2YjlmYzY5ZjkxZGJkOWE1ODMyZWMyMjA0ZmU1ZTA2NDRlMw==
5
5
  data.tar.gz: !binary |-
6
- YWNiNjdiYzk3NTQ5ZTdjZTFiMTY5NTJhYTZhZmZlNTgzNjE0NzBmMA==
6
+ NDI2ZGU0Mjc5ZTE5ODBhNjBjN2ExOGYzZjZlZGE4MTdkMDJiNjgwOQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YmE2NzIzYWNjNzZlMGQ4ZTYxYTBmMzU0OWMwYzAxM2E3ZDlmZTkzZjgwNGUy
10
- YzkwZGMwY2ZhOTUzYWI5N2RmMDhkM2NlMTE3MTA5YzJkOWFjMDE1NThjM2E1
11
- NjAxMWUyMmEyNDMzOWIxOWZjZWQ4M2YyYTRjZjQ5ZTk1NTRjNTc=
9
+ NWQ3OTViOWZmYjkzNGQzOTkzYTg1NjdhN2RkMmE2MTVkYWFjOWJkM2ZkYjg0
10
+ ZTgyZDFiYmE4YzAyYTM3YjYyYjZmYjVkYWYwY2ZkY2E4Y2ViOWNkYzM4NmU4
11
+ NGY1ZWU2NjQwOTI4ZTY4YWJhNTk4MGViNDMwYWU5MjQyYWI5NWE=
12
12
  data.tar.gz: !binary |-
13
- MGE2ZDkyNGMxMTc2MWU2MTYwNjAzZjM1MDE5MThmNzI1MTliNDUyMTBhN2U1
14
- NzlhOWMxMzAwYTVlNGMzZmM1MWQyMTE0ZWFmMjE5NTNlZmJlZjAzYzY2ODVj
15
- ZDgxZThmOTRlMzIwNjM5MGZmN2M1NjQ4YTQ1ZjZiMTBlYTU1YzQ=
13
+ MmEzMTYwNWFiMDg0NzY0Mjk2Yzk1NjhiODQwZDkyNTc1MDcwMWU2OGZmMjYz
14
+ ZDNkODVhMWMzMjI3N2Q0MDBhN2Y5NjNiMWE2NTBmNTAyMmRjOTdkYzk0MGJh
15
+ ZjMxZWZhNDFmNmE5NTA4ODQxNmMwOGY5NTlkNDE4NTUzODBjMzk=
@@ -1,5 +1,6 @@
1
1
  require 'libarchive'
2
2
  require 'filemagic'
3
+ require 'digest'
3
4
 
4
5
  module Debeasy
5
6
  class Error < RuntimeError; end
@@ -25,6 +26,7 @@ module Debeasy
25
26
  @filelist = []
26
27
  extract_files
27
28
  parse_control_file
29
+ generate_checksums
28
30
  end
29
31
 
30
32
  # Lists all the available fields on the package.
@@ -33,10 +35,22 @@ module Debeasy
33
35
  @fields.keys
34
36
  end
35
37
 
38
+ # Get package metadata as a hash.
39
+
40
+ def to_hash
41
+ @fields
42
+ end
43
+
36
44
  def method_missing(m, *args, &block)
37
45
  @fields.has_key?(m.to_s) ? @fields[m.to_s] : nil
38
46
  end
39
47
 
48
+ # Utility method to get the field in a hash-like way.
49
+
50
+ def [](field)
51
+ @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil
52
+ end
53
+
40
54
  private
41
55
 
42
56
  def is_package_file?
@@ -48,6 +62,12 @@ module Debeasy
48
62
  end
49
63
  end
50
64
 
65
+ def generate_checksums
66
+ @fields["MD5sum"] = Digest::MD5.hexdigest(File.read @path)
67
+ @fields["SHA1"] = Digest::SHA1.hexdigest(File.read @path)
68
+ @fields["SHA256"] = Digest::SHA256.hexdigest(File.read @path)
69
+ end
70
+
51
71
  # Poke inside the package to find the control file,
52
72
  # the pre/post install scripts, and a list of
53
73
  # all the files it will deploy.
@@ -1,3 +1,3 @@
1
1
  module Debeasy
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debeasy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Sykes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-15 00:00:00.000000000 Z
11
+ date: 2013-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler