xml_node_stream 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,14 +6,13 @@ desc 'Default: run unit tests.'
6
6
  task :default => :test
7
7
 
8
8
  begin
9
- require 'spec/rake/spectask'
10
- desc 'Test xml_node_stream.'
11
- Spec::Rake::SpecTask.new(:test) do |t|
12
- t.spec_files = 'spec/**/*_spec.rb'
13
- end
9
+ require 'rspec'
10
+ require 'rspec/core/rake_task'
11
+ desc 'Run the unit tests'
12
+ RSpec::Core::RakeTask.new(:test)
14
13
  rescue LoadError
15
- tast :test do
16
- STDERR.puts "You must have rspec >= 1.2.9 to run the tests"
14
+ task :test do
15
+ STDERR.puts "You must have rspec 2.0 installed to run the tests"
17
16
  end
18
17
  end
19
18
 
@@ -33,7 +32,10 @@ begin
33
32
  gem.email = "brian@embellishedvisions.com"
34
33
  gem.homepage = "http://github.com/bdurand/xml_node_stream"
35
34
  gem.authors = ["Brian Durand"]
36
- gem.add_development_dependency('rspec', '>= 1.2.9')
35
+ gem.files = FileList["lib/**/*", "spec/**/*", "README.rdoc", "Rakefile", "MIT_LICENSE"].to_a
36
+ gem.has_rdoc = true
37
+ gem.extra_rdoc_files = ["README.rdoc", "MIT_LICENSE"]
38
+ gem.add_development_dependency('rspec', '>=2.0.0')
37
39
  gem.add_development_dependency('jeweler')
38
40
  end
39
41
 
@@ -9,9 +9,9 @@ begin
9
9
  include Base
10
10
 
11
11
  def parse_stream (io)
12
- parser = LibXML::XML::SaxParser.new
12
+ context = LibXML::XML::Parser::Context.io(io)
13
+ parser = LibXML::XML::SaxParser.new(context)
13
14
  parser.callbacks = self
14
- parser.io = io
15
15
  parser.parse
16
16
  end
17
17
 
@@ -20,7 +20,15 @@ begin
20
20
 
21
21
  def start_element (name, attributes = [])
22
22
  attributes_hash = {}
23
- (attributes.size / 2).times{|i| attributes_hash[attributes[i * 2]] = attributes[(i * 2) + 1]}
23
+ if attributes.first.is_a?(Array)
24
+ # Newer style where attributes are passed as an array of arrays
25
+ attributes.each do |k, v|
26
+ attributes_hash[k] = v
27
+ end
28
+ else
29
+ # Old style where attributes are passed as a flat array
30
+ (attributes.size / 2).times{|i| attributes_hash[attributes[i * 2]] = attributes[(i * 2) + 1]}
31
+ end
24
32
  @parser.do_start_element(name, attributes_hash)
25
33
  end
26
34
 
@@ -1,3 +1,2 @@
1
1
  require 'rubygems'
2
- require 'spec'
3
2
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'xml_node_stream'))
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml_node_stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 2
10
+ version: 1.0.2
5
11
  platform: ruby
6
12
  authors:
7
13
  - Brian Durand
@@ -9,29 +15,39 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-02-07 00:00:00 -06:00
18
+ date: 2011-07-05 00:00:00 -05:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: rspec
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
23
- version: 1.2.9
24
- version:
29
+ hash: 15
30
+ segments:
31
+ - 2
32
+ - 0
33
+ - 0
34
+ version: 2.0.0
35
+ type: :development
36
+ version_requirements: *id001
25
37
  - !ruby/object:Gem::Dependency
26
38
  name: jeweler
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
30
42
  requirements:
31
43
  - - ">="
32
44
  - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
33
48
  version: "0"
34
- version:
49
+ type: :development
50
+ version_requirements: *id002
35
51
  description:
36
52
  email: brian@embellishedvisions.com
37
53
  executables: []
@@ -39,13 +55,12 @@ executables: []
39
55
  extensions: []
40
56
 
41
57
  extra_rdoc_files:
58
+ - MIT_LICENSE
42
59
  - README.rdoc
43
60
  files:
44
61
  - MIT_LICENSE
45
62
  - README.rdoc
46
63
  - Rakefile
47
- - VERSION
48
- - init.rb
49
64
  - lib/xml_node_stream.rb
50
65
  - lib/xml_node_stream/node.rb
51
66
  - lib/xml_node_stream/parser.rb
@@ -60,38 +75,39 @@ files:
60
75
  - spec/spec_helper.rb
61
76
  - spec/test.xml
62
77
  - spec/xml_node_stream_spec.rb
63
- - xml_node_stream.gemspec
64
78
  has_rdoc: true
65
79
  homepage: http://github.com/bdurand/xml_node_stream
66
80
  licenses: []
67
81
 
68
82
  post_install_message:
69
- rdoc_options:
70
- - --charset=UTF-8
83
+ rdoc_options: []
84
+
71
85
  require_paths:
72
86
  - lib
73
87
  required_ruby_version: !ruby/object:Gem::Requirement
88
+ none: false
74
89
  requirements:
75
90
  - - ">="
76
91
  - !ruby/object:Gem::Version
92
+ hash: 3
93
+ segments:
94
+ - 0
77
95
  version: "0"
78
- version:
79
96
  required_rubygems_version: !ruby/object:Gem::Requirement
97
+ none: false
80
98
  requirements:
81
99
  - - ">="
82
100
  - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
83
104
  version: "0"
84
- version:
85
105
  requirements: []
86
106
 
87
107
  rubyforge_project:
88
- rubygems_version: 1.3.5
108
+ rubygems_version: 1.5.2
89
109
  signing_key:
90
110
  specification_version: 3
91
111
  summary: Simple XML parser wrapper that provides the benefits of stream parsing with the ease of using document nodes.
92
- test_files:
93
- - spec/node_spec.rb
94
- - spec/parser_spec.rb
95
- - spec/selector_spec.rb
96
- - spec/spec_helper.rb
97
- - spec/xml_node_stream_spec.rb
112
+ test_files: []
113
+
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.0.0
data/init.rb DELETED
@@ -1 +0,0 @@
1
- require "#{File.dirname(__FILE__)}/lib/xml_node_stream"
@@ -1,68 +0,0 @@
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{xml_node_stream}
8
- s.version = "1.0.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Brian Durand"]
12
- s.date = %q{2010-02-07}
13
- s.email = %q{brian@embellishedvisions.com}
14
- s.extra_rdoc_files = [
15
- "README.rdoc"
16
- ]
17
- s.files = [
18
- "MIT_LICENSE",
19
- "README.rdoc",
20
- "Rakefile",
21
- "VERSION",
22
- "init.rb",
23
- "lib/xml_node_stream.rb",
24
- "lib/xml_node_stream/node.rb",
25
- "lib/xml_node_stream/parser.rb",
26
- "lib/xml_node_stream/parser/base.rb",
27
- "lib/xml_node_stream/parser/libxml_parser.rb",
28
- "lib/xml_node_stream/parser/nokogiri_parser.rb",
29
- "lib/xml_node_stream/parser/rexml_parser.rb",
30
- "lib/xml_node_stream/selector.rb",
31
- "spec/node_spec.rb",
32
- "spec/parser_spec.rb",
33
- "spec/selector_spec.rb",
34
- "spec/spec_helper.rb",
35
- "spec/test.xml",
36
- "spec/xml_node_stream_spec.rb",
37
- "xml_node_stream.gemspec"
38
- ]
39
- s.homepage = %q{http://github.com/bdurand/xml_node_stream}
40
- s.rdoc_options = ["--charset=UTF-8"]
41
- s.require_paths = ["lib"]
42
- s.rubygems_version = %q{1.3.5}
43
- s.summary = %q{Simple XML parser wrapper that provides the benefits of stream parsing with the ease of using document nodes.}
44
- s.test_files = [
45
- "spec/node_spec.rb",
46
- "spec/parser_spec.rb",
47
- "spec/selector_spec.rb",
48
- "spec/spec_helper.rb",
49
- "spec/xml_node_stream_spec.rb"
50
- ]
51
-
52
- if s.respond_to? :specification_version then
53
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
- s.specification_version = 3
55
-
56
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
57
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
58
- s.add_development_dependency(%q<jeweler>, [">= 0"])
59
- else
60
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
61
- s.add_dependency(%q<jeweler>, [">= 0"])
62
- end
63
- else
64
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
65
- s.add_dependency(%q<jeweler>, [">= 0"])
66
- end
67
- end
68
-