om 1.8.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +1 -0
  4. data/.rubocop_todo.yml +382 -0
  5. data/.travis.yml +10 -0
  6. data/Rakefile +1 -1
  7. data/container_spec.rb +14 -14
  8. data/gemfiles/gemfile.rails3 +11 -0
  9. data/gemfiles/gemfile.rails4 +10 -0
  10. data/lib/om.rb +9 -12
  11. data/lib/om/samples/mods_article.rb +9 -9
  12. data/lib/om/tree_node.rb +6 -6
  13. data/lib/om/version.rb +1 -1
  14. data/lib/om/xml.rb +18 -20
  15. data/lib/om/xml/container.rb +12 -12
  16. data/lib/om/xml/document.rb +3 -7
  17. data/lib/om/xml/dynamic_node.rb +45 -50
  18. data/lib/om/xml/named_term_proxy.rb +13 -13
  19. data/lib/om/xml/node_generator.rb +3 -3
  20. data/lib/om/xml/template_registry.rb +18 -26
  21. data/lib/om/xml/term.rb +30 -46
  22. data/lib/om/xml/term_value_operators.rb +52 -56
  23. data/lib/om/xml/term_xpath_generator.rb +51 -57
  24. data/lib/om/xml/terminology.rb +8 -10
  25. data/lib/om/xml/validation.rb +19 -19
  26. data/lib/om/xml/vocabulary.rb +4 -4
  27. data/lib/tasks/om.rake +4 -6
  28. data/om.gemspec +1 -2
  29. data/spec/integration/differentiated_elements_spec.rb +2 -2
  30. data/spec/integration/element_value_spec.rb +13 -13
  31. data/spec/integration/proxies_and_ref_spec.rb +15 -15
  32. data/spec/integration/querying_documents_spec.rb +24 -18
  33. data/spec/integration/rights_metadata_integration_example_spec.rb +18 -18
  34. data/spec/integration/selective_querying_spec.rb +1 -1
  35. data/spec/integration/serialization_spec.rb +13 -13
  36. data/spec/integration/set_reentrant_terminology_spec.rb +7 -7
  37. data/spec/integration/xpathy_stuff_spec.rb +16 -16
  38. data/spec/spec_helper.rb +2 -3
  39. data/spec/unit/container_spec.rb +28 -29
  40. data/spec/unit/document_spec.rb +49 -50
  41. data/spec/unit/dynamic_node_spec.rb +55 -47
  42. data/spec/unit/named_term_proxy_spec.rb +16 -16
  43. data/spec/unit/node_generator_spec.rb +7 -7
  44. data/spec/unit/nokogiri_sanity_spec.rb +30 -30
  45. data/spec/unit/om_spec.rb +5 -5
  46. data/spec/unit/template_registry_spec.rb +69 -69
  47. data/spec/unit/term_builder_spec.rb +77 -77
  48. data/spec/unit/term_spec.rb +78 -72
  49. data/spec/unit/term_value_operators_spec.rb +186 -191
  50. data/spec/unit/term_xpath_generator_spec.rb +37 -43
  51. data/spec/unit/terminology_builder_spec.rb +85 -85
  52. data/spec/unit/terminology_spec.rb +98 -98
  53. data/spec/unit/validation_spec.rb +22 -22
  54. data/spec/unit/xml_serialization_spec.rb +21 -22
  55. data/spec/unit/xml_spec.rb +7 -7
  56. metadata +143 -147
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 52ebc8b2d68d863abfa09f53fc85eaf8532a1477
4
+ data.tar.gz: 8fd296c2961d0b928f4a7953bb4f53e00f32a3a5
5
+ SHA512:
6
+ metadata.gz: 76fdce7b361de92c027f3a1f486a2e0b987fc632badfb17c70dc23f0db82ccf965ec23ae0541caedca276a537bc5735f44fd370037dd44143fb49ba77d29787d
7
+ data.tar.gz: f7d2f34732962c1521e3486ece5bd16d64806963667bce21bf9bf635fbe13a1f2a43b3b55f151d67df5cff6286355bd5e6335d30b4bf0d834bc12061d18bfe28
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1 @@
1
+ inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,382 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2015-07-22 19:29:47 -0700 using RuboCop version 0.32.1.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 2
9
+ # Configuration parameters: AllowSafeAssignment.
10
+ Lint/AssignmentInCondition:
11
+ Enabled: false
12
+
13
+ # Offense count: 9
14
+ # Cop supports --auto-correct.
15
+ Lint/BlockAlignment:
16
+ Enabled: false
17
+
18
+ # Offense count: 7
19
+ Lint/Eval:
20
+ Enabled: false
21
+
22
+ # Offense count: 1
23
+ Lint/NonLocalExitFromIterator:
24
+ Enabled: false
25
+
26
+ # Offense count: 2
27
+ Lint/ParenthesesAsGroupedExpression:
28
+ Enabled: false
29
+
30
+ # Offense count: 2
31
+ Lint/RescueException:
32
+ Enabled: false
33
+
34
+ # Offense count: 6
35
+ # Cop supports --auto-correct.
36
+ Lint/StringConversionInInterpolation:
37
+ Enabled: false
38
+
39
+ # Offense count: 10
40
+ # Cop supports --auto-correct.
41
+ Lint/UnusedBlockArgument:
42
+ Enabled: false
43
+
44
+ # Offense count: 10
45
+ # Cop supports --auto-correct.
46
+ Lint/UnusedMethodArgument:
47
+ Enabled: false
48
+
49
+ # Offense count: 23
50
+ Lint/UselessAssignment:
51
+ Enabled: false
52
+
53
+ # Offense count: 2
54
+ Lint/UselessSetterCall:
55
+ Enabled: false
56
+
57
+ # Offense count: 2
58
+ Lint/Void:
59
+ Enabled: false
60
+
61
+ # Offense count: 25
62
+ Metrics/AbcSize:
63
+ Max: 73
64
+
65
+ # Offense count: 3
66
+ # Configuration parameters: CountComments.
67
+ Metrics/ClassLength:
68
+ Max: 187
69
+
70
+ # Offense count: 9
71
+ Metrics/CyclomaticComplexity:
72
+ Max: 20
73
+
74
+ # Offense count: 878
75
+ # Configuration parameters: AllowURI, URISchemes.
76
+ Metrics/LineLength:
77
+ Max: 494
78
+
79
+ # Offense count: 34
80
+ # Configuration parameters: CountComments.
81
+ Metrics/MethodLength:
82
+ Max: 77
83
+
84
+ # Offense count: 2
85
+ # Configuration parameters: CountComments.
86
+ Metrics/ModuleLength:
87
+ Max: 189
88
+
89
+ # Offense count: 1
90
+ # Configuration parameters: CountKeywordArgs.
91
+ Metrics/ParameterLists:
92
+ Max: 6
93
+
94
+ # Offense count: 7
95
+ Metrics/PerceivedComplexity:
96
+ Max: 24
97
+
98
+ # Offense count: 2
99
+ Style/AccessorMethodName:
100
+ Enabled: false
101
+
102
+
103
+ # Offense count: 1
104
+ Style/AsciiComments:
105
+ Enabled: false
106
+
107
+ # Offense count: 1
108
+ # Cop supports --auto-correct.
109
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
110
+ Style/BarePercentLiterals:
111
+ Enabled: false
112
+
113
+ # Offense count: 68
114
+ # Cop supports --auto-correct.
115
+ # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
116
+ Style/BlockDelimiters:
117
+ Enabled: false
118
+
119
+ # Offense count: 69
120
+ # Cop supports --auto-correct.
121
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
122
+ Style/BracesAroundHashParameters:
123
+ Enabled: false
124
+
125
+ # Offense count: 17
126
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
127
+ Style/ClassAndModuleChildren:
128
+ Enabled: false
129
+
130
+ # Offense count: 28
131
+ # Cop supports --auto-correct.
132
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
133
+ Style/ClassCheck:
134
+ Enabled: false
135
+
136
+ # Offense count: 5
137
+ # Cop supports --auto-correct.
138
+ Style/ClosingParenthesisIndentation:
139
+ Enabled: false
140
+
141
+ # Offense count: 4
142
+ # Cop supports --auto-correct.
143
+ # Configuration parameters: Keywords.
144
+ Style/CommentAnnotation:
145
+ Enabled: false
146
+
147
+ # Offense count: 5
148
+ # Cop supports --auto-correct.
149
+ Style/CommentIndentation:
150
+ Enabled: false
151
+
152
+ # Offense count: 1
153
+ # Cop supports --auto-correct.
154
+ Style/DefWithParentheses:
155
+ Enabled: false
156
+
157
+ # Offense count: 6
158
+ # Cop supports --auto-correct.
159
+ Style/DeprecatedHashMethods:
160
+ Enabled: false
161
+
162
+ # Offense count: 44
163
+ Style/Documentation:
164
+ Enabled: false
165
+
166
+ # Offense count: 29
167
+ # Cop supports --auto-correct.
168
+ Style/EmptyLines:
169
+ Enabled: false
170
+
171
+ # Offense count: 1
172
+ # Cop supports --auto-correct.
173
+ Style/EmptyLinesAroundAccessModifier:
174
+ Enabled: false
175
+
176
+ # Offense count: 63
177
+ # Cop supports --auto-correct.
178
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
179
+ Style/EmptyLinesAroundBlockBody:
180
+ Enabled: false
181
+
182
+ # Offense count: 15
183
+ # Cop supports --auto-correct.
184
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
185
+ Style/EmptyLinesAroundClassBody:
186
+ Enabled: false
187
+
188
+ # Offense count: 3
189
+ # Cop supports --auto-correct.
190
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
191
+ Style/EmptyLinesAroundModuleBody:
192
+ Enabled: false
193
+
194
+ # Offense count: 5
195
+ # Cop supports --auto-correct.
196
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
197
+ Style/FirstParameterIndentation:
198
+ Enabled: false
199
+
200
+ # Offense count: 839
201
+ # Cop supports --auto-correct.
202
+ # Configuration parameters: SupportedStyles, UseHashRocketsWithSymbolValues.
203
+ Style/HashSyntax:
204
+ EnforcedStyle: hash_rockets
205
+
206
+ # Offense count: 31
207
+ # Cop supports --auto-correct.
208
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
209
+ Style/IndentationConsistency:
210
+ Enabled: false
211
+
212
+ # Offense count: 24
213
+ # Cop supports --auto-correct.
214
+ # Configuration parameters: Width.
215
+ Style/IndentationWidth:
216
+ Enabled: false
217
+
218
+ # Offense count: 3
219
+ # Cop supports --auto-correct.
220
+ Style/MethodCallParentheses:
221
+ Enabled: false
222
+
223
+ # Offense count: 11
224
+ # Cop supports --auto-correct.
225
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
226
+ Style/MethodDefParentheses:
227
+ Enabled: false
228
+
229
+ # Offense count: 5
230
+ # Cop supports --auto-correct.
231
+ # Configuration parameters: AllowSafeAssignment.
232
+ Style/ParenthesesAroundCondition:
233
+ Enabled: false
234
+
235
+ # Offense count: 7
236
+ # Cop supports --auto-correct.
237
+ # Configuration parameters: PreferredDelimiters.
238
+ Style/PercentLiteralDelimiters:
239
+ Enabled: false
240
+
241
+ # Offense count: 2
242
+ # Cop supports --auto-correct.
243
+ Style/PerlBackrefs:
244
+ Enabled: false
245
+
246
+ # Offense count: 4
247
+ # Configuration parameters: NamePrefix, NamePrefixBlacklist.
248
+ Style/PredicateName:
249
+ Enabled: false
250
+
251
+ # Offense count: 45
252
+ # Cop supports --auto-correct.
253
+ Style/RedundantSelf:
254
+ Enabled: false
255
+
256
+ # Offense count: 2
257
+ # Cop supports --auto-correct.
258
+ # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
259
+ Style/RegexpLiteral:
260
+ Enabled: false
261
+
262
+ # Offense count: 15
263
+ # Cop supports --auto-correct.
264
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
265
+ Style/SignalException:
266
+ Enabled: false
267
+
268
+ # Offense count: 9
269
+ # Cop supports --auto-correct.
270
+ Style/SingleSpaceBeforeFirstArg:
271
+ Enabled: false
272
+
273
+ # Offense count: 128
274
+ # Cop supports --auto-correct.
275
+ Style/SpaceAfterComma:
276
+ Enabled: false
277
+
278
+ # Offense count: 3
279
+ # Cop supports --auto-correct.
280
+ Style/SpaceAfterMethodName:
281
+ Enabled: false
282
+
283
+ # Offense count: 1
284
+ # Cop supports --auto-correct.
285
+ Style/SpaceAfterSemicolon:
286
+ Enabled: false
287
+
288
+ # Offense count: 22
289
+ # Cop supports --auto-correct.
290
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
291
+ Style/SpaceAroundEqualsInParameterDefault:
292
+ Enabled: false
293
+
294
+ # Offense count: 946
295
+ # Cop supports --auto-correct.
296
+ # Configuration parameters: MultiSpaceAllowedForOperators.
297
+ Style/SpaceAroundOperators:
298
+ Enabled: false
299
+
300
+ # Offense count: 2
301
+ # Cop supports --auto-correct.
302
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
303
+ Style/SpaceBeforeBlockBraces:
304
+ Enabled: false
305
+
306
+ # Offense count: 5
307
+ # Cop supports --auto-correct.
308
+ Style/SpaceBeforeComma:
309
+ Enabled: false
310
+
311
+ # Offense count: 35
312
+ # Cop supports --auto-correct.
313
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
314
+ Style/SpaceInsideBlockBraces:
315
+ Enabled: false
316
+
317
+ # Offense count: 24
318
+ # Cop supports --auto-correct.
319
+ Style/SpaceInsideBrackets:
320
+ Enabled: false
321
+
322
+ # Offense count: 749
323
+ # Cop supports --auto-correct.
324
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
325
+ Style/SpaceInsideHashLiteralBraces:
326
+ Enabled: false
327
+
328
+ # Offense count: 185
329
+ # Cop supports --auto-correct.
330
+ Style/SpaceInsideParens:
331
+ Enabled: false
332
+
333
+ # Offense count: 1
334
+ # Cop supports --auto-correct.
335
+ Style/SpecialGlobalVars:
336
+ Enabled: false
337
+
338
+ # Offense count: 1620
339
+ # Cop supports --auto-correct.
340
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
341
+ Style/StringLiterals:
342
+ Enabled: false
343
+
344
+ # Offense count: 1
345
+ # Cop supports --auto-correct.
346
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
347
+ Style/StringLiteralsInInterpolation:
348
+ Enabled: false
349
+
350
+ # Offense count: 7
351
+ # Cop supports --auto-correct.
352
+ # Configuration parameters: IgnoredMethods.
353
+ Style/SymbolProc:
354
+ Enabled: false
355
+
356
+ # Offense count: 42
357
+ # Cop supports --auto-correct.
358
+ Style/Tab:
359
+ Enabled: false
360
+
361
+ # Offense count: 8
362
+ # Cop supports --auto-correct.
363
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
364
+ Style/TrailingBlankLines:
365
+ Enabled: false
366
+
367
+ # Offense count: 2
368
+ # Cop supports --auto-correct.
369
+ # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
370
+ Style/TrailingComma:
371
+ Enabled: false
372
+
373
+ # Offense count: 8
374
+ # Cop supports --auto-correct.
375
+ Style/UnneededPercentQ:
376
+ Enabled: false
377
+
378
+ # Offense count: 30
379
+ # Cop supports --auto-correct.
380
+ # Configuration parameters: WordRegex.
381
+ Style/WordArray:
382
+ MinSize: 4
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ rvm:
2
+ - 1.9.3
3
+ - 2.0.0
4
+
5
+ gemfile:
6
+ - gemfiles/gemfile.rails3
7
+ - gemfiles/gemfile.rails4
8
+
9
+ notifications:
10
+ irc: "irc.freenode.org#projecthydra"
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ task :default => :spec
13
13
 
14
14
  require 'rdoc/task'
15
15
  Rake::RDocTask.new do |rdoc|
16
- version = Om::VERSION
16
+ version = Om::VERSION
17
17
 
18
18
  rdoc.rdoc_dir = 'rdoc'
19
19
  rdoc.title = "om #{version}"
data/container_spec.rb CHANGED
@@ -3,34 +3,34 @@ require "nokogiri"
3
3
  require "om"
4
4
 
5
5
  describe "OM::XML::Container" do
6
-
6
+
7
7
  before(:all) do
8
8
  class ContainerTest
9
9
  include OM::XML::Container
10
10
  end
11
11
  end
12
-
12
+
13
13
  before(:each) do
14
14
  @container = ContainerTest.from_xml("<foo><bar>1</bar></foo>")
15
15
  end
16
-
16
+
17
17
  it "should add .ng_xml accessor" do
18
18
  @container.should respond_to(:ng_xml)
19
- @container.should respond_to(:ng_xml=)
19
+ @container.should respond_to(:ng_xml=)
20
20
  end
21
-
21
+
22
22
  describe "new" do
23
23
  it "should populate ng_xml with an instance of Nokogiri::XML::Document" do
24
24
  @container.ng_xml.class.should == Nokogiri::XML::Document
25
25
  end
26
26
  end
27
-
27
+
28
28
  describe '#xml_template' do
29
29
  it "should return an empty xml document" do
30
30
  ContainerTest.xml_template.to_xml.should == "<?xml version=\"1.0\"?>\n"
31
31
  end
32
32
  end
33
-
33
+
34
34
  describe "#from_xml" do
35
35
  it "should accept a String, parse it and store it in .ng_xml" do
36
36
  Nokogiri::XML::Document.expects(:parse).returns("parsed xml")
@@ -53,36 +53,36 @@ describe "OM::XML::Container" do
53
53
  ContainerTest.from_xml.ng_xml.should == "fake template"
54
54
  end
55
55
  end
56
-
56
+
57
57
  describe ".to_xml" do
58
58
  it "should call .ng_xml.to_xml" do
59
59
  @container.ng_xml.expects(:to_xml).returns("ng xml")
60
60
  @container.to_xml.should == "ng xml"
61
61
  end
62
-
62
+
63
63
  it 'should accept an optional Nokogiri::XML Document as an argument and insert its fields into that (mocked test)' do
64
64
  doc = Nokogiri::XML::Document.parse("<test_xml/>")
65
65
  mock_new_node = mock("new node")
66
66
  doc.root.expects(:add_child).with(@container.ng_xml.root).returns(mock_new_node)
67
67
  result = @container.to_xml(doc)
68
68
  end
69
-
69
+
70
70
  it 'should accept an optional Nokogiri::XML Document as an argument and insert its fields into that (functional test)' do
71
71
  doc = Nokogiri::XML::Document.parse("<test_xml/>")
72
72
  @container.to_xml(doc).should == "<?xml version=\"1.0\"?>\n<test_xml>\n <foo>\n <bar>1</bar>\n </foo>\n</test_xml>\n"
73
73
  end
74
-
74
+
75
75
  it 'should add to root of Nokogiri::XML::Documents, but add directly to the elements if a Nokogiri::XML::Node is passed in' do
76
76
  mock_new_node = mock("new node")
77
77
  mock_new_node.stubs(:to_xml).returns("foo")
78
-
78
+
79
79
  doc = Nokogiri::XML::Document.parse("<test_document/>")
80
80
  el = Nokogiri::XML::Node.new("test_element", Nokogiri::XML::Document.new)
81
81
  doc.root.expects(:add_child).with(@container.ng_xml.root).returns(mock_new_node)
82
82
  el.expects(:add_child).with(@container.ng_xml.root).returns(mock_new_node)
83
- @container.to_xml(doc).should
83
+ @container.to_xml(doc).should
84
84
  @container.to_xml(el)
85
85
  end
86
86
  end
87
-
87
+
88
88
  end