nokogiri 1.8.5-java → 1.9.0-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.
- checksums.yaml +5 -5
- data/README.md +0 -1
- data/ext/java/nokogiri/XmlAttr.java +3 -1
- data/ext/java/nokogiri/XmlDtd.java +20 -16
- data/ext/java/nokogiri/XmlElement.java +6 -6
- data/ext/java/nokogiri/XmlNode.java +29 -9
- data/ext/java/nokogiri/XmlNodeSet.java +258 -77
- data/ext/java/nokogiri/XmlXpathContext.java +10 -12
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +25 -23
- data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +5 -5
- data/ext/java/nokogiri/internals/XalanDTMManagerPatch.java +11 -10
- data/ext/java/{org/apache/xml/dtm/ref/dom2dtm/DOM2DTMExt.java → nokogiri/internals/dom2dtm/DOM2DTM.java} +3 -7
- data/ext/java/nokogiri/internals/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java +685 -0
- data/ext/nokogiri/extconf.rb +10 -6
- data/ext/nokogiri/xml_attr.c +26 -21
- data/ext/nokogiri/xml_document.c +4 -1
- data/ext/nokogiri/xml_namespace.c +3 -3
- data/ext/nokogiri/xml_namespace.h +1 -2
- data/ext/nokogiri/xml_node.c +55 -15
- data/lib/nokogiri/css/parser.rb +61 -61
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml/document_fragment.rb +11 -0
- data/lib/nokogiri/xml/node.rb +12 -0
- data/lib/nokogiri/xml/node_set.rb +4 -8
- data/lib/xercesImpl.jar +0 -0
- metadata +17 -152
- data/.autotest +0 -22
- data/.cross_rubies +0 -8
- data/.editorconfig +0 -17
- data/.gemtest +0 -0
- data/.travis.yml +0 -63
- data/CHANGELOG.md +0 -1368
- data/CONTRIBUTING.md +0 -42
- data/C_CODING_STYLE.rdoc +0 -33
- data/Gemfile +0 -23
- data/Gemfile-libxml-ruby +0 -3
- data/Manifest.txt +0 -370
- data/ROADMAP.md +0 -111
- data/Rakefile +0 -348
- data/SECURITY.md +0 -19
- data/STANDARD_RESPONSES.md +0 -47
- data/Y_U_NO_GEMSPEC.md +0 -155
- data/appveyor.yml +0 -29
- data/build_all +0 -44
- data/patches/sort-patches-by-date +0 -25
- data/suppressions/README.txt +0 -1
- data/suppressions/nokogiri_ruby-2.supp +0 -10
- data/tasks/test.rb +0 -100
- data/test/css/test_nthiness.rb +0 -226
- data/test/css/test_parser.rb +0 -386
- data/test/css/test_tokenizer.rb +0 -215
- data/test/css/test_xpath_visitor.rb +0 -96
- data/test/decorators/test_slop.rb +0 -23
- data/test/files/2ch.html +0 -108
- data/test/files/GH_1042.html +0 -18
- data/test/files/address_book.rlx +0 -12
- data/test/files/address_book.xml +0 -10
- data/test/files/atom.xml +0 -344
- data/test/files/bar/bar.xsd +0 -4
- data/test/files/bogus.xml +0 -0
- data/test/files/dont_hurt_em_why.xml +0 -422
- data/test/files/encoding.html +0 -82
- data/test/files/encoding.xhtml +0 -84
- data/test/files/exslt.xml +0 -8
- data/test/files/exslt.xslt +0 -35
- data/test/files/foo/foo.xsd +0 -4
- data/test/files/metacharset.html +0 -10
- data/test/files/namespace_pressure_test.xml +0 -1684
- data/test/files/noencoding.html +0 -47
- data/test/files/po.xml +0 -32
- data/test/files/po.xsd +0 -66
- data/test/files/saml/saml20assertion_schema.xsd +0 -283
- data/test/files/saml/saml20protocol_schema.xsd +0 -302
- data/test/files/saml/xenc_schema.xsd +0 -146
- data/test/files/saml/xmldsig_schema.xsd +0 -318
- data/test/files/shift_jis.html +0 -10
- data/test/files/shift_jis.xml +0 -5
- data/test/files/shift_jis_no_charset.html +0 -9
- data/test/files/slow-xpath.xml +0 -25509
- data/test/files/snuggles.xml +0 -3
- data/test/files/staff.dtd +0 -10
- data/test/files/staff.xml +0 -59
- data/test/files/staff.xslt +0 -32
- data/test/files/test_document_url/bar.xml +0 -2
- data/test/files/test_document_url/document.dtd +0 -4
- data/test/files/test_document_url/document.xml +0 -6
- data/test/files/tlm.html +0 -851
- data/test/files/to_be_xincluded.xml +0 -2
- data/test/files/valid_bar.xml +0 -2
- data/test/files/xinclude.xml +0 -4
- data/test/helper.rb +0 -271
- data/test/html/sax/test_parser.rb +0 -168
- data/test/html/sax/test_parser_context.rb +0 -46
- data/test/html/sax/test_parser_text.rb +0 -163
- data/test/html/sax/test_push_parser.rb +0 -87
- data/test/html/test_attributes.rb +0 -85
- data/test/html/test_builder.rb +0 -164
- data/test/html/test_document.rb +0 -712
- data/test/html/test_document_encoding.rb +0 -143
- data/test/html/test_document_fragment.rb +0 -310
- data/test/html/test_element_description.rb +0 -105
- data/test/html/test_named_characters.rb +0 -14
- data/test/html/test_node.rb +0 -212
- data/test/html/test_node_encoding.rb +0 -91
- data/test/namespaces/test_additional_namespaces_in_builder_doc.rb +0 -14
- data/test/namespaces/test_namespaces_aliased_default.rb +0 -24
- data/test/namespaces/test_namespaces_in_builder_doc.rb +0 -75
- data/test/namespaces/test_namespaces_in_cloned_doc.rb +0 -31
- data/test/namespaces/test_namespaces_in_created_doc.rb +0 -75
- data/test/namespaces/test_namespaces_in_parsed_doc.rb +0 -80
- data/test/namespaces/test_namespaces_preservation.rb +0 -31
- data/test/test_convert_xpath.rb +0 -135
- data/test/test_css_cache.rb +0 -47
- data/test/test_encoding_handler.rb +0 -48
- data/test/test_memory_leak.rb +0 -156
- data/test/test_nokogiri.rb +0 -138
- data/test/test_soap4r_sax.rb +0 -52
- data/test/test_xslt_transforms.rb +0 -314
- data/test/xml/node/test_save_options.rb +0 -28
- data/test/xml/node/test_subclass.rb +0 -44
- data/test/xml/sax/test_parser.rb +0 -402
- data/test/xml/sax/test_parser_context.rb +0 -115
- data/test/xml/sax/test_parser_text.rb +0 -202
- data/test/xml/sax/test_push_parser.rb +0 -265
- data/test/xml/test_attr.rb +0 -74
- data/test/xml/test_attribute_decl.rb +0 -86
- data/test/xml/test_builder.rb +0 -341
- data/test/xml/test_c14n.rb +0 -180
- data/test/xml/test_cdata.rb +0 -54
- data/test/xml/test_comment.rb +0 -40
- data/test/xml/test_document.rb +0 -982
- data/test/xml/test_document_encoding.rb +0 -31
- data/test/xml/test_document_fragment.rb +0 -298
- data/test/xml/test_dtd.rb +0 -187
- data/test/xml/test_dtd_encoding.rb +0 -31
- data/test/xml/test_element_content.rb +0 -56
- data/test/xml/test_element_decl.rb +0 -73
- data/test/xml/test_entity_decl.rb +0 -122
- data/test/xml/test_entity_reference.rb +0 -262
- data/test/xml/test_namespace.rb +0 -96
- data/test/xml/test_node.rb +0 -1325
- data/test/xml/test_node_attributes.rb +0 -115
- data/test/xml/test_node_encoding.rb +0 -75
- data/test/xml/test_node_inheritance.rb +0 -32
- data/test/xml/test_node_reparenting.rb +0 -592
- data/test/xml/test_node_set.rb +0 -809
- data/test/xml/test_parse_options.rb +0 -64
- data/test/xml/test_processing_instruction.rb +0 -30
- data/test/xml/test_reader.rb +0 -620
- data/test/xml/test_reader_encoding.rb +0 -134
- data/test/xml/test_relax_ng.rb +0 -60
- data/test/xml/test_schema.rb +0 -142
- data/test/xml/test_syntax_error.rb +0 -36
- data/test/xml/test_text.rb +0 -60
- data/test/xml/test_unparented_node.rb +0 -483
- data/test/xml/test_xinclude.rb +0 -83
- data/test/xml/test_xpath.rb +0 -470
- data/test/xslt/test_custom_functions.rb +0 -133
- data/test/xslt/test_exception_handling.rb +0 -37
data/ROADMAP.md
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
# Roadmap for API Changes
|
2
|
-
|
3
|
-
## overhaul serialize/pretty printing API
|
4
|
-
|
5
|
-
* https://github.com/sparklemotion/nokogiri/issues/530
|
6
|
-
XHTML formatting can't be turned off
|
7
|
-
|
8
|
-
* https://github.com/sparklemotion/nokogiri/issues/415
|
9
|
-
XML formatting should be no formatting
|
10
|
-
|
11
|
-
|
12
|
-
## overhaul and optimize the SAX parsing
|
13
|
-
|
14
|
-
* see fairy wing throwdown - SAX parsing is wicked slow.
|
15
|
-
|
16
|
-
|
17
|
-
## Node should not be Enumerable; and should have a better attributes API
|
18
|
-
|
19
|
-
* https://github.com/sparklemotion/nokogiri/issues/679
|
20
|
-
Mixing in Enumerable has some unintended consequences; plus we want to improve the attributes API
|
21
|
-
|
22
|
-
* Some ideas for a better attributes API?
|
23
|
-
* (closed) https://github.com/sparklemotion/nokogiri/issues/666
|
24
|
-
* https://github.com/sparklemotion/nokogiri/issues/765
|
25
|
-
|
26
|
-
|
27
|
-
## improve CSS query parsing
|
28
|
-
|
29
|
-
* https://github.com/sparklemotion/nokogiri/issues/528
|
30
|
-
support `:not()` with a nontrivial argument, like `:not(div p.c)`
|
31
|
-
|
32
|
-
* https://github.com/sparklemotion/nokogiri/issues/451
|
33
|
-
chained :not pseudoselectors
|
34
|
-
|
35
|
-
* better jQuery selector and CSS pseudo-selector support:
|
36
|
-
* https://github.com/sparklemotion/nokogiri/issues/621
|
37
|
-
* https://github.com/sparklemotion/nokogiri/issues/342
|
38
|
-
* https://github.com/sparklemotion/nokogiri/issues/628
|
39
|
-
* https://github.com/sparklemotion/nokogiri/issues/652
|
40
|
-
* https://github.com/sparklemotion/nokogiri/issues/688
|
41
|
-
|
42
|
-
* https://github.com/sparklemotion/nokogiri/issues/394
|
43
|
-
nth-of-type is wrong, and possibly other selectors as well
|
44
|
-
|
45
|
-
* https://github.com/sparklemotion/nokogiri/issues/309
|
46
|
-
incorrect query being executed
|
47
|
-
|
48
|
-
* https://github.com/sparklemotion/nokogiri/issues/350
|
49
|
-
:has is wrong?
|
50
|
-
|
51
|
-
|
52
|
-
## DocumentFragment
|
53
|
-
|
54
|
-
* there are a few tickets about searches not working properly if you
|
55
|
-
use or do not use the context node as part of the search.
|
56
|
-
- https://github.com/sparklemotion/nokogiri/issues/213
|
57
|
-
- https://github.com/sparklemotion/nokogiri/issues/370
|
58
|
-
- https://github.com/sparklemotion/nokogiri/issues/454
|
59
|
-
- https://github.com/sparklemotion/nokogiri/issues/572
|
60
|
-
could we fix this by making DocumentFragment be a subclass of NodeSet?
|
61
|
-
|
62
|
-
|
63
|
-
## Better Syntax for custom XPath function handler
|
64
|
-
|
65
|
-
* https://github.com/sparklemotion/nokogiri/pull/464
|
66
|
-
|
67
|
-
|
68
|
-
## Better Syntax around Node#xpath and NodeSet#xpath
|
69
|
-
|
70
|
-
* look at those methods, and use of Node#extract_params in Node#{css,search}
|
71
|
-
* we should standardize on a hash of options for these and other calls
|
72
|
-
* what should NodeSet#xpath return?
|
73
|
-
* https://github.com/sparklemotion/nokogiri/issues/656
|
74
|
-
|
75
|
-
## Encoding
|
76
|
-
|
77
|
-
We have a lot of issues open around encoding. How bad are things?
|
78
|
-
Somebody who knows encoding well should head this up.
|
79
|
-
|
80
|
-
* Extract EncodingReader as a real object that can be injected
|
81
|
-
https://groups.google.com/forum/#!msg/nokogiri-talk/arJeAtMqvkg/tGihB-iBRSAJ
|
82
|
-
|
83
|
-
|
84
|
-
## Reader
|
85
|
-
|
86
|
-
It's fundamentally broken, in that we can't stop people from crashing
|
87
|
-
their application if they want to use object reference unsafely.
|
88
|
-
|
89
|
-
|
90
|
-
## Class methods that require Document
|
91
|
-
|
92
|
-
There are a few methods, like `Nokogiri::XML::Comment.new` that
|
93
|
-
require a Document object.
|
94
|
-
|
95
|
-
We should probably make Document instance methods to wrap this, since
|
96
|
-
it's a non-obvious expectation and thus fails as a convention.
|
97
|
-
|
98
|
-
So, instead, let's make alternative methods like
|
99
|
-
`Nokogiri::XML::Document#new_comment`, and recommend those as the
|
100
|
-
proper convention.
|
101
|
-
|
102
|
-
|
103
|
-
## `collect_namespaces` is just broken
|
104
|
-
|
105
|
-
`collect_namespaces` is returning a hash, which means it can't return
|
106
|
-
namespaces with the same prefix. See this issue for background:
|
107
|
-
|
108
|
-
> https://github.com/sparklemotion/nokogiri/issues/885
|
109
|
-
|
110
|
-
Do we care? This seems like a useless method, but then again I hate
|
111
|
-
XML, so what do I know?
|
data/Rakefile
DELETED
@@ -1,348 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
require 'rubygems'
|
3
|
-
require 'shellwords'
|
4
|
-
|
5
|
-
gem 'hoe'
|
6
|
-
require 'hoe'
|
7
|
-
Hoe.plugin :debugging
|
8
|
-
Hoe.plugin :git
|
9
|
-
Hoe.plugin :gemspec
|
10
|
-
Hoe.plugin :bundler
|
11
|
-
|
12
|
-
GENERATED_PARSER = "lib/nokogiri/css/parser.rb"
|
13
|
-
GENERATED_TOKENIZER = "lib/nokogiri/css/tokenizer.rb"
|
14
|
-
|
15
|
-
def java?
|
16
|
-
/java/ === RUBY_PLATFORM
|
17
|
-
end
|
18
|
-
|
19
|
-
ENV['LANG'] = "en_US.UTF-8" # UBUNTU 10.04, Y U NO DEFAULT TO UTF-8?
|
20
|
-
|
21
|
-
CrossRuby = Struct.new(:version, :host) {
|
22
|
-
def ver
|
23
|
-
@ver ||= version[/\A[^-]+/]
|
24
|
-
end
|
25
|
-
|
26
|
-
def minor_ver
|
27
|
-
@minor_ver ||= ver[/\A\d\.\d(?=\.)/]
|
28
|
-
end
|
29
|
-
|
30
|
-
def api_ver_suffix
|
31
|
-
case minor_ver
|
32
|
-
when nil
|
33
|
-
raise "unsupported version: #{ver}"
|
34
|
-
else
|
35
|
-
minor_ver.delete('.') << '0'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def platform
|
40
|
-
@platform ||=
|
41
|
-
case host
|
42
|
-
when /\Ax86_64-/
|
43
|
-
'x64-mingw32'
|
44
|
-
when /\Ai[3-6]86-/
|
45
|
-
'x86-mingw32'
|
46
|
-
else
|
47
|
-
raise "unsupported host: #{host}"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def tool(name)
|
52
|
-
(@binutils_prefix ||=
|
53
|
-
case platform
|
54
|
-
when 'x64-mingw32'
|
55
|
-
'x86_64-w64-mingw32-'
|
56
|
-
when 'x86-mingw32'
|
57
|
-
'i686-w64-mingw32-'
|
58
|
-
end) + name
|
59
|
-
end
|
60
|
-
|
61
|
-
def target
|
62
|
-
case platform
|
63
|
-
when 'x64-mingw32'
|
64
|
-
'pei-x86-64'
|
65
|
-
when 'x86-mingw32'
|
66
|
-
'pei-i386'
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def libruby_dll
|
71
|
-
case platform
|
72
|
-
when 'x64-mingw32'
|
73
|
-
"x64-msvcrt-ruby#{api_ver_suffix}.dll"
|
74
|
-
when 'x86-mingw32'
|
75
|
-
"msvcrt-ruby#{api_ver_suffix}.dll"
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def dlls
|
80
|
-
[
|
81
|
-
'kernel32.dll',
|
82
|
-
'msvcrt.dll',
|
83
|
-
'ws2_32.dll',
|
84
|
-
*(case
|
85
|
-
when ver >= '2.0.0'
|
86
|
-
'user32.dll'
|
87
|
-
end),
|
88
|
-
libruby_dll
|
89
|
-
]
|
90
|
-
end
|
91
|
-
}
|
92
|
-
|
93
|
-
CROSS_RUBIES = File.read('.cross_rubies').lines.flat_map { |line|
|
94
|
-
case line
|
95
|
-
when /\A([^#]+):([^#]+)/
|
96
|
-
CrossRuby.new($1, $2)
|
97
|
-
else
|
98
|
-
[]
|
99
|
-
end
|
100
|
-
}
|
101
|
-
|
102
|
-
ENV['RUBY_CC_VERSION'] ||= CROSS_RUBIES.map(&:ver).uniq.join(":")
|
103
|
-
|
104
|
-
HOE = Hoe.spec 'nokogiri' do
|
105
|
-
developer 'Aaron Patterson', 'aaronp@rubyforge.org'
|
106
|
-
developer 'Mike Dalessio', 'mike.dalessio@gmail.com'
|
107
|
-
developer 'Yoko Harada', 'yokolet@gmail.com'
|
108
|
-
developer 'Tim Elliott', 'tle@holymonkey.com'
|
109
|
-
developer 'Akinori MUSHA', 'knu@idaemons.org'
|
110
|
-
developer 'John Shahid', 'jvshahid@gmail.com'
|
111
|
-
developer 'Lars Kanis', 'lars@greiz-reinsdorf.de'
|
112
|
-
|
113
|
-
license "MIT"
|
114
|
-
|
115
|
-
self.readme_file = "README.md"
|
116
|
-
self.history_file = "CHANGELOG.md"
|
117
|
-
|
118
|
-
self.extra_rdoc_files = FileList['*.rdoc','ext/nokogiri/*.c']
|
119
|
-
|
120
|
-
|
121
|
-
self.clean_globs += [
|
122
|
-
'nokogiri.gemspec',
|
123
|
-
'lib/nokogiri/nokogiri.{bundle,jar,rb,so}',
|
124
|
-
'lib/nokogiri/[0-9].[0-9]'
|
125
|
-
]
|
126
|
-
self.clean_globs += Dir.glob("ports/*").reject { |d| d =~ %r{/archives$} }
|
127
|
-
|
128
|
-
unless java?
|
129
|
-
self.extra_deps += [
|
130
|
-
["mini_portile2", "~> 2.3.0"], # keep version in sync with extconf.rb
|
131
|
-
]
|
132
|
-
end
|
133
|
-
|
134
|
-
self.extra_dev_deps += [
|
135
|
-
["hoe-bundler", "~> 1.2"],
|
136
|
-
["hoe-debugging", "~> 1.4"],
|
137
|
-
["hoe-gemspec", "~> 1.0"],
|
138
|
-
["hoe-git", "~> 1.6"],
|
139
|
-
["minitest", "~> 5.8.4"],
|
140
|
-
["rake", "~> 12.0"],
|
141
|
-
["rake-compiler", "~> 1.0.3"],
|
142
|
-
["rake-compiler-dock", "~> 0.6.2"],
|
143
|
-
["racc", "~> 1.4.14"],
|
144
|
-
["rexical", "~> 1.0.5"],
|
145
|
-
["concourse", "~> 0.15"],
|
146
|
-
]
|
147
|
-
|
148
|
-
if java?
|
149
|
-
self.spec_extras = {
|
150
|
-
:platform => 'java',
|
151
|
-
:required_ruby_version => '>= 1.9.3' # JRuby >= 1.7
|
152
|
-
}
|
153
|
-
else
|
154
|
-
self.spec_extras = {
|
155
|
-
:extensions => ["ext/nokogiri/extconf.rb"],
|
156
|
-
:required_ruby_version => '>= 2.1.0'
|
157
|
-
}
|
158
|
-
end
|
159
|
-
|
160
|
-
self.testlib = :minitest
|
161
|
-
end
|
162
|
-
|
163
|
-
# ----------------------------------------
|
164
|
-
|
165
|
-
def add_file_to_gem relative_path
|
166
|
-
target_path = File.join gem_build_path, relative_path
|
167
|
-
target_dir = File.dirname(target_path)
|
168
|
-
mkdir_p target_dir unless File.directory?(target_dir)
|
169
|
-
rm_f target_path
|
170
|
-
safe_ln relative_path, target_path
|
171
|
-
HOE.spec.files += [relative_path]
|
172
|
-
end
|
173
|
-
|
174
|
-
def gem_build_path
|
175
|
-
File.join 'pkg', HOE.spec.full_name
|
176
|
-
end
|
177
|
-
|
178
|
-
if java?
|
179
|
-
# TODO: clean this section up.
|
180
|
-
require "rake/javaextensiontask"
|
181
|
-
Rake::JavaExtensionTask.new("nokogiri", HOE.spec) do |ext|
|
182
|
-
jruby_home = RbConfig::CONFIG['prefix']
|
183
|
-
ext.ext_dir = 'ext/java'
|
184
|
-
ext.lib_dir = 'lib/nokogiri'
|
185
|
-
ext.source_version = '1.6'
|
186
|
-
ext.target_version = '1.6'
|
187
|
-
jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar']
|
188
|
-
ext.classpath = jars.map { |x| File.expand_path x }.join ':'
|
189
|
-
ext.debug = true if ENV['JAVA_DEBUG']
|
190
|
-
end
|
191
|
-
|
192
|
-
task gem_build_path => [:compile] do
|
193
|
-
add_file_to_gem 'lib/nokogiri/nokogiri.jar'
|
194
|
-
end
|
195
|
-
else
|
196
|
-
begin
|
197
|
-
require 'rake/extensioncompiler'
|
198
|
-
# Ensure mingw compiler is installed
|
199
|
-
Rake::ExtensionCompiler.mingw_host
|
200
|
-
mingw_available = true
|
201
|
-
rescue
|
202
|
-
mingw_available = false
|
203
|
-
end
|
204
|
-
require "rake/extensiontask"
|
205
|
-
|
206
|
-
HOE.spec.files.reject! { |f| f =~ %r{\.(java|jar)$} }
|
207
|
-
|
208
|
-
dependencies = YAML.load_file("dependencies.yml")
|
209
|
-
|
210
|
-
task gem_build_path do
|
211
|
-
%w[libxml2 libxslt].each do |lib|
|
212
|
-
version = dependencies[lib]["version"]
|
213
|
-
archive = File.join("ports", "archives", "#{lib}-#{version}.tar.gz")
|
214
|
-
add_file_to_gem archive
|
215
|
-
patchesdir = File.join("patches", lib)
|
216
|
-
patches = `#{['git', 'ls-files', patchesdir].shelljoin}`.split("\n").grep(/\.patch\z/)
|
217
|
-
patches.each { |patch|
|
218
|
-
add_file_to_gem patch
|
219
|
-
}
|
220
|
-
(untracked = Dir[File.join(patchesdir, '*.patch')] - patches).empty? or
|
221
|
-
at_exit {
|
222
|
-
untracked.each { |patch|
|
223
|
-
puts "** WARNING: untracked patch file not added to gem: #{patch}"
|
224
|
-
}
|
225
|
-
}
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
Rake::ExtensionTask.new("nokogiri", HOE.spec) do |ext|
|
230
|
-
ext.lib_dir = File.join(*['lib', 'nokogiri', ENV['FAT_DIR']].compact)
|
231
|
-
ext.config_options << ENV['EXTOPTS']
|
232
|
-
if mingw_available
|
233
|
-
ext.cross_compile = true
|
234
|
-
ext.cross_platform = CROSS_RUBIES.map(&:platform).uniq
|
235
|
-
ext.cross_config_options << "--enable-cross-build"
|
236
|
-
ext.cross_compiling do |spec|
|
237
|
-
libs = dependencies.map { |name, dep| "#{name}-#{dep["version"]}" }.join(', ')
|
238
|
-
|
239
|
-
spec.post_install_message = <<-EOS
|
240
|
-
Nokogiri is built with the packaged libraries: #{libs}.
|
241
|
-
EOS
|
242
|
-
spec.files.reject! { |path| File.fnmatch?('ports/*', path) }
|
243
|
-
end
|
244
|
-
end
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
# ----------------------------------------
|
249
|
-
|
250
|
-
desc "Generate css/parser.rb and css/tokenizer.rex"
|
251
|
-
task 'generate' => [GENERATED_PARSER, GENERATED_TOKENIZER]
|
252
|
-
task 'gem:spec' => 'generate' if Rake::Task.task_defined?("gem:spec")
|
253
|
-
|
254
|
-
# This is a big hack to make sure that the racc and rexical
|
255
|
-
# dependencies in the Gemfile are constrainted to ruby platforms
|
256
|
-
# (i.e. MRI and Rubinius). There's no way to do that through hoe,
|
257
|
-
# and any solution will require changing hoe and hoe-bundler.
|
258
|
-
old_gemfile_task = Rake::Task['bundler:gemfile'] rescue nil
|
259
|
-
task 'bundler:gemfile' do
|
260
|
-
old_gemfile_task.invoke if old_gemfile_task
|
261
|
-
|
262
|
-
lines = File.open('Gemfile', 'r') { |f| f.readlines }.map do |line|
|
263
|
-
line =~ /racc|rexical/ ? "#{line.strip}, :platform => [:ruby, :mingw, :x64_mingw]" : line
|
264
|
-
end
|
265
|
-
File.open('Gemfile', 'w') { |f| lines.each { |line| f.puts line } }
|
266
|
-
end
|
267
|
-
|
268
|
-
file GENERATED_PARSER => "lib/nokogiri/css/parser.y" do |t|
|
269
|
-
sh "racc -l -o #{t.name} #{t.prerequisites.first}"
|
270
|
-
end
|
271
|
-
|
272
|
-
file GENERATED_TOKENIZER => "lib/nokogiri/css/tokenizer.rex" do |t|
|
273
|
-
sh "rex --independent -o #{t.name} #{t.prerequisites.first}"
|
274
|
-
end
|
275
|
-
|
276
|
-
[:compile, :check_manifest].each do |task_name|
|
277
|
-
Rake::Task[task_name].prerequisites << GENERATED_PARSER
|
278
|
-
Rake::Task[task_name].prerequisites << GENERATED_TOKENIZER
|
279
|
-
end
|
280
|
-
|
281
|
-
# ----------------------------------------
|
282
|
-
|
283
|
-
desc "set environment variables to build and/or test with debug options"
|
284
|
-
task :debug do
|
285
|
-
ENV['NOKOGIRI_DEBUG'] = "true"
|
286
|
-
ENV['CFLAGS'] ||= ""
|
287
|
-
ENV['CFLAGS'] += " -DDEBUG"
|
288
|
-
end
|
289
|
-
|
290
|
-
require File.join File.dirname(__FILE__), 'tasks/test'
|
291
|
-
|
292
|
-
task :java_debug do
|
293
|
-
ENV['JRUBY_OPTS'] = "#{ENV['JRUBY_OPTS']} --debug --dev"
|
294
|
-
ENV['JAVA_OPTS'] = '-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y' if ENV['JAVA_DEBUG']
|
295
|
-
end
|
296
|
-
|
297
|
-
Rake::Task[:test].prerequisites << :compile
|
298
|
-
Rake::Task[:test].prerequisites << :java_debug
|
299
|
-
Rake::Task[:test].prerequisites << :check_extra_deps unless java?
|
300
|
-
|
301
|
-
if Hoe.plugins.include?(:debugging)
|
302
|
-
['valgrind', 'valgrind:mem', 'valgrind:mem0'].each do |task_name|
|
303
|
-
Rake::Task["test:#{task_name}"].prerequisites << :compile
|
304
|
-
end
|
305
|
-
end
|
306
|
-
|
307
|
-
require 'concourse'
|
308
|
-
Concourse.new("nokogiri").create_tasks!
|
309
|
-
|
310
|
-
# ----------------------------------------
|
311
|
-
|
312
|
-
def verify_dll(dll, cross_ruby)
|
313
|
-
dll_imports = cross_ruby.dlls
|
314
|
-
dump = `#{['env', 'LANG=C', cross_ruby.tool('objdump'), '-p', dll].shelljoin}`
|
315
|
-
raise "unexpected file format for generated dll #{dll}" unless /file format #{Regexp.quote(cross_ruby.target)}\s/ === dump
|
316
|
-
raise "export function Init_nokogiri not in dll #{dll}" unless /Table.*\sInit_nokogiri\s/mi === dump
|
317
|
-
|
318
|
-
# Verify that the expected DLL dependencies match the actual dependencies
|
319
|
-
# and that no further dependencies exist.
|
320
|
-
dll_imports_is = dump.scan(/DLL Name: (.*)$/).map(&:first).map(&:downcase).uniq
|
321
|
-
if dll_imports_is.sort != dll_imports.sort
|
322
|
-
raise "unexpected dll imports #{dll_imports_is.inspect} in #{dll}"
|
323
|
-
end
|
324
|
-
puts "#{dll}: Looks good!"
|
325
|
-
end
|
326
|
-
|
327
|
-
task :cross do
|
328
|
-
rake_compiler_config_path = File.expand_path("~/.rake-compiler/config.yml")
|
329
|
-
unless File.exists? rake_compiler_config_path
|
330
|
-
raise "rake-compiler has not installed any cross rubies. Use rake-compiler-dock or 'rake gem:windows' for building binary windows gems."
|
331
|
-
end
|
332
|
-
|
333
|
-
CROSS_RUBIES.each do |cross_ruby|
|
334
|
-
task "tmp/#{cross_ruby.platform}/nokogiri/#{cross_ruby.ver}/nokogiri.so" do |t|
|
335
|
-
# To reduce the gem file size strip mingw32 dlls before packaging
|
336
|
-
sh [cross_ruby.tool('strip'), '-S', t.name].shelljoin
|
337
|
-
verify_dll t.name, cross_ruby
|
338
|
-
end
|
339
|
-
end
|
340
|
-
end
|
341
|
-
|
342
|
-
desc "build a windows gem without all the ceremony."
|
343
|
-
task "gem:windows" do
|
344
|
-
require "rake_compiler_dock"
|
345
|
-
RakeCompilerDock.sh "bundle && rake cross native gem MAKE='nice make -j`nproc`' RUBY_CC_VERSION=#{ENV['RUBY_CC_VERSION']}"
|
346
|
-
end
|
347
|
-
|
348
|
-
# vim: syntax=Ruby
|