xmlcodec 0.1.3 → 0.3.0
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/README.rdoc +13 -9
- data/Rakefile +113 -55
- data/lib/XMLUtils.rb +32 -90
- data/lib/element.rb +85 -50
- data/lib/stream_object_parser.rb +11 -11
- data/lib/stream_parser.rb +8 -11
- data/lib/subelements.rb +2 -2
- data/lib/xmlcodec.rb +6 -0
- data/test/element_test.rb +20 -18
- data/test/multi_format_test.rb +3 -3
- data/test/partial_import_test.rb +38 -0
- data/test/simple_objects.rb +6 -0
- data/test/subelements_test.rb +11 -1
- data/test/test_helper.rb +4 -1
- data/test/utils_test.rb +7 -40
- data/xmlcodec.gemspec +57 -0
- metadata +71 -64
data/lib/stream_object_parser.rb
CHANGED
@@ -32,6 +32,7 @@ module XMLCodec
|
|
32
32
|
# passed to the constructor. This is cached so the object will only be
|
33
33
|
# created once. All subsequent calls will return the same object.
|
34
34
|
def get_object
|
35
|
+
return nil if not @elclass
|
35
36
|
if not @object
|
36
37
|
@object = @elclass.new_with_content(@attrs, @children)
|
37
38
|
if @parent
|
@@ -59,7 +60,7 @@ module XMLCodec
|
|
59
60
|
# The listener will be passed XMLSOParserElement objects. The two relevant
|
60
61
|
# methods for it's use are XMLSOParserElement#get_object and
|
61
62
|
# XMLSOParserElement#consume.
|
62
|
-
class XMLStreamObjectParser
|
63
|
+
class XMLStreamObjectParser < Nokogiri::XML::SAX::Document
|
63
64
|
# Create a new parser with a listener.
|
64
65
|
def initialize(base_element, listener=nil)
|
65
66
|
@base_element = base_element
|
@@ -92,7 +93,8 @@ module XMLCodec
|
|
92
93
|
# Parse the text with the stream parser calling the listener on any events
|
93
94
|
# that it listens to.
|
94
95
|
def parse(text)
|
95
|
-
|
96
|
+
parser = Nokogiri::XML::SAX::Parser.new(self)
|
97
|
+
parser.parse(text)
|
96
98
|
end
|
97
99
|
|
98
100
|
# Get the current top element of the parse. This is usually used to get the
|
@@ -101,18 +103,18 @@ module XMLCodec
|
|
101
103
|
@top_element.get_object if @top_element
|
102
104
|
end
|
103
105
|
|
104
|
-
def
|
106
|
+
def start_element(name, attrs) #:nodoc:
|
105
107
|
@elements << XMLSOParserElement.new(name, attrs, get_elclass(name),
|
106
108
|
curr_element, next_id,
|
107
109
|
curr_element.depth+1)
|
108
110
|
@currel += 1
|
109
111
|
end
|
110
112
|
|
111
|
-
def
|
113
|
+
def characters(text) #:nodoc:
|
112
114
|
curr_element.add_child(text)
|
113
115
|
end
|
114
116
|
|
115
|
-
def
|
117
|
+
def end_element(name) #:nodoc:
|
116
118
|
obj = curr_element
|
117
119
|
|
118
120
|
if @listener.respond_to?("el_"+name)
|
@@ -120,8 +122,10 @@ module XMLCodec
|
|
120
122
|
end
|
121
123
|
|
122
124
|
if not obj.consumed
|
123
|
-
|
124
|
-
|
125
|
+
real_obj = obj.get_object
|
126
|
+
|
127
|
+
if prev_element && real_obj
|
128
|
+
prev_element.add_child(real_obj)
|
125
129
|
end
|
126
130
|
|
127
131
|
@top_element = obj
|
@@ -130,9 +134,5 @@ module XMLCodec
|
|
130
134
|
@elements.pop
|
131
135
|
@currel -= 1
|
132
136
|
end
|
133
|
-
|
134
|
-
# Ignore everything except tags and text for now
|
135
|
-
def method_missing(methId, *args) #:nodoc:
|
136
|
-
end
|
137
137
|
end
|
138
138
|
end
|
data/lib/stream_parser.rb
CHANGED
@@ -55,7 +55,7 @@ module XMLUtils
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
class XMLStreamParser
|
58
|
+
class XMLStreamParser < Nokogiri::XML::SAX::Document
|
59
59
|
attr_reader :contents
|
60
60
|
|
61
61
|
def initialize(listener=nil)
|
@@ -72,20 +72,21 @@ module XMLUtils
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def parse(text)
|
75
|
-
|
75
|
+
parser = Nokogiri::XML::SAX::Parser.new(self)
|
76
|
+
parser.parse(text)
|
76
77
|
end
|
77
78
|
|
78
|
-
def
|
79
|
+
def start_element(name, attrs)
|
79
80
|
@elements << XMLSParserElement.new(name, @contents.size,
|
80
81
|
self, @elements[-1])
|
81
|
-
@contents << XMLUtils.create_open_tag(name, attrs)
|
82
|
+
@contents << XMLCodec::XMLUtils.create_open_tag(name, attrs)
|
82
83
|
end
|
83
84
|
|
84
|
-
def
|
85
|
-
@contents << XMLUtils.escape_xml(text)
|
85
|
+
def characters(text)
|
86
|
+
@contents << XMLCodec::XMLUtils.escape_xml(text)
|
86
87
|
end
|
87
88
|
|
88
|
-
def
|
89
|
+
def end_element(name)
|
89
90
|
@contents << "</"+name+">"
|
90
91
|
if @listener.respond_to? 'el_'+name
|
91
92
|
@listener.send('el_'+name, @elements[-1])
|
@@ -100,9 +101,5 @@ module XMLUtils
|
|
100
101
|
def consume
|
101
102
|
@contents.erase_from(@elements[-1].elstart)
|
102
103
|
end
|
103
|
-
|
104
|
-
# Ignore everything except tags and text for now
|
105
|
-
def method_missing(methId, *args)
|
106
|
-
end
|
107
104
|
end
|
108
105
|
end
|
data/lib/subelements.rb
CHANGED
@@ -7,7 +7,7 @@ module XMLCodec
|
|
7
7
|
|
8
8
|
# Create a new element for the given string.
|
9
9
|
def initialize(string)
|
10
|
-
@value = XMLUtils::escape_xml(string)
|
10
|
+
@value = XMLCodec::XMLUtils::escape_xml(string)
|
11
11
|
end
|
12
12
|
|
13
13
|
# Simple to_s method that just returns the included string
|
@@ -17,7 +17,7 @@ module XMLCodec
|
|
17
17
|
|
18
18
|
# Creates the XML for the element by using add_text on the value.
|
19
19
|
def create_xml(parent)
|
20
|
-
parent.
|
20
|
+
parent << Nokogiri::XML::Text.new(@value, parent)
|
21
21
|
end
|
22
22
|
|
23
23
|
# The XML text of the element is simply it's string value.
|
data/lib/xmlcodec.rb
CHANGED
data/test/element_test.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper'
|
2
|
-
require '
|
2
|
+
require 'nokogiri'
|
3
3
|
|
4
4
|
class TestXMLElement < Test::Unit::TestCase
|
5
5
|
def test_xmlsubel
|
@@ -16,15 +16,15 @@ class TestXMLElement < Test::Unit::TestCase
|
|
16
16
|
assert_equal('<abc>'+value+'</abc>', sel.xml_text)
|
17
17
|
assert_equal('<subel><abc>'+value+'</abc></subel>', el.xml_text)
|
18
18
|
|
19
|
-
dom =
|
19
|
+
dom = Nokogiri::XML::Document.new
|
20
20
|
el.create_xml(dom)
|
21
21
|
|
22
22
|
assert_equal 1, dom.elements.size
|
23
|
-
eldom = dom.
|
23
|
+
eldom = dom.search('subel')
|
24
24
|
assert_not_nil eldom
|
25
|
-
assert_equal 1, eldom.
|
25
|
+
assert_equal 1, eldom.size
|
26
26
|
|
27
|
-
seldom = eldom.
|
27
|
+
seldom = eldom.search('abc')
|
28
28
|
assert_not_nil seldom
|
29
29
|
assert_equal value, seldom.text
|
30
30
|
|
@@ -37,20 +37,22 @@ class TestXMLElement < Test::Unit::TestCase
|
|
37
37
|
el = TestElement.new
|
38
38
|
|
39
39
|
el.someattr = value
|
40
|
+
el.anotherattr = value
|
40
41
|
assert_equal(value, el.someattr)
|
41
42
|
|
42
|
-
assert_equal("<subel someattr='
|
43
|
+
assert_equal("<subel someattr='#{value}' anotherattr='#{value}'></subel>", el.xml_text)
|
43
44
|
|
44
|
-
dom =
|
45
|
+
dom = Nokogiri::XML::Document.new
|
45
46
|
el.create_xml(dom)
|
46
47
|
|
47
48
|
assert_equal 1, dom.elements.size
|
48
|
-
eldom = dom.
|
49
|
+
eldom = dom.search('subel')
|
49
50
|
assert_not_nil eldom
|
50
|
-
assert_equal value, eldom.
|
51
|
+
assert_equal value, eldom[0].get_attribute('someattr')
|
51
52
|
|
52
53
|
el = TestElement.import_xml(dom)
|
53
54
|
assert_equal value, el.someattr
|
55
|
+
assert_equal value, el.anotherattr
|
54
56
|
end
|
55
57
|
|
56
58
|
def test_xmlsubelements
|
@@ -64,15 +66,15 @@ class TestXMLElement < Test::Unit::TestCase
|
|
64
66
|
|
65
67
|
assert_equal('<subels><abc>'+value+'</abc></subels>', el.xml_text)
|
66
68
|
|
67
|
-
dom =
|
69
|
+
dom = Nokogiri::XML::Document.new
|
68
70
|
el.create_xml(dom)
|
69
71
|
|
70
72
|
assert_equal 1, dom.elements.size
|
71
|
-
eldom = dom.
|
73
|
+
eldom = dom.search('subels')
|
72
74
|
assert_not_nil eldom
|
73
|
-
assert_equal 1, eldom.
|
75
|
+
assert_equal 1, eldom.size
|
74
76
|
|
75
|
-
seldom = eldom.
|
77
|
+
seldom = eldom.search('abc')
|
76
78
|
assert_not_nil seldom
|
77
79
|
assert_equal value, seldom.text
|
78
80
|
|
@@ -141,16 +143,16 @@ class TestXMLElement < Test::Unit::TestCase
|
|
141
143
|
|
142
144
|
assert_equal('<mult><abc>'+value1+'</abc><abc>'+value2+'</abc></mult>', el.xml_text)
|
143
145
|
|
144
|
-
dom =
|
146
|
+
dom = Nokogiri::XML::Document.new
|
145
147
|
el.create_xml(dom)
|
146
148
|
|
147
149
|
assert_equal 1, dom.elements.size
|
148
|
-
eldom = dom.
|
150
|
+
eldom = dom.search('abc')
|
149
151
|
assert_not_nil eldom
|
150
|
-
assert_equal 2, eldom.
|
152
|
+
assert_equal 2, eldom.size
|
151
153
|
|
152
154
|
[value1, value2].each_with_index do |value, index|
|
153
|
-
seldom = eldom
|
155
|
+
seldom = eldom[index]
|
154
156
|
assert_not_nil seldom
|
155
157
|
assert_equal value, seldom.text
|
156
158
|
assert_equal 'abc', seldom.name
|
@@ -240,7 +242,7 @@ class TestXMLElement < Test::Unit::TestCase
|
|
240
242
|
assert_equal SimpleElement, BaseFormat.get_element_class('abc')
|
241
243
|
assert_equal SimpleElement, BaseFormat.get_element_class(:abc)
|
242
244
|
assert_raise ElementClassNotFound do
|
243
|
-
|
245
|
+
StrictBaseFormat.get_element_class(:nosuchclass)
|
244
246
|
end
|
245
247
|
end
|
246
248
|
|
data/test/multi_format_test.rb
CHANGED
@@ -41,7 +41,7 @@ class TestMultiFormat < Test::Unit::TestCase
|
|
41
41
|
def test_import_first
|
42
42
|
value = 'somevalue'
|
43
43
|
text = '<root><child value="'+value+'"></child></root>'
|
44
|
-
root = FirstFormat.
|
44
|
+
root = FirstFormat.import_xml(text)
|
45
45
|
assert_kind_of(FirstRoot, root)
|
46
46
|
assert_kind_of(FirstChild, root.child)
|
47
47
|
assert_equal value, root.child.value
|
@@ -50,7 +50,7 @@ class TestMultiFormat < Test::Unit::TestCase
|
|
50
50
|
def test_import_second
|
51
51
|
value = 'somevalue'
|
52
52
|
text = '<root><child>'+value+'</child></root>'
|
53
|
-
root = SecondFormat.
|
53
|
+
root = SecondFormat.import_xml(text)
|
54
54
|
assert_kind_of(SecondRoot, root)
|
55
55
|
assert_kind_of(SecondChild, root.child)
|
56
56
|
assert_equal value, root.child.value
|
@@ -59,7 +59,7 @@ class TestMultiFormat < Test::Unit::TestCase
|
|
59
59
|
def test_double_inheritance
|
60
60
|
value = 'somevalue'
|
61
61
|
text = '<root><child2 value2="'+value+'">'+value+'</child2></root>'
|
62
|
-
root = SecondFormat.
|
62
|
+
root = SecondFormat.import_xml(text)
|
63
63
|
assert_kind_of(SecondRoot, root)
|
64
64
|
assert_kind_of(SecondChild2, root.child2)
|
65
65
|
assert_equal value, root.child2.value
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
class PartialBaseFormat < XMLElement
|
5
|
+
xmlformat 'Base Format'
|
6
|
+
end
|
7
|
+
|
8
|
+
class PartialSimpleElement < PartialBaseFormat
|
9
|
+
elwithvalue
|
10
|
+
elname 'abc'
|
11
|
+
xmlattr :myattr
|
12
|
+
end
|
13
|
+
|
14
|
+
class TestPartialImport < Test::Unit::TestCase
|
15
|
+
def test_partial_elements_in_text
|
16
|
+
sel = PartialBaseFormat.import_xml "<abc><otherel></otherel>text</abc>"
|
17
|
+
assert_equal "text", sel.value
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_partial_elements_in_dom
|
21
|
+
xml_text = "<abc><otherel></otherel>text</abc>"
|
22
|
+
sel = PartialBaseFormat.import_xml Nokogiri::XML::Document.parse(xml_text)
|
23
|
+
assert_equal "text", sel.value
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_partial_attributes_in_text
|
27
|
+
sel = PartialBaseFormat.import_xml "<abc myattr='real' someattr='xpto'>text</abc>"
|
28
|
+
assert_equal "text", sel.value
|
29
|
+
assert_equal "real", sel.myattr
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_partial_attributes_in_dom
|
33
|
+
xml_text = "<abc myattr='real' someattr='xpto'>text</abc>"
|
34
|
+
sel = PartialBaseFormat.import_xml Nokogiri::XML::Document.parse(xml_text)
|
35
|
+
assert_equal "text", sel.value
|
36
|
+
assert_equal "real", sel.myattr
|
37
|
+
end
|
38
|
+
end
|
data/test/simple_objects.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
include XMLCodec
|
2
2
|
|
3
|
+
class StrictBaseFormat < XMLElement
|
4
|
+
xmlformat 'Base Format'
|
5
|
+
xml_strict_parsing
|
6
|
+
end
|
7
|
+
|
3
8
|
class BaseFormat < XMLElement
|
4
9
|
xmlformat 'Base Format'
|
5
10
|
end
|
@@ -36,6 +41,7 @@ class TestElement < BaseFormat
|
|
36
41
|
xmlsubel :abc2
|
37
42
|
xmlsubel :subel
|
38
43
|
xmlattr :someattr
|
44
|
+
xmlattr 'anotherattr'
|
39
45
|
end
|
40
46
|
|
41
47
|
class SubelElement < BaseFormat
|
data/test/subelements_test.rb
CHANGED
@@ -24,10 +24,20 @@ class TestXMLTextElement < Test::Unit::TestCase
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_create_xml
|
27
|
-
xmlel =
|
27
|
+
xmlel = Nokogiri::XML::Element.new('abc',Nokogiri::XML::Document.new)
|
28
28
|
value = 'Some Value'
|
29
29
|
el = XMLTextElement.new value
|
30
30
|
el.create_xml(xmlel)
|
31
31
|
assert_equal '<abc>'+value+'</abc>', xmlel.to_s
|
32
32
|
end
|
33
|
+
def test_create_xml_multiple
|
34
|
+
xmlel = Nokogiri::XML::Element.new('abc',Nokogiri::XML::Document.new)
|
35
|
+
value1 = 'Some Value'
|
36
|
+
el1 = XMLTextElement.new value1
|
37
|
+
value2 = 'Some Other Value'
|
38
|
+
el2 = XMLTextElement.new value2
|
39
|
+
el1.create_xml(xmlel)
|
40
|
+
el2.create_xml(xmlel)
|
41
|
+
assert_equal '<abc>'+value1+value2+'</abc>', xmlel.to_s
|
42
|
+
end
|
33
43
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start
|
3
|
+
|
1
4
|
require 'test/unit'
|
2
5
|
require 'tmpdir'
|
3
6
|
require File.dirname(__FILE__) + '/../lib/xmlcodec'
|
@@ -22,6 +25,6 @@ class Test::Unit::TestCase
|
|
22
25
|
end
|
23
26
|
|
24
27
|
def compare_xpath(value, path)
|
25
|
-
assert_equal(value.strip, XMLUtils::select_path(path, @temp_path).strip)
|
28
|
+
assert_equal(value.strip, XMLCodec::XMLUtils::select_path(path, @temp_path).strip)
|
26
29
|
end
|
27
30
|
end
|
data/test/utils_test.rb
CHANGED
@@ -3,48 +3,15 @@ require 'tmpdir'
|
|
3
3
|
|
4
4
|
class TestXMLUtils < Test::Unit::TestCase
|
5
5
|
def test_create_open_tag
|
6
|
-
tag = XMLUtils::create_open_tag("name", {"arg1" => "val1", "arg2" => "val2"})
|
6
|
+
tag = XMLCodec::XMLUtils::create_open_tag("name", {"arg1" => "val1", "arg2" => "val2"})
|
7
7
|
assert_equal("<name arg1='val1' arg2='val2'>", tag)
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_escape_xml
|
11
|
-
assert_equal '< abc', XMLUtils::escape_xml('< abc')
|
12
|
-
assert_equal '> abc', XMLUtils::escape_xml('> abc')
|
13
|
-
assert_equal '& abc', XMLUtils::escape_xml('& abc')
|
14
|
-
assert_equal 'abc', XMLUtils::escape_xml('abc')
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_get_xpath
|
18
|
-
opts = {}
|
19
|
-
assert_xpath_equal('abc', '//xpto', '<xpto>abc</xpto>')
|
20
|
-
|
21
|
-
assert_xpath_equal('abc', '//xpto', '<xpto>abc<xpto2>foo</xpto2></xpto>')
|
22
|
-
|
23
|
-
opts[:with_attrs] = true
|
24
|
-
opts[:recursive] = false
|
25
|
-
opts[:multiple] = false
|
26
|
-
assert_xpath_equal('attr1 abc', '//xpto', '<xpto attr1="attr1">abc<xpto2>foo</xpto2></xpto>', opts)
|
27
|
-
|
28
|
-
opts[:with_attrs] = false
|
29
|
-
opts[:recursive] = true
|
30
|
-
opts[:multiple] = false
|
31
|
-
assert_xpath_equal('abc foo', '//xpto', '<xpto>abc<xpto2 attr1="attr1">foo</xpto2></xpto>', opts)
|
32
|
-
|
33
|
-
opts[:with_attrs] = true
|
34
|
-
opts[:recursive] = true
|
35
|
-
opts[:multiple] = false
|
36
|
-
assert_xpath_equal('abc attr1 foo', '//xpto', '<xpto>abc<xpto2 attr1="attr1">foo</xpto2></xpto>', opts)
|
37
|
-
|
38
|
-
opts[:with_attrs] = false
|
39
|
-
opts[:recursive] = false
|
40
|
-
opts[:multiple] = true
|
41
|
-
assert_xpath_equal('abc foo', '//xpto', '<xpto>abc<xpto attr1="attr1">foo</xpto></xpto>', opts)
|
42
|
-
end
|
43
|
-
|
44
|
-
def assert_xpath_equal(result, path, xml, opts={})
|
45
|
-
assert_equal result, XMLUtils::get_xpath(path, xml, opts)
|
46
|
-
assert_equal result, XMLUtils::get_xpath(path, StringIO.new(xml), opts)
|
47
|
-
assert_equal result, XMLUtils::get_xpath(path, REXML::Document.new(xml), opts)
|
11
|
+
assert_equal '< abc', XMLCodec::XMLUtils::escape_xml('< abc')
|
12
|
+
assert_equal '> abc', XMLCodec::XMLUtils::escape_xml('> abc')
|
13
|
+
assert_equal '& abc', XMLCodec::XMLUtils::escape_xml('& abc')
|
14
|
+
assert_equal 'abc', XMLCodec::XMLUtils::escape_xml('abc')
|
48
15
|
end
|
49
16
|
|
50
17
|
def test_count_elements
|
@@ -53,7 +20,7 @@ class TestXMLUtils < Test::Unit::TestCase
|
|
53
20
|
f = File.open(filename, 'w')
|
54
21
|
f << text
|
55
22
|
f.close
|
56
|
-
assert_equal 2, XMLUtils::count_elements('//abc', filename)
|
23
|
+
assert_equal 2, XMLCodec::XMLUtils::count_elements('//abc', filename)
|
57
24
|
end
|
58
25
|
|
59
26
|
def test_element_exists
|
@@ -62,6 +29,6 @@ class TestXMLUtils < Test::Unit::TestCase
|
|
62
29
|
f = File.open(filename, 'w')
|
63
30
|
f << text
|
64
31
|
f.close
|
65
|
-
assert XMLUtils::element_exists('//abc', filename)
|
32
|
+
assert XMLCodec::XMLUtils::element_exists('//abc', filename)
|
66
33
|
end
|
67
34
|
end
|
data/xmlcodec.gemspec
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
3
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
4
|
+
s.rubygems_version = '1.3.5'
|
5
|
+
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
|
+
|
8
|
+
s.name = 'xmlcodec'
|
9
|
+
s.version = '0.3.0'
|
10
|
+
s.date = '2013-08-30'
|
11
|
+
|
12
|
+
s.summary = "Generic Importer/Exporter of XML formats"
|
13
|
+
s.description = <<EOF
|
14
|
+
A framework to write object to XML mappers in Ruby that can then function both in whole-document manipulation as well as constant memory unlimited size importing and exporting of XML.
|
15
|
+
EOF
|
16
|
+
|
17
|
+
s.authors = ["Pedro Côrte-Real"]
|
18
|
+
s.email = 'pedro@pedrocr.net'
|
19
|
+
s.homepage = 'https://github.com/pedrocr/xmlcodec'
|
20
|
+
|
21
|
+
s.require_paths = %w[lib]
|
22
|
+
|
23
|
+
s.has_rdoc = true
|
24
|
+
s.rdoc_options = ['-S', '-w 2', '-N', '-c utf8']
|
25
|
+
s.extra_rdoc_files = %w[README.rdoc LICENSE]
|
26
|
+
|
27
|
+
s.executables = Dir.glob("bin/*").map{|f| f.gsub('bin/','')}
|
28
|
+
|
29
|
+
s.add_dependency('nokogiri')
|
30
|
+
|
31
|
+
# = MANIFEST =
|
32
|
+
s.files = %w[
|
33
|
+
LICENSE
|
34
|
+
README.rdoc
|
35
|
+
Rakefile
|
36
|
+
lib/XMLUtils.rb
|
37
|
+
lib/element.rb
|
38
|
+
lib/stream_object_parser.rb
|
39
|
+
lib/stream_parser.rb
|
40
|
+
lib/subelements.rb
|
41
|
+
lib/xmlcodec.rb
|
42
|
+
test/element_test.rb
|
43
|
+
test/multi_format_test.rb
|
44
|
+
test/partial_export_test.rb
|
45
|
+
test/partial_import_test.rb
|
46
|
+
test/simple_objects.rb
|
47
|
+
test/stream_object_parser_test.rb
|
48
|
+
test/stream_parser_test.rb
|
49
|
+
test/subelements_test.rb
|
50
|
+
test/test_helper.rb
|
51
|
+
test/utils_test.rb
|
52
|
+
xmlcodec.gemspec
|
53
|
+
]
|
54
|
+
# = MANIFEST =
|
55
|
+
|
56
|
+
s.test_files = s.files.select { |path| path =~ /^test\/.*\.rb/ }
|
57
|
+
end
|
metadata
CHANGED
@@ -1,88 +1,95 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: xmlcodec
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 3
|
10
|
-
version: 0.1.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
7
|
+
authors:
|
8
|
+
- Pedro Côrte-Real
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
12
|
+
date: 2013-08-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nokogiri
|
16
|
+
requirement: &79189020 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *79189020
|
25
|
+
description: ! 'A framework to write object to XML mappers in Ruby that can then function
|
26
|
+
both in whole-document manipulation as well as constant memory unlimited size importing
|
27
|
+
and exporting of XML.
|
17
28
|
|
18
|
-
|
19
|
-
default_executable:
|
20
|
-
dependencies: []
|
21
|
-
|
22
|
-
description: |
|
23
|
-
A library that eases the creation of XML importers and exporters for ruby.
|
24
|
-
|
29
|
+
'
|
25
30
|
email: pedro@pedrocr.net
|
26
31
|
executables: []
|
27
|
-
|
28
32
|
extensions: []
|
29
|
-
|
30
|
-
extra_rdoc_files:
|
33
|
+
extra_rdoc_files:
|
31
34
|
- README.rdoc
|
32
|
-
|
33
|
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
- test/multi_format_test.rb
|
38
|
-
- test/stream_parser_test.rb
|
39
|
-
- test/element_test.rb
|
40
|
-
- test/simple_objects.rb
|
41
|
-
- test/stream_object_parser_test.rb
|
42
|
-
- lib/element.rb
|
43
|
-
- lib/subelements.rb
|
35
|
+
- LICENSE
|
36
|
+
files:
|
37
|
+
- LICENSE
|
38
|
+
- README.rdoc
|
39
|
+
- Rakefile
|
44
40
|
- lib/XMLUtils.rb
|
45
|
-
- lib/
|
41
|
+
- lib/element.rb
|
46
42
|
- lib/stream_object_parser.rb
|
47
43
|
- lib/stream_parser.rb
|
48
|
-
-
|
49
|
-
-
|
50
|
-
-
|
51
|
-
|
52
|
-
|
44
|
+
- lib/subelements.rb
|
45
|
+
- lib/xmlcodec.rb
|
46
|
+
- test/element_test.rb
|
47
|
+
- test/multi_format_test.rb
|
48
|
+
- test/partial_export_test.rb
|
49
|
+
- test/partial_import_test.rb
|
50
|
+
- test/simple_objects.rb
|
51
|
+
- test/stream_object_parser_test.rb
|
52
|
+
- test/stream_parser_test.rb
|
53
|
+
- test/subelements_test.rb
|
54
|
+
- test/test_helper.rb
|
55
|
+
- test/utils_test.rb
|
56
|
+
- xmlcodec.gemspec
|
57
|
+
homepage: https://github.com/pedrocr/xmlcodec
|
53
58
|
licenses: []
|
54
|
-
|
55
59
|
post_install_message:
|
56
|
-
rdoc_options:
|
60
|
+
rdoc_options:
|
57
61
|
- -S
|
58
62
|
- -w 2
|
59
63
|
- -N
|
60
|
-
|
64
|
+
- -c utf8
|
65
|
+
require_paths:
|
61
66
|
- lib
|
62
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
68
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
|
68
|
-
|
69
|
-
- 0
|
70
|
-
version: "0"
|
71
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
74
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
|
78
|
-
- 0
|
79
|
-
version: "0"
|
80
|
-
requirements:
|
81
|
-
- none
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
82
80
|
rubyforge_project:
|
83
|
-
rubygems_version: 1.
|
81
|
+
rubygems_version: 1.8.11
|
84
82
|
signing_key:
|
85
|
-
specification_version:
|
83
|
+
specification_version: 2
|
86
84
|
summary: Generic Importer/Exporter of XML formats
|
87
|
-
test_files:
|
88
|
-
|
85
|
+
test_files:
|
86
|
+
- test/element_test.rb
|
87
|
+
- test/multi_format_test.rb
|
88
|
+
- test/partial_export_test.rb
|
89
|
+
- test/partial_import_test.rb
|
90
|
+
- test/simple_objects.rb
|
91
|
+
- test/stream_object_parser_test.rb
|
92
|
+
- test/stream_parser_test.rb
|
93
|
+
- test/subelements_test.rb
|
94
|
+
- test/test_helper.rb
|
95
|
+
- test/utils_test.rb
|