nokogiri 1.9.0.rc1 → 1.9.0

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.

Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nokogiri/css/parser.rb +61 -61
  3. data/lib/nokogiri/version.rb +1 -1
  4. metadata +4 -146
  5. data/.autotest +0 -22
  6. data/.cross_rubies +0 -8
  7. data/.editorconfig +0 -17
  8. data/.gemtest +0 -0
  9. data/.travis.yml +0 -63
  10. data/CHANGELOG.md +0 -1402
  11. data/CONTRIBUTING.md +0 -42
  12. data/C_CODING_STYLE.rdoc +0 -33
  13. data/Gemfile +0 -23
  14. data/Gemfile-libxml-ruby +0 -3
  15. data/Manifest.txt +0 -371
  16. data/ROADMAP.md +0 -111
  17. data/Rakefile +0 -358
  18. data/SECURITY.md +0 -19
  19. data/STANDARD_RESPONSES.md +0 -47
  20. data/Y_U_NO_GEMSPEC.md +0 -155
  21. data/appveyor.yml +0 -29
  22. data/build_all +0 -48
  23. data/patches/sort-patches-by-date +0 -25
  24. data/suppressions/README.txt +0 -1
  25. data/suppressions/nokogiri_ruby-2.supp +0 -10
  26. data/tasks/test.rb +0 -100
  27. data/test/css/test_nthiness.rb +0 -226
  28. data/test/css/test_parser.rb +0 -386
  29. data/test/css/test_tokenizer.rb +0 -215
  30. data/test/css/test_xpath_visitor.rb +0 -96
  31. data/test/decorators/test_slop.rb +0 -23
  32. data/test/files/2ch.html +0 -108
  33. data/test/files/GH_1042.html +0 -18
  34. data/test/files/address_book.rlx +0 -12
  35. data/test/files/address_book.xml +0 -10
  36. data/test/files/atom.xml +0 -344
  37. data/test/files/bar/bar.xsd +0 -4
  38. data/test/files/bogus.xml +0 -0
  39. data/test/files/dont_hurt_em_why.xml +0 -422
  40. data/test/files/encoding.html +0 -82
  41. data/test/files/encoding.xhtml +0 -84
  42. data/test/files/exslt.xml +0 -8
  43. data/test/files/exslt.xslt +0 -35
  44. data/test/files/foo/foo.xsd +0 -4
  45. data/test/files/metacharset.html +0 -10
  46. data/test/files/namespace_pressure_test.xml +0 -1684
  47. data/test/files/noencoding.html +0 -47
  48. data/test/files/po.xml +0 -32
  49. data/test/files/po.xsd +0 -66
  50. data/test/files/saml/saml20assertion_schema.xsd +0 -283
  51. data/test/files/saml/saml20protocol_schema.xsd +0 -302
  52. data/test/files/saml/xenc_schema.xsd +0 -146
  53. data/test/files/saml/xmldsig_schema.xsd +0 -318
  54. data/test/files/shift_jis.html +0 -10
  55. data/test/files/shift_jis.xml +0 -5
  56. data/test/files/shift_jis_no_charset.html +0 -9
  57. data/test/files/slow-xpath.xml +0 -25509
  58. data/test/files/snuggles.xml +0 -3
  59. data/test/files/staff.dtd +0 -10
  60. data/test/files/staff.xml +0 -59
  61. data/test/files/staff.xslt +0 -32
  62. data/test/files/test_document_url/bar.xml +0 -2
  63. data/test/files/test_document_url/document.dtd +0 -4
  64. data/test/files/test_document_url/document.xml +0 -6
  65. data/test/files/tlm.html +0 -851
  66. data/test/files/to_be_xincluded.xml +0 -2
  67. data/test/files/valid_bar.xml +0 -2
  68. data/test/files/xinclude.xml +0 -4
  69. data/test/helper.rb +0 -271
  70. data/test/html/sax/test_parser.rb +0 -168
  71. data/test/html/sax/test_parser_context.rb +0 -46
  72. data/test/html/sax/test_parser_text.rb +0 -163
  73. data/test/html/sax/test_push_parser.rb +0 -87
  74. data/test/html/test_attributes.rb +0 -85
  75. data/test/html/test_builder.rb +0 -164
  76. data/test/html/test_document.rb +0 -722
  77. data/test/html/test_document_encoding.rb +0 -143
  78. data/test/html/test_document_fragment.rb +0 -310
  79. data/test/html/test_element_description.rb +0 -105
  80. data/test/html/test_named_characters.rb +0 -14
  81. data/test/html/test_node.rb +0 -212
  82. data/test/html/test_node_encoding.rb +0 -91
  83. data/test/namespaces/test_additional_namespaces_in_builder_doc.rb +0 -14
  84. data/test/namespaces/test_namespaces_aliased_default.rb +0 -24
  85. data/test/namespaces/test_namespaces_in_builder_doc.rb +0 -75
  86. data/test/namespaces/test_namespaces_in_cloned_doc.rb +0 -31
  87. data/test/namespaces/test_namespaces_in_created_doc.rb +0 -75
  88. data/test/namespaces/test_namespaces_in_parsed_doc.rb +0 -80
  89. data/test/namespaces/test_namespaces_preservation.rb +0 -31
  90. data/test/test_convert_xpath.rb +0 -135
  91. data/test/test_css_cache.rb +0 -47
  92. data/test/test_encoding_handler.rb +0 -48
  93. data/test/test_memory_leak.rb +0 -226
  94. data/test/test_nokogiri.rb +0 -138
  95. data/test/test_soap4r_sax.rb +0 -52
  96. data/test/test_xslt_transforms.rb +0 -314
  97. data/test/xml/node/test_save_options.rb +0 -28
  98. data/test/xml/node/test_subclass.rb +0 -44
  99. data/test/xml/sax/test_parser.rb +0 -402
  100. data/test/xml/sax/test_parser_context.rb +0 -115
  101. data/test/xml/sax/test_parser_text.rb +0 -202
  102. data/test/xml/sax/test_push_parser.rb +0 -265
  103. data/test/xml/test_attr.rb +0 -96
  104. data/test/xml/test_attribute_decl.rb +0 -86
  105. data/test/xml/test_builder.rb +0 -353
  106. data/test/xml/test_c14n.rb +0 -180
  107. data/test/xml/test_cdata.rb +0 -54
  108. data/test/xml/test_comment.rb +0 -40
  109. data/test/xml/test_document.rb +0 -982
  110. data/test/xml/test_document_encoding.rb +0 -31
  111. data/test/xml/test_document_fragment.rb +0 -312
  112. data/test/xml/test_dtd.rb +0 -187
  113. data/test/xml/test_dtd_encoding.rb +0 -31
  114. data/test/xml/test_element_content.rb +0 -56
  115. data/test/xml/test_element_decl.rb +0 -73
  116. data/test/xml/test_entity_decl.rb +0 -122
  117. data/test/xml/test_entity_reference.rb +0 -262
  118. data/test/xml/test_namespace.rb +0 -96
  119. data/test/xml/test_node.rb +0 -1379
  120. data/test/xml/test_node_attributes.rb +0 -115
  121. data/test/xml/test_node_encoding.rb +0 -75
  122. data/test/xml/test_node_inheritance.rb +0 -32
  123. data/test/xml/test_node_reparenting.rb +0 -661
  124. data/test/xml/test_node_set.rb +0 -828
  125. data/test/xml/test_parse_options.rb +0 -64
  126. data/test/xml/test_processing_instruction.rb +0 -30
  127. data/test/xml/test_reader.rb +0 -620
  128. data/test/xml/test_reader_encoding.rb +0 -134
  129. data/test/xml/test_relax_ng.rb +0 -60
  130. data/test/xml/test_schema.rb +0 -142
  131. data/test/xml/test_syntax_error.rb +0 -36
  132. data/test/xml/test_text.rb +0 -69
  133. data/test/xml/test_unparented_node.rb +0 -483
  134. data/test/xml/test_xinclude.rb +0 -83
  135. data/test/xml/test_xpath.rb +0 -470
  136. data/test/xslt/test_custom_functions.rb +0 -133
  137. 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,358 +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.4.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", "~> 2.0"],
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
- if java?
270
- warn "WARNING: #{GENERATED_PARSER} may be out of date:"
271
- sh "ls -lt #{t.name} #{t.prerequisites.first}"
272
- else
273
- sh "racc -l -o #{t.name} #{t.prerequisites.first}"
274
- end
275
- end
276
-
277
- file GENERATED_TOKENIZER => "lib/nokogiri/css/tokenizer.rex" do |t|
278
- if java?
279
- warn "WARNING: #{GENERATED_TOKENIZER} may be out of date:"
280
- sh "ls -lt #{t.name} #{t.prerequisites.first}"
281
- else
282
- sh "rex --independent -o #{t.name} #{t.prerequisites.first}"
283
- end
284
- end
285
-
286
- [:compile, :check_manifest].each do |task_name|
287
- Rake::Task[task_name].prerequisites << GENERATED_PARSER
288
- Rake::Task[task_name].prerequisites << GENERATED_TOKENIZER
289
- end
290
-
291
- # ----------------------------------------
292
-
293
- desc "set environment variables to build and/or test with debug options"
294
- task :debug do
295
- ENV['NOKOGIRI_DEBUG'] = "true"
296
- ENV['CFLAGS'] ||= ""
297
- ENV['CFLAGS'] += " -DDEBUG"
298
- end
299
-
300
- require File.join File.dirname(__FILE__), 'tasks/test'
301
-
302
- task :java_debug do
303
- ENV['JRUBY_OPTS'] = "#{ENV['JRUBY_OPTS']} --debug --dev"
304
- ENV['JAVA_OPTS'] = '-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y' if ENV['JAVA_DEBUG']
305
- end
306
-
307
- Rake::Task[:test].prerequisites << :compile
308
- Rake::Task[:test].prerequisites << :java_debug
309
- Rake::Task[:test].prerequisites << :check_extra_deps unless java?
310
-
311
- if Hoe.plugins.include?(:debugging)
312
- ['valgrind', 'valgrind:mem', 'valgrind:mem0'].each do |task_name|
313
- Rake::Task["test:#{task_name}"].prerequisites << :compile
314
- end
315
- end
316
-
317
- require 'concourse'
318
- Concourse.new("nokogiri").create_tasks!
319
-
320
- # ----------------------------------------
321
-
322
- def verify_dll(dll, cross_ruby)
323
- dll_imports = cross_ruby.dlls
324
- dump = `#{['env', 'LANG=C', cross_ruby.tool('objdump'), '-p', dll].shelljoin}`
325
- raise "unexpected file format for generated dll #{dll}" unless /file format #{Regexp.quote(cross_ruby.target)}\s/ === dump
326
- raise "export function Init_nokogiri not in dll #{dll}" unless /Table.*\sInit_nokogiri\s/mi === dump
327
-
328
- # Verify that the expected DLL dependencies match the actual dependencies
329
- # and that no further dependencies exist.
330
- dll_imports_is = dump.scan(/DLL Name: (.*)$/).map(&:first).map(&:downcase).uniq
331
- if dll_imports_is.sort != dll_imports.sort
332
- raise "unexpected dll imports #{dll_imports_is.inspect} in #{dll}"
333
- end
334
- puts "#{dll}: Looks good!"
335
- end
336
-
337
- task :cross do
338
- rake_compiler_config_path = File.expand_path("~/.rake-compiler/config.yml")
339
- unless File.exists? rake_compiler_config_path
340
- raise "rake-compiler has not installed any cross rubies. Use rake-compiler-dock or 'rake gem:windows' for building binary windows gems."
341
- end
342
-
343
- CROSS_RUBIES.each do |cross_ruby|
344
- task "tmp/#{cross_ruby.platform}/nokogiri/#{cross_ruby.ver}/nokogiri.so" do |t|
345
- # To reduce the gem file size strip mingw32 dlls before packaging
346
- sh [cross_ruby.tool('strip'), '-S', t.name].shelljoin
347
- verify_dll t.name, cross_ruby
348
- end
349
- end
350
- end
351
-
352
- desc "build a windows gem without all the ceremony."
353
- task "gem:windows" do
354
- require "rake_compiler_dock"
355
- RakeCompilerDock.sh "bundle && rake cross native gem MAKE='nice make -j`nproc`' RUBY_CC_VERSION=#{ENV['RUBY_CC_VERSION']}"
356
- end
357
-
358
- # vim: syntax=Ruby