saxerator 0.9.5 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.travis.yml +9 -12
  4. data/Gemfile +4 -2
  5. data/README.md +23 -3
  6. data/Rakefile +12 -1
  7. data/benchmark/benchmark.rb +54 -12
  8. data/benchmark/generate_sample_file.rb +1 -1
  9. data/lib/saxerator.rb +2 -3
  10. data/lib/saxerator/adapters/nokogiri.rb +39 -0
  11. data/lib/saxerator/adapters/ox.rb +69 -0
  12. data/lib/saxerator/adapters/rexml.rb +42 -0
  13. data/lib/saxerator/builder.rb +2 -2
  14. data/lib/saxerator/builder/array_element.rb +8 -2
  15. data/lib/saxerator/builder/empty_element.rb +2 -3
  16. data/lib/saxerator/builder/hash_builder.rb +8 -7
  17. data/lib/saxerator/builder/hash_element.rb +7 -8
  18. data/lib/saxerator/builder/string_element.rb +5 -7
  19. data/lib/saxerator/builder/xml_builder.rb +11 -7
  20. data/lib/saxerator/configuration.rb +27 -7
  21. data/lib/saxerator/document_fragment.rb +3 -5
  22. data/lib/saxerator/dsl.rb +6 -5
  23. data/lib/saxerator/full_document.rb +1 -1
  24. data/lib/saxerator/latches/abstract_latch.rb +1 -1
  25. data/lib/saxerator/latches/at_depth.rb +2 -2
  26. data/lib/saxerator/latches/child_of.rb +9 -14
  27. data/lib/saxerator/latches/for_tags.rb +2 -2
  28. data/lib/saxerator/latches/with_attributes.rb +2 -2
  29. data/lib/saxerator/latches/within.rb +6 -10
  30. data/lib/saxerator/parser/accumulator.rb +6 -9
  31. data/lib/saxerator/parser/latched_accumulator.rb +4 -49
  32. data/lib/saxerator/sax_handler.rb +9 -0
  33. data/lib/saxerator/version.rb +1 -1
  34. data/saxerator.gemspec +5 -2
  35. data/spec/lib/builder/hash_builder_spec.rb +25 -19
  36. data/spec/lib/builder/xml_builder_spec.rb +7 -26
  37. data/spec/lib/dsl/all_spec.rb +11 -6
  38. data/spec/lib/dsl/at_depth_spec.rb +10 -8
  39. data/spec/lib/dsl/child_of_spec.rb +6 -6
  40. data/spec/lib/dsl/for_tag_spec.rb +3 -3
  41. data/spec/lib/dsl/for_tags_spec.rb +5 -5
  42. data/spec/lib/dsl/with_attribute_spec.rb +4 -4
  43. data/spec/lib/dsl/with_attributes_spec.rb +8 -7
  44. data/spec/lib/dsl/within_spec.rb +6 -5
  45. data/spec/lib/saxerator_spec.rb +70 -58
  46. data/spec/spec_helper.rb +24 -3
  47. data/spec/support/fixture_file.rb +1 -1
  48. metadata +39 -5
@@ -1,14 +1,35 @@
1
1
  if ENV['COVERAGE']
2
2
  require 'simplecov'
3
3
  SimpleCov.start do
4
- add_filter "spec/"
4
+ add_filter 'spec/'
5
5
  end
6
6
  end
7
7
 
8
- Dir['./spec/support/**/*.rb'].each { |f| require f }
8
+ require 'support/fixture_file'
9
9
 
10
10
  RSpec.configure do |config|
11
+ config.example_status_persistence_file_path = 'spec/examples.txt'
11
12
  config.include FixtureFile
13
+
14
+ adapter = ENV['SAXERATOR_ADAPTER']
15
+
16
+ config.before(:suite) do |_|
17
+ unless adapter
18
+ puts 'SAXERATOR_ADAPTER weren\'t defined'
19
+ next
20
+ end
21
+ puts "Using '#{adapter}' for parsing"
22
+ end
23
+
24
+ config.before do |example|
25
+ if adapter && !example.metadata[:nokogiri_only]
26
+ require 'saxerator/configuration'
27
+ require "saxerator/adapters/#{adapter}"
28
+ adapter_class = Saxerator::Adapters.const_get(adapter.capitalize, false)
29
+
30
+ allow_any_instance_of(Saxerator::Configuration).to receive(:adapter) { adapter_class }
31
+ end
32
+ end
12
33
  end
13
34
 
14
- require 'saxerator'
35
+ require 'saxerator'
@@ -2,4 +2,4 @@ module FixtureFile
2
2
  def fixture_file(name)
3
3
  File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', name))
4
4
  end
5
- end
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saxerator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bradley Schaefer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-05 00:00:00.000000000 Z
11
+ date: 2017-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -17,13 +17,41 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.4.0
20
- type: :runtime
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.4.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: ox
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rspec
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -56,6 +84,9 @@ files:
56
84
  - benchmark/benchmark.rb
57
85
  - benchmark/generate_sample_file.rb
58
86
  - lib/saxerator.rb
87
+ - lib/saxerator/adapters/nokogiri.rb
88
+ - lib/saxerator/adapters/ox.rb
89
+ - lib/saxerator/adapters/rexml.rb
59
90
  - lib/saxerator/builder.rb
60
91
  - lib/saxerator/builder/array_element.rb
61
92
  - lib/saxerator/builder/empty_element.rb
@@ -75,8 +106,10 @@ files:
75
106
  - lib/saxerator/latches/within.rb
76
107
  - lib/saxerator/parser/accumulator.rb
77
108
  - lib/saxerator/parser/latched_accumulator.rb
109
+ - lib/saxerator/sax_handler.rb
78
110
  - lib/saxerator/version.rb
79
111
  - saxerator.gemspec
112
+ - spec/examples.txt
80
113
  - spec/fixtures/flat_blurbs.xml
81
114
  - spec/fixtures/nested_elements.xml
82
115
  - spec/lib/builder/hash_builder_spec.rb
@@ -104,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
137
  requirements:
105
138
  - - ">="
106
139
  - !ruby/object:Gem::Version
107
- version: '0'
140
+ version: 2.1.0
108
141
  required_rubygems_version: !ruby/object:Gem::Requirement
109
142
  requirements:
110
143
  - - ">="
@@ -112,11 +145,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
145
  version: '0'
113
146
  requirements: []
114
147
  rubyforge_project: saxerator
115
- rubygems_version: 2.2.2
148
+ rubygems_version: 2.6.8
116
149
  signing_key:
117
150
  specification_version: 4
118
151
  summary: A SAX-based XML-to-hash parser for parsing large files into manageable chunks
119
152
  test_files:
153
+ - spec/examples.txt
120
154
  - spec/fixtures/flat_blurbs.xml
121
155
  - spec/fixtures/nested_elements.xml
122
156
  - spec/lib/builder/hash_builder_spec.rb