xpather 0.0.2 → 0.0.3

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.
@@ -4,4 +4,4 @@ find_header("libxml/tree.h", "/usr/include/libxml2")
4
4
  find_header("libxml/parser.h", "/usr/include/libxml2")
5
5
  find_header("libxml/xpath.h", "/usr/include/libxml2")
6
6
  find_header("libxml/xpathInternals.h", "/usr/include/libxml2")
7
- create_makefile('xpather')
7
+ create_makefile('xpather/xpather')
@@ -15,8 +15,6 @@ VALUE search(VALUE self, VALUE xpathExpr)
15
15
  {
16
16
  VALUE results = rb_ary_new();
17
17
  xmlDocPtr doc;
18
- Data_Get_Struct(self, xmlDoc, doc);
19
-
20
18
  xmlXPathContextPtr xpathCtx;
21
19
  xmlXPathObjectPtr xpathObj;
22
20
  xmlNodeSetPtr nodes;
@@ -24,6 +22,8 @@ VALUE search(VALUE self, VALUE xpathExpr)
24
22
  int size;
25
23
  int i;
26
24
 
25
+ Data_Get_Struct(self, xmlDoc, doc);
26
+
27
27
  xpathCtx = xmlXPathNewContext(doc);
28
28
  if (xpathCtx == NULL) {
29
29
  fprintf(stderr, "Error: unable to create new XPath context\n");
@@ -72,6 +72,7 @@ VALUE constructor(VALUE self, VALUE filename)
72
72
  {
73
73
  xmlDocPtr doc;
74
74
  VALUE argv[1];
75
+ VALUE t_data;
75
76
 
76
77
  doc = xmlParseFile(StringValueCStr(filename));
77
78
  if (doc == NULL) {
@@ -79,7 +80,7 @@ VALUE constructor(VALUE self, VALUE filename)
79
80
  return -1;
80
81
  }
81
82
 
82
- VALUE t_data = Data_Wrap_Struct(self, 0, xml_free, doc);
83
+ t_data = Data_Wrap_Struct(self, 0, xml_free, doc);
83
84
  argv[0] = filename;
84
85
  rb_obj_call_init(t_data, 1, argv);
85
86
  return t_data;
metadata CHANGED
@@ -1,76 +1,50 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: xpather
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
4
5
  prerelease:
5
- version: 0.0.2
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Aaron Bedra
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-09-06 00:00:00 -04:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: rake-compiler
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ~>
23
- - !ruby/object:Gem::Version
24
- version: 0.7.9
25
- type: :development
26
- version_requirements: *id001
12
+ date: 2012-01-22 00:00:00.000000000 Z
13
+ dependencies: []
27
14
  description: Quick and painless XPath searching for Ruby using libxml2
28
- email:
15
+ email:
29
16
  - aaron@aaronbedra.com
30
17
  executables: []
31
-
32
- extensions:
18
+ extensions:
33
19
  - ext/xpather/extconf.rb
34
20
  extra_rdoc_files: []
35
-
36
- files:
37
- - .gitignore
38
- - Gemfile
39
- - README.markdown
40
- - Rakefile
41
- - ext/xpather/extconf.rb
42
- - ext/xpather/xpather.c
21
+ files:
43
22
  - lib/xpather.rb
44
- - test/books.xml
45
- - test/xpather_test.rb
46
- has_rdoc: true
23
+ - ext/xpather/xpather.c
24
+ - ext/xpather/extconf.rb
47
25
  homepage: https://github.com/abedra/xpather
48
26
  licenses: []
49
-
50
27
  post_install_message:
51
28
  rdoc_options: []
52
-
53
- require_paths:
29
+ require_paths:
54
30
  - lib
55
31
  - ext
56
- required_ruby_version: !ruby/object:Gem::Requirement
32
+ required_ruby_version: !ruby/object:Gem::Requirement
57
33
  none: false
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: "0"
62
- required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
39
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
68
44
  requirements: []
69
-
70
45
  rubyforge_project: xpather
71
- rubygems_version: 1.6.2
46
+ rubygems_version: 1.8.15
72
47
  signing_key:
73
48
  specification_version: 3
74
49
  summary: Quick and painless XPath searching for Ruby
75
50
  test_files: []
76
-
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- pkg
2
- tmp
3
- lib/xpather.so
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source "http://rubygems.org"
2
- gemspec
data/README.markdown DELETED
@@ -1,8 +0,0 @@
1
- # XPather
2
-
3
- $ gem install xpather
4
- $ irb -rxpather
5
- >> document = XPather.new("test/books.xml")
6
- => #<XPather:test/books.xml>
7
- >> document.search("/bookstore/book[1]/author")
8
- => ["Giada De Laurentiis"]
data/Rakefile DELETED
@@ -1,36 +0,0 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/extensiontask'
4
-
5
- spec = Gem::Specification.new do |s|
6
- s.name = "xpather"
7
- s.version = "0.0.2"
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Aaron Bedra"]
10
- s.email = ["aaron@aaronbedra.com"]
11
- s.homepage = "https://github.com/abedra/xpather"
12
- s.summary = %q{Quick and painless XPath searching for Ruby}
13
- s.description = %q{Quick and painless XPath searching for Ruby using libxml2}
14
-
15
- s.rubyforge_project = "xpather"
16
-
17
- s.files = `git ls-files`.split("\n")
18
- s.test_files = `git ls-files -- {test}/*`.split("\n")
19
- s.require_paths = ["lib", "ext"]
20
- s.extensions = %w{ext/xpather/extconf.rb}
21
-
22
- s.add_development_dependency "rake-compiler", "~> 0.7.9"
23
- end
24
-
25
- Gem::PackageTask.new(spec) do |pkg|
26
- end
27
-
28
- Rake::ExtensionTask.new('xpather', spec)
29
-
30
- Rake::TestTask.new do |t|
31
- t.libs << "test"
32
- t.test_files = FileList['test/*_test.rb']
33
- t.verbose = true
34
- end
35
-
36
- task :default => ["compile", "test"]
data/test/books.xml DELETED
@@ -1,37 +0,0 @@
1
- <?xml version="1.0" encoding="ISO-8859-1"?>
2
-
3
- <bookstore>
4
-
5
- <book category="COOKING">
6
- <title lang="en">Everyday Italian</title>
7
- <author>Giada De Laurentiis</author>
8
- <year>2005</year>
9
- <price>30.00</price>
10
- </book>
11
-
12
- <book category="CHILDREN">
13
- <title lang="en">Harry Potter</title>
14
- <author>J K. Rowling</author>
15
- <year>2005</year>
16
- <price>29.99</price>
17
- </book>
18
-
19
- <book category="WEB">
20
- <title lang="en">XQuery Kick Start</title>
21
- <author>James McGovern</author>
22
- <author>Per Bothner</author>
23
- <author>Kurt Cagle</author>
24
- <author>James Linn</author>
25
- <author>Vaidyanathan Nagarajan</author>
26
- <year>2003</year>
27
- <price>49.99</price>
28
- </book>
29
-
30
- <book category="WEB">
31
- <title lang="en">Learning XML</title>
32
- <author>Erik T. Ray</author>
33
- <year>2003</year>
34
- <price>39.95</price>
35
- </book>
36
-
37
- </bookstore>
data/test/xpather_test.rb DELETED
@@ -1,17 +0,0 @@
1
- require 'minitest/autorun'
2
- require 'xpather/xpather'
3
-
4
- class TestXPather < MiniTest::Unit::TestCase
5
- def setup
6
- @document = XPather.new("test/books.xml")
7
- end
8
-
9
- def test_basic_search_one
10
- assert_equal "Giada De Laurentiis", @document.search("/bookstore/book[1]/author")
11
- end
12
-
13
- def test_basic_search_collection
14
- assert_equal ["James McGovern", "Per Bothner", "Kurt Cagle", "James Linn", "Vaidyanathan Nagarajan"],
15
- @document.search("/bookstore/book[3]/author")
16
- end
17
- end