manifest 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/manifest/version.rb +1 -1
  2. data/lib/manifest.rb +32 -28
  3. metadata +6 -4
@@ -13,7 +13,7 @@ module Manifest #:nodoc:
13
13
  module VERSION #:nodoc:
14
14
  MAJOR = 0
15
15
  MINOR = 0
16
- TINY = 3
16
+ TINY = 4
17
17
 
18
18
  STRING = [MAJOR, MINOR, TINY].join('.')
19
19
  end
data/lib/manifest.rb CHANGED
@@ -12,12 +12,12 @@
12
12
  $:.unshift File.dirname(__FILE__)
13
13
 
14
14
  module Manifest
15
-
15
+
16
16
  MANIFEST_LINE_SEP = /\r\n|\n|\r[^\n]/
17
17
  MANIFEST_SECTION_SEP = /(#{MANIFEST_LINE_SEP}){2}/
18
-
18
+
19
19
  def read(text)
20
-
20
+
21
21
  text.split(MANIFEST_SECTION_SEP).reject { |s| s.chomp == "" }.map do |section|
22
22
  section.split(MANIFEST_LINE_SEP).each { |line| line.length < 72 }.inject([]) { |merged, line|
23
23
  if line[0] == 32
@@ -27,29 +27,33 @@ module Manifest
27
27
  end
28
28
  merged
29
29
  }.map { |line| line.split(/: /) }.inject({}) { |map, (name, values)|
30
- valuesAsHash = {}
31
- values.split(/,/).inject([]) { |array, att1|
32
-
33
- if (/[\]|\[|\)|\(]"/.match(att1))
34
- last = array.pop
35
- array << "#{last},#{att1}"
36
- else
37
- array << att1
38
- end
39
- }.each { |attribute|
40
- optionalAttributes = {}
41
- values = attribute.split(/;/)
42
- value = values.shift
43
- values.each {|attribute|
44
- array = attribute.split(/:?=/)
45
- optionalAttributes.merge!(array.first.strip=>array.last.strip)
46
- }
47
- valuesAsHash.merge!(value=>optionalAttributes)
48
- }
49
- map.merge!(name=>valuesAsHash)
50
- }
30
+ if (values.nil?)
31
+ map.merge!(name=>nil)
32
+ else
33
+ valuesAsHash = {}
34
+ values.split(/,/).inject([]) { |array, att1|
35
+
36
+ if (/[\]|\[|\)|\(]"/.match(att1))
37
+ last = array.pop
38
+ array << "#{last},#{att1}"
39
+ else
40
+ array << att1
41
+ end
42
+ }.each { |attribute|
43
+ optionalAttributes = {}
44
+ values = attribute.split(/;/)
45
+ value = values.shift
46
+ values.each {|attribute|
47
+ array = attribute.split(/:?=/)
48
+ optionalAttributes.merge!(array.first.strip=>array.last.strip)
49
+ }
50
+ valuesAsHash.merge!(value=>optionalAttributes)
51
+ }
52
+ map.merge!(name=>valuesAsHash)
53
+ end
54
+ }
55
+ end
51
56
  end
52
- end
53
-
54
- module_function :read
55
- end
57
+
58
+ module_function :read
59
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manifest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antoine Toulme
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-22 00:00:00 +01:00
12
+ date: 2009-08-11 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,6 +40,8 @@ files:
40
40
  - lib/manifest/version.rb
41
41
  has_rdoc: true
42
42
  homepage: http://manifest.rubyforge.org
43
+ licenses: []
44
+
43
45
  post_install_message:
44
46
  rdoc_options:
45
47
  - --main
@@ -61,9 +63,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
63
  requirements: []
62
64
 
63
65
  rubyforge_project: manifest
64
- rubygems_version: 1.2.0
66
+ rubygems_version: 1.3.5
65
67
  signing_key:
66
- specification_version: 2
68
+ specification_version: 3
67
69
  summary: The Jar Manifest files are a nightmare to parse. They have a special encoding that is neither XML, JSON, or properties. This library intends to produce a parser that will read such files.
68
70
  test_files: []
69
71