debeasy 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/debeasy.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  programmatically read Debian packages with very
13
13
  little effort.}
14
14
  spec.summary = %q{Read .deb (Debian/Ubuntu) packages with ease!}
15
- spec.homepage = ""
15
+ spec.homepage = "https://github.com/andytinycat/debeasy"
16
16
  spec.license = "MIT"
17
17
 
18
18
  spec.files = `git ls-files`.split($/)
data/lib/debeasy.rb CHANGED
@@ -2,6 +2,8 @@ require "debeasy/version"
2
2
  require "debeasy/package"
3
3
 
4
4
  module Debeasy
5
+ # Read a package file; returns a Debeasy::Package object.
6
+
5
7
  def self.read(path)
6
8
  Debeasy::Package.new(path)
7
9
  end
@@ -8,6 +8,11 @@ module Debeasy
8
8
  attr_reader :preinst_contents, :prerm_contents
9
9
  attr_reader :postinst_contents, :postrm_contents
10
10
 
11
+ # Create a new Debeasy::Package object.
12
+ #
13
+ # Arguments:
14
+ # path: (String)
15
+
11
16
  def initialize(path)
12
17
  @path = path
13
18
  @package = Archive.read_open_filename(path)
@@ -16,16 +21,21 @@ module Debeasy
16
21
  parse_control_file
17
22
  end
18
23
 
24
+ # Lists all the available fields on the package.
25
+
19
26
  def fields
20
27
  @fields.keys
21
28
  end
22
29
 
23
30
  def method_missing(m, *args, &block)
24
- @fields[m.to_s]
31
+ @fields.has_key?(m.to_s) ? @fields[m.to_s] : nil
25
32
  end
26
33
 
27
34
  private
28
35
 
36
+ # Poke inside the package to find the control file,
37
+ # and the pre/post install scripts.
38
+
29
39
  def extract_files
30
40
  while file = @package.next_header
31
41
  if file.pathname == "control.tar.gz"
@@ -48,6 +58,8 @@ module Debeasy
48
58
  end
49
59
  end
50
60
 
61
+ # Parse the available fields out of the Debian control file.
62
+
51
63
  def parse_control_file
52
64
  @control_file_contents.scan(/^([\w-]+?): (.*?)\n(?! )/m).each do |entry|
53
65
  field, value = entry
@@ -1,3 +1,3 @@
1
1
  module Debeasy
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debeasy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-21 00:00:00.000000000 Z
12
+ date: 2013-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -76,7 +76,7 @@ files:
76
76
  - lib/debeasy.rb
77
77
  - lib/debeasy/package.rb
78
78
  - lib/debeasy/version.rb
79
- homepage: ''
79
+ homepage: https://github.com/andytinycat/debeasy
80
80
  licenses:
81
81
  - MIT
82
82
  post_install_message: