nokogiri 1.4.1-java → 1.4.2-java
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- data/CHANGELOG.ja.rdoc +45 -0
- data/CHANGELOG.rdoc +53 -1
- data/Manifest.txt +3 -3
- data/README.ja.rdoc +1 -1
- data/README.rdoc +11 -5
- data/Rakefile +13 -79
- data/ext/nokogiri/extconf.rb +22 -74
- data/ext/nokogiri/html_document.c +17 -8
- data/ext/nokogiri/html_element_description.c +20 -16
- data/ext/nokogiri/html_entity_lookup.c +2 -2
- data/ext/nokogiri/html_sax_parser_context.c +10 -8
- data/ext/nokogiri/libcharset-1.dll +0 -0
- data/ext/nokogiri/libexslt.dll +0 -0
- data/ext/nokogiri/libiconv-2.dll +0 -0
- data/ext/nokogiri/libxml2.dll +0 -0
- data/ext/nokogiri/libxslt.dll +0 -0
- data/ext/nokogiri/nokogiri.c +0 -1
- data/ext/nokogiri/nokogiri.h +33 -28
- data/ext/nokogiri/xml_attr.c +7 -5
- data/ext/nokogiri/xml_attribute_decl.c +5 -2
- data/ext/nokogiri/xml_cdata.c +4 -2
- data/ext/nokogiri/xml_comment.c +4 -2
- data/ext/nokogiri/xml_document.c +93 -15
- data/ext/nokogiri/xml_document.h +0 -1
- data/ext/nokogiri/xml_document_fragment.c +4 -2
- data/ext/nokogiri/xml_dtd.c +18 -8
- data/ext/nokogiri/xml_element_content.c +2 -2
- data/ext/nokogiri/xml_entity_decl.c +15 -2
- data/ext/nokogiri/xml_entity_reference.c +4 -2
- data/ext/nokogiri/xml_io.c +1 -1
- data/ext/nokogiri/xml_namespace.c +5 -3
- data/ext/nokogiri/xml_node.c +353 -114
- data/ext/nokogiri/xml_node_set.c +35 -22
- data/ext/nokogiri/xml_node_set.h +1 -1
- data/ext/nokogiri/xml_processing_instruction.c +4 -2
- data/ext/nokogiri/xml_reader.c +119 -47
- data/ext/nokogiri/xml_relax_ng.c +21 -12
- data/ext/nokogiri/xml_sax_parser.c +6 -3
- data/ext/nokogiri/xml_sax_parser.h +13 -17
- data/ext/nokogiri/xml_sax_parser_context.c +8 -6
- data/ext/nokogiri/xml_sax_push_parser.c +7 -6
- data/ext/nokogiri/xml_schema.c +62 -13
- data/ext/nokogiri/xml_syntax_error.c +18 -12
- data/ext/nokogiri/xml_syntax_error.h +1 -1
- data/ext/nokogiri/xml_text.c +4 -2
- data/ext/nokogiri/xml_xpath_context.c +60 -23
- data/ext/nokogiri/xslt_stylesheet.c +14 -3
- data/ext/nokogiri/zlib1.dll +0 -0
- data/lib/nokogiri.rb +17 -0
- data/lib/nokogiri/css/generated_parser.rb +72 -62
- data/lib/nokogiri/css/generated_tokenizer.rb +23 -24
- data/lib/nokogiri/css/parser.y +3 -1
- data/lib/nokogiri/css/tokenizer.rex +3 -3
- data/lib/nokogiri/css/xpath_visitor.rb +8 -3
- data/lib/nokogiri/ffi/html/sax/parser_context.rb +3 -3
- data/lib/nokogiri/ffi/libxml.rb +16 -2
- data/lib/nokogiri/ffi/structs/common_node.rb +15 -3
- data/lib/nokogiri/ffi/structs/xml_document.rb +13 -4
- data/lib/nokogiri/ffi/structs/xml_xpath_context.rb +3 -2
- data/lib/nokogiri/ffi/weak_bucket.rb +40 -0
- data/lib/nokogiri/ffi/xml/document.rb +27 -0
- data/lib/nokogiri/ffi/xml/entity_decl.rb +9 -0
- data/lib/nokogiri/ffi/xml/node.rb +142 -61
- data/lib/nokogiri/ffi/xml/node_set.rb +15 -12
- data/lib/nokogiri/ffi/xml/reader.rb +5 -0
- data/lib/nokogiri/ffi/xml/schema.rb +17 -0
- data/lib/nokogiri/ffi/xml/syntax_error.rb +4 -4
- data/lib/nokogiri/ffi/xml/xpath.rb +0 -10
- data/lib/nokogiri/ffi/xml/xpath_context.rb +22 -9
- data/lib/nokogiri/ffi/xslt/stylesheet.rb +3 -0
- data/lib/nokogiri/html/document.rb +5 -3
- data/lib/nokogiri/html/document_fragment.rb +28 -7
- data/lib/nokogiri/nokogiri.rb +1 -0
- data/lib/nokogiri/version.rb +6 -2
- data/lib/nokogiri/version_warning.rb +6 -3
- data/lib/nokogiri/xml.rb +1 -1
- data/lib/nokogiri/xml/builder.rb +35 -22
- data/lib/nokogiri/xml/document.rb +44 -12
- data/lib/nokogiri/xml/document_fragment.rb +16 -12
- data/lib/nokogiri/xml/entity_decl.rb +4 -0
- data/lib/nokogiri/xml/node.rb +152 -95
- data/lib/nokogiri/xml/node_set.rb +2 -1
- data/lib/nokogiri/xml/sax/push_parser.rb +1 -1
- data/lib/nokogiri/xml/schema.rb +1 -5
- data/lib/nokogiri/xml/syntax_error.rb +4 -0
- data/lib/nokogiri/xml/text.rb +9 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +3 -0
- data/tasks/cross_compile.rb +157 -0
- data/tasks/test.rb +0 -6
- data/test/css/test_xpath_visitor.rb +9 -0
- data/test/helper.rb +49 -11
- data/test/html/sax/test_parser.rb +11 -1
- data/test/html/test_document.rb +8 -0
- data/test/html/test_document_fragment.rb +14 -2
- data/test/html/test_element_description.rb +5 -1
- data/test/html/test_node.rb +5 -66
- data/test/test_reader.rb +28 -0
- data/test/test_xslt_transforms.rb +14 -0
- data/test/xml/test_builder.rb +43 -0
- data/test/xml/test_cdata.rb +12 -0
- data/test/xml/test_document.rb +74 -39
- data/test/xml/test_document_fragment.rb +36 -0
- data/test/xml/test_entity_decl.rb +37 -0
- data/test/xml/test_node.rb +192 -65
- data/test/xml/test_node_reparenting.rb +253 -236
- data/test/xml/test_node_set.rb +67 -0
- data/test/xml/test_text.rb +8 -0
- data/test/xml/test_xpath.rb +32 -0
- metadata +119 -48
- data.tar.gz.sig +0 -0
- data/ext/nokogiri/iconv.dll +0 -0
- data/ext/nokogiri/xml_xpath.c +0 -53
- data/ext/nokogiri/xml_xpath.h +0 -11
- data/lib/nokogiri/xml/fragment_handler.rb +0 -79
- metadata.gz.sig +0 -0
data/CHANGELOG.ja.rdoc
CHANGED
@@ -1,3 +1,48 @@
|
|
1
|
+
=== 1.4.2
|
2
|
+
|
3
|
+
* 新しい機能
|
4
|
+
|
5
|
+
* XML::Node#parse 定義されたコンテキストノードで、XML 又はHTMLのフレグメント
|
6
|
+
を解析する
|
7
|
+
* XML::Node#namespacesが子ノードとその祖先ノード内で定義された全ての名前空間
|
8
|
+
を返すようになった(以前は祖先ノードの名前空間は返されなかった)
|
9
|
+
* XML::Node内にEnumerableを追加
|
10
|
+
* Nokogiri::XML::Schema#validate 与えられたファイル名が引き渡された時、
|
11
|
+
Nokogiri::XML::Schema#validateはxmlSchemaValidateFileを使用する
|
12
|
+
(時間短縮化とメモリーの能率化の理由を基にファイル名での引き渡しメソッドを
|
13
|
+
採用) GH #219
|
14
|
+
* XML::Document#create_entnty は新規のEntityDecl のオブジェクトを生成する
|
15
|
+
GH #174
|
16
|
+
* JRuby FFI implementationでは、従来まで使用されたObjectSpace._id2refの代わり
|
17
|
+
にCharles Nutterのrocking Weakling gemを使用に変更
|
18
|
+
* Nokogiri::XML::Node#first_element_child は一番最初のELEMENT子ノードを返す
|
19
|
+
* Nokogiri::XML::Node#last_element_child は最後のELEMENT子ノードを返す
|
20
|
+
* Nokogiri::XML::Node#elements は全てのELEMENT子ノードを返す
|
21
|
+
|
22
|
+
* バグの修正
|
23
|
+
|
24
|
+
* ドキュメント内にデコレータがある場合、XML::NodeSet は常にデコレータされる GH #198
|
25
|
+
* XML::NodeSet#slice がノードセットよりも長いoffset+lengthを問題なく処理する
|
26
|
+
GH #200
|
27
|
+
* XML::Node#content=はノードとその直前に記述されている内容を支障なく切り離す
|
28
|
+
GH #203
|
29
|
+
* XML::Node#namespace= はnilを一つのパラメーターと扱って取得する
|
30
|
+
* XML::Node#xpath はNodeSetのオブジェクト以外のオブジェクトを返す GH #208
|
31
|
+
* XSLT::StyleSheet#transformはパラメーターのハッシュを受け入れる GH #223
|
32
|
+
* CSSのnot()の疑似セレクタの修正 GH #205
|
33
|
+
* XML::Builder はノード達が切り離されても破壊しない(vihaiの協力に感謝)
|
34
|
+
GH #228
|
35
|
+
* SAX parser経由でエンコードを強制することが出来る Eugene Pimenovに感謝!
|
36
|
+
GH #204
|
37
|
+
* XML::DocumentFragment はML::Node#parse を使用して子供を限定する
|
38
|
+
* XML Reader内のメモリリークを修正 sdorさん、ありがとう! GH#244
|
39
|
+
|
40
|
+
* ノート
|
41
|
+
|
42
|
+
* 今日4月18日現在、Windows gems は libxml 2.7.6 とlibxslt
|
43
|
+
1.1.26にDLLsを正規装備しています。このリリース以前にも既にDLLsはlibxml
|
44
|
+
2.7.3 と libxslt 1.1.24に正規装備されています。
|
45
|
+
|
1
46
|
=== 1.4.1 2009年12月10日
|
2
47
|
|
3
48
|
* 新しい機能
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,4 +1,56 @@
|
|
1
|
-
===
|
1
|
+
=== 1.4.2 (TBA)
|
2
|
+
|
3
|
+
* New Features
|
4
|
+
|
5
|
+
* XML::Node#parse will parse XML or HTML fragments with respect to the
|
6
|
+
context node.
|
7
|
+
* XML::Node#namespaces returns all namespaces defined in the node and all
|
8
|
+
ancestor nodes
|
9
|
+
(previously did not return ancestors' namespace definitions).
|
10
|
+
* Added Enumerable to XML::Node
|
11
|
+
* Nokogiri::XML::Schema#validate now uses xmlSchemaValidateFile if a
|
12
|
+
filename is passed, which is faster and more memory-efficient. GH #219
|
13
|
+
* XML::Document#create_entity will create new EntityDecl objects. GH #174
|
14
|
+
* JRuby FFI implementation no longer uses ObjectSpace._id2ref,
|
15
|
+
instead using Charles Nutter's rocking Weakling gem.
|
16
|
+
* Nokogiri::XML::Node#first_element_child fetch the first child node that is
|
17
|
+
an ELEMENT node.
|
18
|
+
* Nokogiri::XML::Node#last_element_child fetch the last child node that is
|
19
|
+
an ELEMENT node.
|
20
|
+
* Nokogiri::XML::Node#elements fetch all children nodes that are ELEMENT
|
21
|
+
nodes.
|
22
|
+
* Nokogiri::XML::Node#add_child, #add_previous_sibling, #before,
|
23
|
+
#add_next_sibling, #after, #inner_html, #swap and #replace all now
|
24
|
+
accept a Node, DocumentFragment, NodeSet, or a string containing
|
25
|
+
markup.
|
26
|
+
* Node#fragment? indicates whether a node is a DocumentFragment.
|
27
|
+
|
28
|
+
* Bugfixes
|
29
|
+
|
30
|
+
* XML::NodeSet is now always decorated (if the document has decorators).
|
31
|
+
GH #198
|
32
|
+
* XML::NodeSet#slice gracefully handles offset+length larger than the set
|
33
|
+
length. GH #200
|
34
|
+
* XML::Node#content= safely unlinks previous content. GH #203
|
35
|
+
* XML::Node#namespace= takes nil as a parameter
|
36
|
+
* XML::Node#xpath returns things other than NodeSet objects. GH #208
|
37
|
+
* XSLT::StyleSheet#transform accepts hashes for parameters. GH #223
|
38
|
+
* Psuedo selectors inside not() work. GH #205
|
39
|
+
* XML::Builder doesn't break when nodes are unlinked.
|
40
|
+
Thanks to vihai! GH #228
|
41
|
+
* Encoding can be forced on the SAX parser. Thanks Eugene Pimenov! GH #204
|
42
|
+
* XML::DocumentFragment uses XML::Node#parse to determine children.
|
43
|
+
* Fixed a memory leak in xml reader. Thanks sdor! GH #244
|
44
|
+
* Node#replace returns the new child node as claimed in the
|
45
|
+
RDoc. Previously returned +self+.
|
46
|
+
|
47
|
+
* Notes
|
48
|
+
|
49
|
+
* The Windows gems now bundle DLLs for libxml 2.7.6 and libxslt
|
50
|
+
1.1.26. Prior to this release, libxml 2.7.3 and libxslt 1.1.24
|
51
|
+
were bundled.
|
52
|
+
|
53
|
+
=== 1.4.1 / 2009/12/10
|
2
54
|
|
3
55
|
* New Features
|
4
56
|
|
data/Manifest.txt
CHANGED
@@ -68,8 +68,6 @@ ext/nokogiri/xml_syntax_error.c
|
|
68
68
|
ext/nokogiri/xml_syntax_error.h
|
69
69
|
ext/nokogiri/xml_text.c
|
70
70
|
ext/nokogiri/xml_text.h
|
71
|
-
ext/nokogiri/xml_xpath.c
|
72
|
-
ext/nokogiri/xml_xpath.h
|
73
71
|
ext/nokogiri/xml_xpath_context.c
|
74
72
|
ext/nokogiri/xml_xpath_context.h
|
75
73
|
ext/nokogiri/xslt_stylesheet.c
|
@@ -122,6 +120,7 @@ lib/nokogiri/ffi/structs/xml_xpath_context.rb
|
|
122
120
|
lib/nokogiri/ffi/structs/xml_xpath_object.rb
|
123
121
|
lib/nokogiri/ffi/structs/xml_xpath_parser_context.rb
|
124
122
|
lib/nokogiri/ffi/structs/xslt_stylesheet.rb
|
123
|
+
lib/nokogiri/ffi/weak_bucket.rb
|
125
124
|
lib/nokogiri/ffi/xml/attr.rb
|
126
125
|
lib/nokogiri/ffi/xml/attribute_decl.rb
|
127
126
|
lib/nokogiri/ffi/xml/cdata.rb
|
@@ -171,7 +170,6 @@ lib/nokogiri/xml/dtd.rb
|
|
171
170
|
lib/nokogiri/xml/element_content.rb
|
172
171
|
lib/nokogiri/xml/element_decl.rb
|
173
172
|
lib/nokogiri/xml/entity_decl.rb
|
174
|
-
lib/nokogiri/xml/fragment_handler.rb
|
175
173
|
lib/nokogiri/xml/namespace.rb
|
176
174
|
lib/nokogiri/xml/node.rb
|
177
175
|
lib/nokogiri/xml/node/save_options.rb
|
@@ -191,12 +189,14 @@ lib/nokogiri/xml/sax/parser_context.rb
|
|
191
189
|
lib/nokogiri/xml/sax/push_parser.rb
|
192
190
|
lib/nokogiri/xml/schema.rb
|
193
191
|
lib/nokogiri/xml/syntax_error.rb
|
192
|
+
lib/nokogiri/xml/text.rb
|
194
193
|
lib/nokogiri/xml/xpath.rb
|
195
194
|
lib/nokogiri/xml/xpath/syntax_error.rb
|
196
195
|
lib/nokogiri/xml/xpath_context.rb
|
197
196
|
lib/nokogiri/xslt.rb
|
198
197
|
lib/nokogiri/xslt/stylesheet.rb
|
199
198
|
lib/xsd/xmlparser/nokogiri.rb
|
199
|
+
tasks/cross_compile.rb
|
200
200
|
tasks/test.rb
|
201
201
|
test/css/test_nthiness.rb
|
202
202
|
test/css/test_parser.rb
|
data/README.ja.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -45,11 +45,11 @@ The IRC channel is #nokogiri on freenode.
|
|
45
45
|
|
46
46
|
require 'nokogiri'
|
47
47
|
require 'open-uri'
|
48
|
-
|
48
|
+
|
49
49
|
# Get a Nokogiri::HTML:Document for the page we’re interested in...
|
50
50
|
|
51
51
|
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
|
52
|
-
|
52
|
+
|
53
53
|
# Do funky things with it using Nokogiri::XML::Node methods...
|
54
54
|
|
55
55
|
####
|
@@ -57,13 +57,13 @@ The IRC channel is #nokogiri on freenode.
|
|
57
57
|
doc.css('h3.r a.l').each do |link|
|
58
58
|
puts link.content
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
####
|
62
62
|
# Search for nodes by xpath
|
63
63
|
doc.xpath('//h3/a[@class="l"]').each do |link|
|
64
64
|
puts link.content
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
####
|
68
68
|
# Or mix and match.
|
69
69
|
doc.search('h3.r a.l', '//h3/a[@class="l"]').each do |link|
|
@@ -79,6 +79,12 @@ The IRC channel is #nokogiri on freenode.
|
|
79
79
|
* libxslt
|
80
80
|
* libxslt-dev
|
81
81
|
|
82
|
+
== ENCODING:
|
83
|
+
|
84
|
+
Strings are always stored as UTF-8 internally. Methods that return text values
|
85
|
+
will always return UTF-8 encoded strings. Methods that return XML (like to_xml,
|
86
|
+
to_html and inner_html) will return a string encoded like the source document.
|
87
|
+
|
82
88
|
== INSTALL:
|
83
89
|
|
84
90
|
* sudo gem install nokogiri
|
@@ -101,7 +107,7 @@ Developing Nokogiri requires racc and rexical.
|
|
101
107
|
|
102
108
|
(The MIT License)
|
103
109
|
|
104
|
-
Copyright (c) 2008 -
|
110
|
+
Copyright (c) 2008 - 2010:
|
105
111
|
|
106
112
|
* {Aaron Patterson}[http://tenderlovemaking.com]
|
107
113
|
* {Mike Dalessio}[http://mike.daless.io]
|
data/Rakefile
CHANGED
@@ -9,6 +9,7 @@ java = RUBY_PLATFORM =~ /java/
|
|
9
9
|
|
10
10
|
GENERATED_PARSER = "lib/nokogiri/css/generated_parser.rb"
|
11
11
|
GENERATED_TOKENIZER = "lib/nokogiri/css/generated_tokenizer.rb"
|
12
|
+
CROSS_DIR = File.join(File.dirname(__FILE__), 'tmp', 'cross')
|
12
13
|
|
13
14
|
# Make sure hoe-debugging is installed
|
14
15
|
Hoe.plugin :debugging
|
@@ -18,7 +19,7 @@ HOE = Hoe.spec 'nokogiri' do
|
|
18
19
|
developer('Mike Dalessio', 'mike.dalessio@gmail.com')
|
19
20
|
self.readme_file = ['README', ENV['HLANG'], 'rdoc'].compact.join('.')
|
20
21
|
self.history_file = ['CHANGELOG', ENV['HLANG'], 'rdoc'].compact.join('.')
|
21
|
-
self.extra_rdoc_files = FileList['*.rdoc']
|
22
|
+
self.extra_rdoc_files = FileList['*.rdoc','ext/nokogiri/*.c']
|
22
23
|
self.clean_globs = [
|
23
24
|
'lib/nokogiri/*.{o,so,bundle,a,log,dll}',
|
24
25
|
'lib/nokogiri/nokogiri.rb',
|
@@ -31,9 +32,13 @@ HOE = Hoe.spec 'nokogiri' do
|
|
31
32
|
%w{ racc rexical rake-compiler }.each do |dep|
|
32
33
|
self.extra_dev_deps << [dep, '>= 0']
|
33
34
|
end
|
35
|
+
self.extra_dev_deps << ["minitest", ">= 1.6.0"]
|
34
36
|
|
35
37
|
self.spec_extras = { :extensions => ["ext/nokogiri/extconf.rb"] }
|
38
|
+
|
39
|
+
self.testlib = :minitest
|
36
40
|
end
|
41
|
+
Hoe.add_include_dirs '.'
|
37
42
|
|
38
43
|
task :ws_docs do
|
39
44
|
title = "#{HOE.name}-#{HOE.version} Documentation"
|
@@ -59,38 +64,16 @@ unless java
|
|
59
64
|
ext.lib_dir = File.join(*['lib', 'nokogiri', ENV['FAT_DIR']].compact)
|
60
65
|
|
61
66
|
ext.config_options << ENV['EXTOPTS']
|
62
|
-
cross_dir = File.join(File.dirname(__FILE__), 'tmp', 'cross')
|
63
67
|
ext.cross_compile = true
|
64
68
|
ext.cross_platform = 'i386-mingw32'
|
65
69
|
ext.cross_config_options <<
|
66
|
-
"--with-
|
67
|
-
ext.cross_config_options <<
|
68
|
-
"--with-xml2-dir=#{File.join(cross_dir, 'libxml2')}"
|
70
|
+
"--with-xml2-include=#{File.join(CROSS_DIR, 'include', 'libxml2')}"
|
69
71
|
ext.cross_config_options <<
|
70
|
-
"--with-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
File.open("lib/#{HOE.name}/#{HOE.name}.rb", 'wb') do |f|
|
75
|
-
f.write <<-eoruby
|
76
|
-
require "#{HOE.name}/\#{RUBY_VERSION.sub(/\\.\\d+$/, '')}/#{HOE.name}"
|
77
|
-
eoruby
|
78
|
-
end
|
72
|
+
"--with-xml2-lib=#{File.join(CROSS_DIR, 'lib')}"
|
73
|
+
ext.cross_config_options << "--with-iconv-dir=#{CROSS_DIR}"
|
74
|
+
ext.cross_config_options << "--with-xslt-dir=#{CROSS_DIR}"
|
75
|
+
ext.cross_config_options << "--with-zlib-dir=#{CROSS_DIR}"
|
79
76
|
end
|
80
|
-
|
81
|
-
namespace :cross do
|
82
|
-
task :file_list do
|
83
|
-
HOE.spec.platform = 'x86-mingw32'
|
84
|
-
HOE.spec.extensions = []
|
85
|
-
HOE.spec.files += Dir["lib/#{HOE.name}/#{HOE.name}.rb"]
|
86
|
-
HOE.spec.files += Dir["lib/#{HOE.name}/1.{8,9}/#{HOE.name}.so"]
|
87
|
-
HOE.spec.files += Dir["ext/nokogiri/*.dll"]
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
CLOBBER.include("lib/nokogiri/nokogiri.{so,dylib,rb,bundle}")
|
92
|
-
CLOBBER.include("lib/nokogiri/1.{8,9}")
|
93
|
-
CLOBBER.include("ext/nokogiri/*.dll")
|
94
77
|
end
|
95
78
|
|
96
79
|
namespace :gem do
|
@@ -118,6 +101,7 @@ namespace :gem do
|
|
118
101
|
HOE.spec.files << GENERATED_TOKENIZER
|
119
102
|
HOE.spec.files += Dir["ext/nokogiri/*.dll"]
|
120
103
|
HOE.spec.extensions = []
|
104
|
+
HOE.spec.add_dependency 'weakling', '>= 0.0.3'
|
121
105
|
f.write(HOE.spec.to_ruby)
|
122
106
|
end
|
123
107
|
end
|
@@ -144,58 +128,8 @@ file GENERATED_TOKENIZER => "lib/nokogiri/css/tokenizer.rex" do |t|
|
|
144
128
|
end
|
145
129
|
end
|
146
130
|
|
147
|
-
libs = %w{
|
148
|
-
iconv-1.9.2.win32
|
149
|
-
zlib-1.2.3.win32
|
150
|
-
libxml2-2.7.3.win32
|
151
|
-
libxslt-1.1.24.win32
|
152
|
-
}
|
153
|
-
|
154
|
-
lib_dlls = {
|
155
|
-
'iconv-1.9.2.win32' => 'iconv.dll',
|
156
|
-
'zlib-1.2.3.win32' => 'zlib1.dll',
|
157
|
-
'libxml2-2.7.3.win32' => 'libxml2.dll',
|
158
|
-
'libxslt-1.1.24.win32' => 'libxslt.dll',
|
159
|
-
}
|
160
|
-
|
161
|
-
libs.each do |lib|
|
162
|
-
libname = lib.split('-').first
|
163
|
-
|
164
|
-
file "tmp/stash/#{lib}.zip" do |t|
|
165
|
-
puts "downloading #{lib}"
|
166
|
-
FileUtils.mkdir_p('tmp/stash')
|
167
|
-
Dir.chdir('tmp/stash') do
|
168
|
-
url = "ftp://ftp.xmlsoft.org/libxml2/win32/#{lib}.zip"
|
169
|
-
system("wget #{url} || curl -O #{url}")
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
file "tmp/cross/#{libname}" => ["tmp/stash/#{lib}.zip"] do |t|
|
174
|
-
puts "unzipping #{lib}.zip"
|
175
|
-
FileUtils.mkdir_p('tmp/cross')
|
176
|
-
Dir.chdir('tmp/cross') do
|
177
|
-
sh "unzip ../stash/#{lib}.zip"
|
178
|
-
sh "cp #{lib}/bin/* #{lib}/lib" # put DLL in lib, so dirconfig works
|
179
|
-
sh "mv #{lib} #{lib.split('-').first}"
|
180
|
-
sh "touch #{lib.split('-').first}"
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
file "ext/nokogiri/#{lib_dlls[lib]}" => "tmp/cross/#{libname}" do |t|
|
185
|
-
Dir.chdir('tmp/cross') do
|
186
|
-
sh "cp #{libname}/bin/*.dll ../../ext/nokogiri/"
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
if Rake::Task.task_defined?(:cross)
|
191
|
-
Rake::Task[:cross].prerequisites << "ext/nokogiri/#{lib_dlls[lib]}"
|
192
|
-
Rake::Task[:cross].prerequisites << "lib/nokogiri/nokogiri.rb"
|
193
|
-
Rake::Task[:cross].prerequisites << "cross:file_list"
|
194
|
-
end
|
195
|
-
Rake::Task['gem:jruby:spec'].prerequisites << "ext/nokogiri/#{lib_dlls[lib]}"
|
196
|
-
end
|
197
|
-
|
198
131
|
require 'tasks/test'
|
132
|
+
require 'tasks/cross_compile'
|
199
133
|
|
200
134
|
desc "set environment variables to build and/or test with debug options"
|
201
135
|
task :debug do
|
data/ext/nokogiri/extconf.rb
CHANGED
@@ -19,26 +19,27 @@ $LIBS << " #{ENV["LIBS"]}"
|
|
19
19
|
|
20
20
|
if Config::CONFIG['target_os'] == 'mingw32'
|
21
21
|
$CFLAGS << " -DXP_WIN -DXP_WIN32 -DUSE_INCLUDED_VASPRINTF"
|
22
|
-
elsif Config::CONFIG['target_os']
|
22
|
+
elsif Config::CONFIG['target_os'] =~ /solaris/
|
23
23
|
$CFLAGS << " -DUSE_INCLUDED_VASPRINTF"
|
24
24
|
else
|
25
25
|
$CFLAGS << " -g -DXP_UNIX"
|
26
26
|
end
|
27
27
|
|
28
|
+
if RbConfig::MAKEFILE_CONFIG['CC'] =~ /mingw/
|
29
|
+
$CFLAGS << " -DIN_LIBXML"
|
30
|
+
end
|
31
|
+
|
28
32
|
$CFLAGS << " -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline"
|
29
33
|
|
30
34
|
HEADER_DIRS = [
|
31
35
|
# First search /opt/local for macports
|
32
36
|
'/opt/local/include',
|
33
|
-
'/opt/local/include/libxml2',
|
34
37
|
|
35
38
|
# Then search /usr/local for people that installed from source
|
36
39
|
'/usr/local/include',
|
37
|
-
'/usr/local/include/libxml2',
|
38
40
|
|
39
41
|
# Check the ruby install locations
|
40
42
|
INCLUDEDIR,
|
41
|
-
File.join(INCLUDEDIR, "libxml2"),
|
42
43
|
|
43
44
|
# Finally fall back to /usr
|
44
45
|
'/usr/include',
|
@@ -59,79 +60,26 @@ LIB_DIRS = [
|
|
59
60
|
'/usr/lib',
|
60
61
|
]
|
61
62
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
unless ["", ""] == xml2_dirs
|
70
|
-
HEADER_DIRS.unshift xml2_dirs.first
|
71
|
-
LIB_DIRS.unshift xml2_dirs[1]
|
72
|
-
end
|
63
|
+
dir_config('zlib', HEADER_DIRS, LIB_DIRS)
|
64
|
+
dir_config('iconv', HEADER_DIRS, LIB_DIRS)
|
65
|
+
dir_config('xml2', [
|
66
|
+
'/opt/local/include/libxml2',
|
67
|
+
'/usr/local/include/libxml2',
|
68
|
+
File.join(INCLUDEDIR, "libxml2")] + HEADER_DIRS, LIB_DIRS)
|
69
|
+
dir_config('xslt', HEADER_DIRS, LIB_DIRS)
|
73
70
|
|
74
|
-
|
75
|
-
|
76
|
-
HEADER_DIRS.unshift xslt_dirs.first
|
77
|
-
LIB_DIRS.unshift xslt_dirs[1]
|
71
|
+
def asplode(lib)
|
72
|
+
abort "-----\n#{lib} is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.\n-----"
|
78
73
|
end
|
79
74
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
header = cpp_include header_file
|
89
|
-
checking_for message do
|
90
|
-
found = false
|
91
|
-
paths.each do |dir|
|
92
|
-
if File.exists?(File.join(dir, header_file))
|
93
|
-
opt = "-I#{dir}".quote
|
94
|
-
if try_cpp header, opt
|
95
|
-
unless CUSTOM_DASH_I.include? dir
|
96
|
-
$INCFLAGS = "#{opt} #{$INCFLAGS}"
|
97
|
-
CUSTOM_DASH_I << dir
|
98
|
-
end
|
99
|
-
found = dir
|
100
|
-
break
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
found ||= try_cpp(header)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
unless nokogiri_find_header('iconv.h', *HEADER_DIRS)
|
109
|
-
abort "iconv is missing. try 'port install iconv' or 'yum install iconv'"
|
110
|
-
end
|
111
|
-
|
112
|
-
unless nokogiri_find_header('libxml/parser.h', *HEADER_DIRS)
|
113
|
-
abort "libxml2 is missing. try 'port install libxml2' or 'yum install libxml2-devel'"
|
114
|
-
end
|
115
|
-
|
116
|
-
unless nokogiri_find_header('libxslt/xslt.h', *HEADER_DIRS)
|
117
|
-
abort "libxslt is missing. try 'port install libxslt' or 'yum install libxslt-devel'"
|
118
|
-
end
|
119
|
-
|
120
|
-
unless nokogiri_find_header('libexslt/exslt.h', *HEADER_DIRS)
|
121
|
-
abort "libxslt is missing. try 'port install libxslt' or 'yum install libxslt-devel'"
|
122
|
-
end
|
123
|
-
|
124
|
-
unless find_library('xml2', 'xmlParseDoc', *LIB_DIRS)
|
125
|
-
abort "libxml2 is missing. try 'port install libxml2' or 'yum install libxml2'"
|
126
|
-
end
|
127
|
-
|
128
|
-
unless find_library('xslt', 'xsltParseStylesheetDoc', *LIB_DIRS)
|
129
|
-
abort "libxslt is missing. try 'port install libxslt' or 'yum install libxslt-devel'"
|
130
|
-
end
|
131
|
-
|
132
|
-
unless find_library('exslt', 'exsltFuncRegister', *LIB_DIRS)
|
133
|
-
abort "libxslt is missing. try 'port install libxslt' or 'yum install libxslt-devel'"
|
134
|
-
end
|
75
|
+
asplode "iconv" unless find_header('iconv.h')
|
76
|
+
asplode "libxml2" unless find_header('libxml/parser.h')
|
77
|
+
asplode "libxslt" unless find_header('libxslt/xslt.h')
|
78
|
+
asplode "libexslt" unless find_header('libexslt/exslt.h')
|
79
|
+
asplode "zlib" unless find_library('z', 'gzopen')
|
80
|
+
asplode "libxml2" unless find_library('xml2', 'xmlParseDoc')
|
81
|
+
asplode "libxslt" unless find_library('xslt', 'xsltParseStylesheetDoc')
|
82
|
+
asplode "libexslt" unless find_library('exslt', 'exsltFuncRegister')
|
135
83
|
|
136
84
|
have_func('xmlRelaxNGSetParserStructuredErrors')
|
137
85
|
have_func('xmlRelaxNGSetParserStructuredErrors')
|