manifest 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/manifest/version.rb +1 -1
- data/lib/manifest.rb +32 -28
- metadata +6 -4
data/lib/manifest/version.rb
CHANGED
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
53
|
-
|
54
|
-
|
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.
|
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-
|
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.
|
66
|
+
rubygems_version: 1.3.5
|
65
67
|
signing_key:
|
66
|
-
specification_version:
|
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
|
|