yob-roxml 3.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/.gitignore +7 -0
  2. data/.gitmodules +3 -0
  3. data/History.txt +354 -0
  4. data/LICENSE +20 -0
  5. data/README.rdoc +195 -0
  6. data/Rakefile +117 -0
  7. data/TODO +37 -0
  8. data/VERSION +1 -0
  9. data/examples/amazon.rb +35 -0
  10. data/examples/current_weather.rb +27 -0
  11. data/examples/dashed_elements.rb +20 -0
  12. data/examples/library.rb +40 -0
  13. data/examples/posts.rb +27 -0
  14. data/examples/rails.rb +70 -0
  15. data/examples/twitter.rb +37 -0
  16. data/examples/xml/active_record.xml +70 -0
  17. data/examples/xml/amazon.xml +133 -0
  18. data/examples/xml/current_weather.xml +89 -0
  19. data/examples/xml/dashed_elements.xml +52 -0
  20. data/examples/xml/posts.xml +23 -0
  21. data/examples/xml/twitter.xml +422 -0
  22. data/lib/roxml.rb +556 -0
  23. data/lib/roxml/definition.rb +238 -0
  24. data/lib/roxml/hash_definition.rb +25 -0
  25. data/lib/roxml/xml.rb +40 -0
  26. data/lib/roxml/xml/parsers/libxml.rb +85 -0
  27. data/lib/roxml/xml/parsers/nokogiri.rb +82 -0
  28. data/lib/roxml/xml/references.rb +322 -0
  29. data/roxml.gemspec +206 -0
  30. data/spec/definition_spec.rb +494 -0
  31. data/spec/examples/active_record_spec.rb +40 -0
  32. data/spec/examples/amazon_spec.rb +54 -0
  33. data/spec/examples/current_weather_spec.rb +37 -0
  34. data/spec/examples/dashed_elements_spec.rb +20 -0
  35. data/spec/examples/library_spec.rb +46 -0
  36. data/spec/examples/post_spec.rb +24 -0
  37. data/spec/examples/twitter_spec.rb +32 -0
  38. data/spec/roxml_spec.rb +372 -0
  39. data/spec/shared_specs.rb +15 -0
  40. data/spec/spec.opts +1 -0
  41. data/spec/spec_helper.rb +14 -0
  42. data/spec/support/libxml.rb +3 -0
  43. data/spec/support/nokogiri.rb +3 -0
  44. data/spec/xml/array_spec.rb +36 -0
  45. data/spec/xml/attributes_spec.rb +71 -0
  46. data/spec/xml/encoding_spec.rb +52 -0
  47. data/spec/xml/namespace_spec.rb +270 -0
  48. data/spec/xml/namespaces_spec.rb +67 -0
  49. data/spec/xml/object_spec.rb +82 -0
  50. data/spec/xml/parser_spec.rb +21 -0
  51. data/spec/xml/text_spec.rb +71 -0
  52. data/test/fixtures/book_malformed.xml +5 -0
  53. data/test/fixtures/book_pair.xml +8 -0
  54. data/test/fixtures/book_text_with_attribute.xml +5 -0
  55. data/test/fixtures/book_valid.xml +5 -0
  56. data/test/fixtures/book_with_authors.xml +7 -0
  57. data/test/fixtures/book_with_contributions.xml +9 -0
  58. data/test/fixtures/book_with_contributors.xml +7 -0
  59. data/test/fixtures/book_with_contributors_attrs.xml +7 -0
  60. data/test/fixtures/book_with_default_namespace.xml +9 -0
  61. data/test/fixtures/book_with_depth.xml +6 -0
  62. data/test/fixtures/book_with_octal_pages.xml +4 -0
  63. data/test/fixtures/book_with_publisher.xml +7 -0
  64. data/test/fixtures/book_with_wrapped_attr.xml +3 -0
  65. data/test/fixtures/dictionary_of_attr_name_clashes.xml +8 -0
  66. data/test/fixtures/dictionary_of_attrs.xml +6 -0
  67. data/test/fixtures/dictionary_of_guarded_names.xml +6 -0
  68. data/test/fixtures/dictionary_of_mixeds.xml +4 -0
  69. data/test/fixtures/dictionary_of_name_clashes.xml +10 -0
  70. data/test/fixtures/dictionary_of_names.xml +4 -0
  71. data/test/fixtures/dictionary_of_texts.xml +10 -0
  72. data/test/fixtures/library.xml +30 -0
  73. data/test/fixtures/library_uppercase.xml +30 -0
  74. data/test/fixtures/muffins.xml +3 -0
  75. data/test/fixtures/nameless_ageless_youth.xml +2 -0
  76. data/test/fixtures/node_with_attr_name_conflicts.xml +1 -0
  77. data/test/fixtures/node_with_name_conflicts.xml +4 -0
  78. data/test/fixtures/numerology.xml +4 -0
  79. data/test/fixtures/person.xml +1 -0
  80. data/test/fixtures/person_with_guarded_mothers.xml +13 -0
  81. data/test/fixtures/person_with_mothers.xml +10 -0
  82. data/test/load_test.rb +6 -0
  83. data/test/mocks/dictionaries.rb +57 -0
  84. data/test/mocks/mocks.rb +279 -0
  85. data/test/support/fixtures.rb +11 -0
  86. data/test/test_helper.rb +34 -0
  87. data/test/unit/definition_test.rb +235 -0
  88. data/test/unit/deprecations_test.rb +24 -0
  89. data/test/unit/to_xml_test.rb +81 -0
  90. data/test/unit/xml_attribute_test.rb +39 -0
  91. data/test/unit/xml_block_test.rb +81 -0
  92. data/test/unit/xml_bool_test.rb +122 -0
  93. data/test/unit/xml_convention_test.rb +150 -0
  94. data/test/unit/xml_hash_test.rb +115 -0
  95. data/test/unit/xml_initialize_test.rb +49 -0
  96. data/test/unit/xml_name_test.rb +141 -0
  97. data/test/unit/xml_namespace_test.rb +31 -0
  98. data/test/unit/xml_object_test.rb +205 -0
  99. data/test/unit/xml_required_test.rb +94 -0
  100. data/test/unit/xml_text_test.rb +71 -0
  101. data/website/index.html +98 -0
  102. metadata +300 -0
@@ -0,0 +1,322 @@
1
+ module ROXML
2
+ class RequiredElementMissing < Exception # :nodoc:
3
+ end
4
+
5
+ #
6
+ # Internal base class that represents an XML - Class binding.
7
+ #
8
+ class XMLRef # :nodoc:
9
+ attr_reader :opts
10
+ delegate :required?, :array?, :accessor, :default, :wrapper, :to => :opts
11
+
12
+ def initialize(opts, instance)
13
+ @opts = opts
14
+ @instance = instance
15
+ end
16
+
17
+ def blocks
18
+ opts.blocks || []
19
+ end
20
+
21
+ def to_xml(instance)
22
+ val = instance.__send__(accessor)
23
+ opts.to_xml.respond_to?(:call) ? opts.to_xml.call(val) : val
24
+ end
25
+
26
+ def name
27
+ opts.name_explicit? ? opts.name : conventionize(opts.name)
28
+ end
29
+
30
+ def xpath_name
31
+ namespacify(name)
32
+ end
33
+
34
+ def value_in(xml)
35
+ xml = XML::Node.from(xml)
36
+ value = fetch_value(xml)
37
+ value = default if value.nil?
38
+
39
+ freeze(apply_blocks(value))
40
+ end
41
+
42
+ private
43
+ def conventionize(what)
44
+ convention ||= @instance.class.respond_to?(:roxml_naming_convention) && @instance.class.roxml_naming_convention
45
+ if !what.blank? && convention.respond_to?(:call)
46
+ URI.unescape(convention.call(URI.escape(what, /\/|::/)))
47
+ else
48
+ what
49
+ end
50
+ end
51
+
52
+ def namespacify(what)
53
+ if what.to_s.present? && !what.to_s.include?(':') && opts.namespace != false
54
+ [opts.namespace, @instance.class.roxml_namespace, @default_namespace].each do |namespace|
55
+ return opts.namespace == '*' ? (what == '*' ? "*" : "*[local-name()='#{what}']") : "#{namespace}:#{what}" if namespace
56
+ end
57
+ end
58
+ what
59
+ end
60
+
61
+ def apply_blocks(val)
62
+ begin
63
+ blocks.inject(val) {|val, block| block.call(val) }
64
+ rescue Exception => ex
65
+ raise ex, "#{accessor}: #{ex.message}"
66
+ end
67
+ end
68
+
69
+ def freeze(val)
70
+ if opts.frozen?
71
+ val.each(&:freeze) if val.is_a?(Enumerable)
72
+ val.freeze
73
+ else
74
+ val
75
+ end
76
+ end
77
+
78
+ def xpath
79
+ opts.wrapper ? "#{namespacify(opts.wrapper)}/#{xpath_name}" : xpath_name.to_s
80
+ end
81
+
82
+ def auto_wrapper
83
+ namespacify(conventionize(opts.name.pluralize))
84
+ end
85
+
86
+ def auto_xpath
87
+ "#{auto_wrapper}/#{xpath_name}" if array?
88
+ end
89
+
90
+ def several?
91
+ array?
92
+ end
93
+
94
+ def wrap(xml, opts = {:always_create => false})
95
+ wrap_with = @auto_vals ? auto_wrapper : wrapper
96
+
97
+ return xml if !wrap_with || xml.name == wrap_with
98
+ if !opts[:always_create] && (child = xml.children.find {|c| c.name == wrap_with })
99
+ return child
100
+ end
101
+ XML.add_node(xml, wrap_with.to_s)
102
+ end
103
+
104
+ def nodes_in(xml)
105
+ @default_namespace = xml.default_namespace
106
+ vals = xml.roxml_search(xpath, @instance.class.roxml_namespaces)
107
+
108
+ if several? && vals.empty? && !wrapper && auto_xpath
109
+ vals = xml.roxml_search(auto_xpath, @instance.class.roxml_namespaces)
110
+ @auto_vals = !vals.empty?
111
+ end
112
+
113
+ if vals.empty?
114
+ raise RequiredElementMissing, "#{name} from #{xml} for #{accessor}" if required?
115
+ default
116
+ elsif several?
117
+ vals.map do |val|
118
+ yield val
119
+ end
120
+ else
121
+ yield(vals.first)
122
+ end
123
+ end
124
+ end
125
+
126
+ # Interal class representing an XML attribute binding
127
+ #
128
+ # In context:
129
+ # <element attribute="XMLAttributeRef">
130
+ # XMLTextRef
131
+ # </element>
132
+ class XMLAttributeRef < XMLRef # :nodoc:
133
+ # Updates the attribute in the given XML block to
134
+ # the value provided.
135
+ def update_xml(xml, values)
136
+ if array?
137
+ values.each do |value|
138
+ wrap(xml, :always_create => true).tap do |node|
139
+ XML.set_attribute(node, name, value.to_s)
140
+ end
141
+ end
142
+ else
143
+ wrap(xml).tap do |xml|
144
+ XML.set_attribute(xml, name, values.to_s)
145
+ end
146
+ end
147
+ end
148
+
149
+ private
150
+ def fetch_value(xml)
151
+ nodes_in(xml) do |node|
152
+ node.value
153
+ end
154
+ end
155
+
156
+ def xpath_name
157
+ "@#{name}"
158
+ end
159
+ end
160
+
161
+ # Interal class representing XML content text binding
162
+ #
163
+ # In context:
164
+ # <element attribute="XMLAttributeRef">
165
+ # XMLTextRef
166
+ # </element>
167
+ class XMLTextRef < XMLRef # :nodoc:
168
+ delegate :cdata?, :content?, :name?, :to => :opts
169
+
170
+ # Updates the text in the given _xml_ block to
171
+ # the _value_ provided.
172
+ def update_xml(xml, value)
173
+ wrap(xml).tap do |xml|
174
+ if content?
175
+ add(xml, value)
176
+ elsif name?
177
+ xml.name = value
178
+ elsif array?
179
+ value.each do |v|
180
+ add(XML.add_node(xml, name), v)
181
+ end
182
+ else
183
+ add(XML.add_node(xml, name), value)
184
+ end
185
+ end
186
+ end
187
+
188
+ private
189
+ def fetch_value(xml)
190
+ if content? || name?
191
+ value =
192
+ if content?
193
+ xml.content.to_s
194
+ elsif name?
195
+ xml.name
196
+ end
197
+
198
+ if value.blank?
199
+ raise RequiredElementMissing, "#{name} from #{xml} for #{accessor}" if required?
200
+ default
201
+ else
202
+ value
203
+ end
204
+ else
205
+ nodes_in(xml) do |node|
206
+ node.content
207
+ end
208
+ end
209
+ end
210
+
211
+ def add(dest, value)
212
+ if cdata?
213
+ XML.add_cdata(dest, value.to_s)
214
+ else
215
+ XML.set_content(dest, value.to_s)
216
+ end
217
+ end
218
+ end
219
+
220
+ class XMLNameSpaceRef < XMLRef # :nodoc:
221
+ private
222
+ def fetch_value(xml)
223
+ xml.namespace.prefix
224
+ end
225
+ end
226
+
227
+ class XMLHashRef < XMLTextRef # :nodoc:
228
+ delegate :hash, :to => :opts
229
+
230
+ def initialize(opts, inst)
231
+ super(opts, inst)
232
+ @key = opts.hash.key.to_ref(inst)
233
+ @value = opts.hash.value.to_ref(inst)
234
+ end
235
+
236
+ def several?
237
+ true
238
+ end
239
+
240
+ # Updates the composed XML object in the given XML block to
241
+ # the value provided.
242
+ def update_xml(xml, value)
243
+ wrap(xml).tap do |xml|
244
+ value.each_pair do |k, v|
245
+ node = XML.add_node(xml, hash.wrapper)
246
+ @key.update_xml(node, k)
247
+ @value.update_xml(node, v)
248
+ end
249
+ end
250
+ end
251
+
252
+ private
253
+ def fetch_value(xml)
254
+ nodes_in(xml) do |node|
255
+ [@key.value_in(node), @value.value_in(node)]
256
+ end
257
+ end
258
+
259
+ def apply_blocks(vals)
260
+ unless blocks.empty?
261
+ vals.collect! do |kvp|
262
+ super(kvp)
263
+ end
264
+ end
265
+ to_hash(vals) if vals
266
+ end
267
+
268
+ def freeze(vals)
269
+ if opts.frozen?
270
+ vals.each_pair{|k, v| k.freeze; v.freeze }
271
+ vals.freeze
272
+ else
273
+ vals
274
+ end
275
+ end
276
+
277
+ def to_hash(array)
278
+ hash = array.inject({}) do |result, (k, v)|
279
+ result[k] ||= []
280
+ result[k] << v
281
+ result
282
+ end
283
+ hash.each_pair do |k, v|
284
+ hash[k] = v.first if v.size == 1
285
+ end
286
+ end
287
+ end
288
+
289
+ class XMLObjectRef < XMLTextRef # :nodoc:
290
+ delegate :sought_type, :to => :opts
291
+
292
+ # Updates the composed XML object in the given XML block to
293
+ # the value provided.
294
+ def update_xml(xml, value)
295
+ wrap(xml).tap do |xml|
296
+ params = {:name => name, :namespace => opts.namespace}
297
+ if array?
298
+ value.each do |v|
299
+ XML.add_child(xml, v.to_xml(params))
300
+ end
301
+ elsif value.is_a?(ROXML)
302
+ XML.add_child(xml, value.to_xml(params))
303
+ else
304
+ XML.add_node(xml, name).tap do |node|
305
+ XML.set_content(node, value.to_xml)
306
+ end
307
+ end
308
+ end
309
+ end
310
+
311
+ private
312
+ def fetch_value(xml)
313
+ nodes_in(xml) do |node|
314
+ if sought_type.respond_to? :from_xml
315
+ sought_type.from_xml(node)
316
+ else
317
+ sought_type.new(node)
318
+ end
319
+ end
320
+ end
321
+ end
322
+ end
@@ -0,0 +1,206 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{roxml}
8
+ s.version = "3.1.5"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ben Woosley", "Zak Mandhro", "Anders Engstrom", "Russ Olsen"]
12
+ s.date = %q{2009-12-18}
13
+ s.description = %q{ROXML is a Ruby library designed to make it easier for Ruby developers to work with XML.
14
+ Using simple annotations, it enables Ruby classes to be mapped to XML. ROXML takes care
15
+ of the marshalling and unmarshalling of mapped attributes so that developers can focus on
16
+ building first-class Ruby classes. As a result, ROXML simplifies the development of
17
+ RESTful applications, Web Services, and XML-RPC.
18
+ }
19
+ s.email = %q{ben.woosley@gmail.com}
20
+ s.extra_rdoc_files = [
21
+ "History.txt",
22
+ "README.rdoc"
23
+ ]
24
+ s.files = [
25
+ ".gitignore",
26
+ ".gitmodules",
27
+ "History.txt",
28
+ "LICENSE",
29
+ "README.rdoc",
30
+ "Rakefile",
31
+ "TODO",
32
+ "VERSION",
33
+ "examples/amazon.rb",
34
+ "examples/current_weather.rb",
35
+ "examples/dashed_elements.rb",
36
+ "examples/library.rb",
37
+ "examples/posts.rb",
38
+ "examples/rails.rb",
39
+ "examples/twitter.rb",
40
+ "examples/xml/active_record.xml",
41
+ "examples/xml/amazon.xml",
42
+ "examples/xml/current_weather.xml",
43
+ "examples/xml/dashed_elements.xml",
44
+ "examples/xml/posts.xml",
45
+ "examples/xml/twitter.xml",
46
+ "lib/roxml.rb",
47
+ "lib/roxml/definition.rb",
48
+ "lib/roxml/hash_definition.rb",
49
+ "lib/roxml/xml.rb",
50
+ "lib/roxml/xml/parsers/libxml.rb",
51
+ "lib/roxml/xml/parsers/nokogiri.rb",
52
+ "lib/roxml/xml/references.rb",
53
+ "roxml.gemspec",
54
+ "spec/definition_spec.rb",
55
+ "spec/examples/active_record_spec.rb",
56
+ "spec/examples/amazon_spec.rb",
57
+ "spec/examples/current_weather_spec.rb",
58
+ "spec/examples/dashed_elements_spec.rb",
59
+ "spec/examples/library_spec.rb",
60
+ "spec/examples/post_spec.rb",
61
+ "spec/examples/twitter_spec.rb",
62
+ "spec/roxml_spec.rb",
63
+ "spec/shared_specs.rb",
64
+ "spec/spec.opts",
65
+ "spec/spec_helper.rb",
66
+ "spec/support/libxml.rb",
67
+ "spec/support/nokogiri.rb",
68
+ "spec/xml/attributes_spec.rb",
69
+ "spec/xml/encoding_spec.rb",
70
+ "spec/xml/namespace_spec.rb",
71
+ "spec/xml/namespaces_spec.rb",
72
+ "spec/xml/object_spec.rb",
73
+ "spec/xml/parser_spec.rb",
74
+ "spec/xml/text_spec.rb",
75
+ "test/fixtures/book_malformed.xml",
76
+ "test/fixtures/book_pair.xml",
77
+ "test/fixtures/book_text_with_attribute.xml",
78
+ "test/fixtures/book_valid.xml",
79
+ "test/fixtures/book_with_authors.xml",
80
+ "test/fixtures/book_with_contributions.xml",
81
+ "test/fixtures/book_with_contributors.xml",
82
+ "test/fixtures/book_with_contributors_attrs.xml",
83
+ "test/fixtures/book_with_default_namespace.xml",
84
+ "test/fixtures/book_with_depth.xml",
85
+ "test/fixtures/book_with_octal_pages.xml",
86
+ "test/fixtures/book_with_publisher.xml",
87
+ "test/fixtures/book_with_wrapped_attr.xml",
88
+ "test/fixtures/dictionary_of_attr_name_clashes.xml",
89
+ "test/fixtures/dictionary_of_attrs.xml",
90
+ "test/fixtures/dictionary_of_guarded_names.xml",
91
+ "test/fixtures/dictionary_of_mixeds.xml",
92
+ "test/fixtures/dictionary_of_name_clashes.xml",
93
+ "test/fixtures/dictionary_of_names.xml",
94
+ "test/fixtures/dictionary_of_texts.xml",
95
+ "test/fixtures/library.xml",
96
+ "test/fixtures/library_uppercase.xml",
97
+ "test/fixtures/muffins.xml",
98
+ "test/fixtures/nameless_ageless_youth.xml",
99
+ "test/fixtures/node_with_attr_name_conflicts.xml",
100
+ "test/fixtures/node_with_name_conflicts.xml",
101
+ "test/fixtures/numerology.xml",
102
+ "test/fixtures/person.xml",
103
+ "test/fixtures/person_with_guarded_mothers.xml",
104
+ "test/fixtures/person_with_mothers.xml",
105
+ "test/load_test.rb",
106
+ "test/mocks/dictionaries.rb",
107
+ "test/mocks/mocks.rb",
108
+ "test/support/fixtures.rb",
109
+ "test/test_helper.rb",
110
+ "test/unit/definition_test.rb",
111
+ "test/unit/deprecations_test.rb",
112
+ "test/unit/to_xml_test.rb",
113
+ "test/unit/xml_attribute_test.rb",
114
+ "test/unit/xml_block_test.rb",
115
+ "test/unit/xml_bool_test.rb",
116
+ "test/unit/xml_convention_test.rb",
117
+ "test/unit/xml_hash_test.rb",
118
+ "test/unit/xml_initialize_test.rb",
119
+ "test/unit/xml_name_test.rb",
120
+ "test/unit/xml_namespace_test.rb",
121
+ "test/unit/xml_object_test.rb",
122
+ "test/unit/xml_required_test.rb",
123
+ "test/unit/xml_text_test.rb",
124
+ "website/index.html"
125
+ ]
126
+ s.homepage = %q{http://roxml.rubyforge.org}
127
+ s.rdoc_options = ["--charset=UTF-8"]
128
+ s.require_paths = ["lib"]
129
+ s.rubyforge_project = %q{roxml}
130
+ s.rubygems_version = %q{1.3.5}
131
+ s.summary = %q{Ruby Object to XML mapping library}
132
+ s.test_files = [
133
+ "spec/definition_spec.rb",
134
+ "spec/examples/active_record_spec.rb",
135
+ "spec/examples/amazon_spec.rb",
136
+ "spec/examples/current_weather_spec.rb",
137
+ "spec/examples/dashed_elements_spec.rb",
138
+ "spec/examples/library_spec.rb",
139
+ "spec/examples/post_spec.rb",
140
+ "spec/examples/twitter_spec.rb",
141
+ "spec/roxml_spec.rb",
142
+ "spec/shared_specs.rb",
143
+ "spec/spec_helper.rb",
144
+ "spec/support/libxml.rb",
145
+ "spec/support/nokogiri.rb",
146
+ "spec/xml/attributes_spec.rb",
147
+ "spec/xml/encoding_spec.rb",
148
+ "spec/xml/namespace_spec.rb",
149
+ "spec/xml/namespaces_spec.rb",
150
+ "spec/xml/object_spec.rb",
151
+ "spec/xml/parser_spec.rb",
152
+ "spec/xml/text_spec.rb",
153
+ "test/load_test.rb",
154
+ "test/mocks/dictionaries.rb",
155
+ "test/mocks/mocks.rb",
156
+ "test/support/fixtures.rb",
157
+ "test/test_helper.rb",
158
+ "test/unit/definition_test.rb",
159
+ "test/unit/deprecations_test.rb",
160
+ "test/unit/to_xml_test.rb",
161
+ "test/unit/xml_attribute_test.rb",
162
+ "test/unit/xml_block_test.rb",
163
+ "test/unit/xml_bool_test.rb",
164
+ "test/unit/xml_convention_test.rb",
165
+ "test/unit/xml_hash_test.rb",
166
+ "test/unit/xml_initialize_test.rb",
167
+ "test/unit/xml_name_test.rb",
168
+ "test/unit/xml_namespace_test.rb",
169
+ "test/unit/xml_object_test.rb",
170
+ "test/unit/xml_required_test.rb",
171
+ "test/unit/xml_text_test.rb",
172
+ "examples/amazon.rb",
173
+ "examples/current_weather.rb",
174
+ "examples/dashed_elements.rb",
175
+ "examples/library.rb",
176
+ "examples/posts.rb",
177
+ "examples/rails.rb",
178
+ "examples/twitter.rb"
179
+ ]
180
+
181
+ if s.respond_to? :specification_version then
182
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
183
+ s.specification_version = 3
184
+
185
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
186
+ s.add_runtime_dependency(%q<activesupport>, [">= 2.3.0"])
187
+ s.add_runtime_dependency(%q<nokogiri>, [">= 1.3.3"])
188
+ s.add_development_dependency(%q<rspec>, [">= 0"])
189
+ s.add_development_dependency(%q<sqlite3-ruby>, [">= 1.2.4"])
190
+ s.add_development_dependency(%q<activerecord>, [">= 2.2.2"])
191
+ else
192
+ s.add_dependency(%q<activesupport>, [">= 2.3.0"])
193
+ s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
194
+ s.add_dependency(%q<rspec>, [">= 0"])
195
+ s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.4"])
196
+ s.add_dependency(%q<activerecord>, [">= 2.2.2"])
197
+ end
198
+ else
199
+ s.add_dependency(%q<activesupport>, [">= 2.3.0"])
200
+ s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
201
+ s.add_dependency(%q<rspec>, [">= 0"])
202
+ s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.4"])
203
+ s.add_dependency(%q<activerecord>, [">= 2.2.2"])
204
+ end
205
+ end
206
+