nokogiri 1.5.0.beta.4-java → 1.5.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.

Files changed (87) hide show
  1. data/.gemtest +0 -0
  2. data/CHANGELOG.ja.rdoc +34 -0
  3. data/CHANGELOG.rdoc +40 -1
  4. data/Manifest.txt +11 -2
  5. data/README.rdoc +1 -1
  6. data/Rakefile +96 -105
  7. data/bin/nokogiri +1 -2
  8. data/ext/java/nokogiri/HtmlDocument.java +1 -31
  9. data/ext/java/nokogiri/HtmlSaxParserContext.java +1 -1
  10. data/ext/java/nokogiri/NokogiriService.java +77 -22
  11. data/ext/java/nokogiri/XmlAttr.java +5 -16
  12. data/ext/java/nokogiri/XmlCdata.java +4 -11
  13. data/ext/java/nokogiri/XmlComment.java +5 -5
  14. data/ext/java/nokogiri/XmlDocument.java +49 -59
  15. data/ext/java/nokogiri/XmlDocumentFragment.java +14 -8
  16. data/ext/java/nokogiri/XmlDtd.java +45 -43
  17. data/ext/java/nokogiri/XmlElement.java +19 -46
  18. data/ext/java/nokogiri/XmlElementDecl.java +9 -5
  19. data/ext/java/nokogiri/XmlEntityReference.java +24 -2
  20. data/ext/java/nokogiri/XmlNamespace.java +89 -34
  21. data/ext/java/nokogiri/XmlNode.java +31 -52
  22. data/ext/java/nokogiri/XmlNodeSet.java +42 -86
  23. data/ext/java/nokogiri/XmlProcessingInstruction.java +15 -19
  24. data/ext/java/nokogiri/XmlReader.java +40 -43
  25. data/ext/java/nokogiri/XmlSaxParserContext.java +2 -2
  26. data/ext/java/nokogiri/XmlSchema.java +14 -9
  27. data/ext/java/nokogiri/XmlText.java +18 -35
  28. data/ext/java/nokogiri/XmlXpathContext.java +43 -23
  29. data/ext/java/nokogiri/XsltStylesheet.java +17 -3
  30. data/ext/java/nokogiri/internals/HtmlDomParserContext.java +2 -4
  31. data/ext/java/nokogiri/internals/NokogiriHelpers.java +77 -20
  32. data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +13 -17
  33. data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +13 -1
  34. data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +23 -8
  35. data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +20 -3
  36. data/ext/java/nokogiri/internals/NokogiriXPathVariableResolver.java +67 -0
  37. data/ext/java/nokogiri/internals/NokogiriXsltErrorListener.java +86 -0
  38. data/ext/java/nokogiri/internals/ParserContext.java +25 -27
  39. data/ext/java/nokogiri/internals/ReaderNode.java +58 -1
  40. data/ext/java/nokogiri/internals/SaveContextVisitor.java +567 -0
  41. data/ext/java/nokogiri/internals/XmlDomParser.java +1 -2
  42. data/ext/java/nokogiri/internals/XmlDomParserContext.java +6 -0
  43. data/ext/nokogiri/nokogiri.c +24 -1
  44. data/ext/nokogiri/xml_io.c +32 -7
  45. data/ext/nokogiri/xml_node.c +14 -13
  46. data/ext/nokogiri/xml_sax_parser.c +9 -4
  47. data/ext/nokogiri/xslt_stylesheet.c +7 -1
  48. data/lib/nokogiri.rb +3 -22
  49. data/lib/nokogiri/css.rb +4 -0
  50. data/lib/nokogiri/html/document.rb +10 -14
  51. data/lib/nokogiri/nokogiri.jar +0 -0
  52. data/lib/nokogiri/version.rb +76 -23
  53. data/lib/nokogiri/xml/builder.rb +7 -0
  54. data/lib/nokogiri/xml/document.rb +17 -1
  55. data/lib/nokogiri/xml/document_fragment.rb +14 -0
  56. data/lib/nokogiri/xml/node.rb +36 -28
  57. data/lib/nokogiri/xml/node/save_options.rb +17 -1
  58. data/lib/nokogiri/xml/node_set.rb +7 -0
  59. data/lib/nokogiri/xml/parse_options.rb +8 -0
  60. data/lib/nokogiri/xml/reader.rb +6 -6
  61. data/lib/nokogiri/xml/schema.rb +7 -1
  62. data/lib/xercesImpl.jar +0 -0
  63. data/nokogiri_help_responses.md +40 -0
  64. data/tasks/cross_compile.rb +134 -159
  65. data/tasks/nokogiri.org.rb +18 -0
  66. data/tasks/test.rb +1 -1
  67. data/test/files/encoding.html +82 -0
  68. data/test/files/encoding.xhtml +84 -0
  69. data/test/files/metacharset.html +10 -0
  70. data/test/files/noencoding.html +47 -0
  71. data/test/helper.rb +2 -0
  72. data/test/html/test_document.rb +15 -0
  73. data/test/html/test_document_encoding.rb +13 -0
  74. data/test/test_memory_leak.rb +20 -0
  75. data/test/test_reader.rb +22 -0
  76. data/test/test_xslt_transforms.rb +6 -2
  77. data/test/xml/node/test_save_options.rb +10 -2
  78. data/test/xml/test_builder.rb +17 -0
  79. data/test/xml/test_document.rb +22 -0
  80. data/test/xml/test_node.rb +19 -1
  81. data/test/xml/test_node_reparenting.rb +16 -3
  82. data/test/xml/test_node_set.rb +34 -0
  83. data/test/xml/test_schema.rb +5 -0
  84. data/test/xslt/test_exception_handling.rb +37 -0
  85. metadata +141 -107
  86. data/deps.rip +0 -5
  87. data/ext/java/nokogiri/internals/SaveContext.java +0 -288
File without changes
@@ -1,3 +1,24 @@
1
+ == 1.5.0 / 2011年7月1日
2
+
3
+ * Notes
4
+
5
+ * See changelog from 1.4.7
6
+
7
+ * Features
8
+
9
+ * extracted sets of Node::SaveOptions into Node::SaveOptions::DEFAULT_{X,H,XH}TML (refactor)
10
+
11
+ * Bugfixes
12
+
13
+ * default output of XML on JRuby is no longer formatted due to
14
+ inconsistent whitespace handling. #415
15
+ * (JRuby) making empty NodeSets with null `nodes` member safe to operate on. #443
16
+ * Fix a bug in advanced encoding detection that leads to partially
17
+ duplicated document when parsing an HTML file with unknown
18
+ encoding.
19
+ * Add support for <meta charset="...">.
20
+
21
+
1
22
  == 1.5.0 beta3 2010年12月2日
2
23
 
3
24
  * 註
@@ -27,6 +48,19 @@
27
48
  * LibXML 2.6.16および古いバージョンは非推奨. インストールできない.
28
49
  * FFIサポートは削除された.
29
50
 
51
+ === 1.4.7 / 2011年7月1日
52
+
53
+ * バグの修正
54
+
55
+ * エンコーディング宣言のないHTMLファイルで部分的に重複したドキュメントが生成される問題を修正した. #478
56
+
57
+ === 1.4.6 / 2011年6月19日
58
+
59
+ * ノート
60
+
61
+ * このバージョンは、1.4.5と機能的に同じです
62
+ * Rubyの1.8.6のサポートが復元されている
63
+
30
64
  === 1.4.5 / 未リリース
31
65
 
32
66
  * 新機能
@@ -1,3 +1,23 @@
1
+ == 1.5.0 / 2011-07-01
2
+
3
+ * Notes
4
+
5
+ * See changelog from 1.4.7
6
+
7
+ * Features
8
+
9
+ * extracted sets of Node::SaveOptions into Node::SaveOptions::DEFAULT_{X,H,XH}TML (refactor)
10
+
11
+ * Bugfixes
12
+
13
+ * default output of XML on JRuby is no longer formatted due to
14
+ inconsistent whitespace handling. #415
15
+ * (JRuby) making empty NodeSets with null `nodes` member safe to operate on. #443
16
+ * Fix a bug in advanced encoding detection that leads to partially
17
+ duplicated document when parsing an HTML file with unknown
18
+ encoding.
19
+ * Add support for <meta charset="...">.
20
+
1
21
  == 1.5.0 beta3 / 2010/12/02
2
22
 
3
23
  * Notes
@@ -27,11 +47,28 @@
27
47
  * LibXML 2.6.16 and earlier are deprecated. Nokogiri will refuse to install.
28
48
  * FFI support is removed.
29
49
 
30
- === 1.4.5 / unrelease
50
+ === 1.4.7 / 2011-07-01
51
+
52
+ * Bugfixes
53
+
54
+ * Fix a bug in advanced encoding detection that leads to partially
55
+ duplicated document when parsing an HTML file with unknown
56
+ encoding. Thanks, Timothy Elliott (@ender672)! #478
57
+
58
+ === 1.4.6 / 2011-06-19
59
+
60
+ * Notes
61
+
62
+ * This version is functionally identical to 1.4.5.
63
+ * Ruby 1.8.6 support has been restored.
64
+
65
+ === 1.4.5 / 2011-05-19
31
66
 
32
67
  * New Features
33
68
 
34
69
  * Nokogiri::HTML::Document#title accessor gets and sets the document title.
70
+ * extracted sets of Node::SaveOptions into Node::SaveOptions::DEFAULT_{X,H,XH}TML (refactor)
71
+ * Raise an exception if a string is passed to Nokogiri::XML::Schema#validate. #406
35
72
 
36
73
  * Bugfixes
37
74
 
@@ -44,6 +81,8 @@
44
81
  * HTML::SAX::Parser should call back a block given to parse*() if any, just as XML::SAX::Parser does.
45
82
  * Add further encoding detection to HTML parser that libxml2 does not do.
46
83
  * Document#remove_namespaces! now handles attributes with namespaces. #396
84
+ * XSLT::Stylesheet#transform no longer segfaults when handed a non-XML::Document. #452
85
+ * XML::Reader no longer segfaults when under GC pressure. #439
47
86
 
48
87
  === 1.4.4 / 2010-11-15
49
88
 
@@ -1,4 +1,5 @@
1
1
  .autotest
2
+ .gemtest
2
3
  CHANGELOG.ja.rdoc
3
4
  CHANGELOG.rdoc
4
5
  Manifest.txt
@@ -6,7 +7,6 @@ README.ja.rdoc
6
7
  README.rdoc
7
8
  Rakefile
8
9
  bin/nokogiri
9
- deps.rip
10
10
  ext/java/nokogiri/EncodingHandler.java
11
11
  ext/java/nokogiri/HtmlDocument.java
12
12
  ext/java/nokogiri/HtmlElementDescription.java
@@ -50,10 +50,12 @@ ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java
50
50
  ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java
51
51
  ext/java/nokogiri/internals/NokogiriXPathFunction.java
52
52
  ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java
53
+ ext/java/nokogiri/internals/NokogiriXPathVariableResolver.java
54
+ ext/java/nokogiri/internals/NokogiriXsltErrorListener.java
53
55
  ext/java/nokogiri/internals/ParserContext.java
54
56
  ext/java/nokogiri/internals/PushInputStream.java
55
57
  ext/java/nokogiri/internals/ReaderNode.java
56
- ext/java/nokogiri/internals/SaveContext.java
58
+ ext/java/nokogiri/internals/SaveContextVisitor.java
57
59
  ext/java/nokogiri/internals/SchemaErrorHandler.java
58
60
  ext/java/nokogiri/internals/XmlDeclHandler.java
59
61
  ext/java/nokogiri/internals/XmlDomParser.java
@@ -193,7 +195,9 @@ lib/nokogiri/xslt.rb
193
195
  lib/nokogiri/xslt/stylesheet.rb
194
196
  lib/xercesImpl.jar
195
197
  lib/xsd/xmlparser/nokogiri.rb
198
+ nokogiri_help_responses.md
196
199
  tasks/cross_compile.rb
200
+ tasks/nokogiri.org.rb
197
201
  tasks/test.rb
198
202
  test/css/test_nthiness.rb
199
203
  test/css/test_parser.rb
@@ -205,9 +209,13 @@ test/files/address_book.rlx
205
209
  test/files/address_book.xml
206
210
  test/files/bar/bar.xsd
207
211
  test/files/dont_hurt_em_why.xml
212
+ test/files/encoding.html
213
+ test/files/encoding.xhtml
208
214
  test/files/exslt.xml
209
215
  test/files/exslt.xslt
210
216
  test/files/foo/foo.xsd
217
+ test/files/metacharset.html
218
+ test/files/noencoding.html
211
219
  test/files/po.xml
212
220
  test/files/po.xsd
213
221
  test/files/shift_jis.html
@@ -272,3 +280,4 @@ test/xml/test_text.rb
272
280
  test/xml/test_unparented_node.rb
273
281
  test/xml/test_xpath.rb
274
282
  test/xslt/test_custom_functions.rb
283
+ test/xslt/test_exception_handling.rb
@@ -120,7 +120,7 @@ installed.
120
120
 
121
121
  Then install hoe and rake-compiler:
122
122
 
123
- $ gem install hoe rake-compiler
123
+ $ gem install hoe rake-compiler racc rexical minitest
124
124
 
125
125
  Then run rake:
126
126
 
data/Rakefile CHANGED
@@ -1,129 +1,112 @@
1
1
  # -*- ruby -*-
2
-
3
2
  require 'rubygems'
4
- gem 'hoe', '>= 2.1.0'
5
- require 'hoe'
6
3
 
7
- windows = RUBY_PLATFORM =~ /(mswin|mingw)/i
8
- java = RUBY_PLATFORM =~ /java/
4
+ gem 'hoe'
5
+ require 'hoe'
6
+ Hoe.plugin :debugging
7
+ Hoe.plugin :git
8
+ Hoe.plugin :gemspec
9
+ Hoe.plugin :bundler
10
+ Hoe.add_include_dirs '.' # for ruby 1.9.2
9
11
 
10
12
  GENERATED_PARSER = "lib/nokogiri/css/parser.rb"
11
13
  GENERATED_TOKENIZER = "lib/nokogiri/css/tokenizer.rb"
12
- CROSS_DIR = File.join(File.dirname(__FILE__), 'tmp', 'cross')
14
+ CROSS_DIR = File.join(File.dirname(__FILE__), 'ports')
13
15
 
14
- EXTERNAL_JAVA_LIBRARIES = %w{isorelax jing nekohtml nekodtd xercesImpl}.map{|x| "lib/#{x}.jar"}
15
- JRUBY_HOME = Config::CONFIG['prefix']
16
- LIB_DIR = File.expand_path('lib')
17
- CLASSPATH = "#{JRUBY_HOME}/lib/jruby.jar:#{LIB_DIR}/nekohtml.jar:#{LIB_DIR}/nekodtd.jar:#{LIB_DIR}/xercesImpl.jar:#{LIB_DIR}/isorelax.jar:#{LIB_DIR}/jing.jar"
18
-
19
- # Make sure hoe-debugging is installed
20
- Hoe.plugin :debugging
21
- Hoe.plugin :git
16
+ def java?
17
+ !! (RUBY_PLATFORM =~ /java/)
18
+ end
22
19
 
20
+ require 'tasks/nokogiri.org'
23
21
 
24
22
  HOE = Hoe.spec 'nokogiri' do
25
- developer('Aaron Patterson', 'aaronp@rubyforge.org')
26
- developer('Mike Dalessio', 'mike.dalessio@gmail.com')
27
- self.readme_file = ['README', ENV['HLANG'], 'rdoc'].compact.join('.')
28
- self.history_file = ['CHANGELOG', ENV['HLANG'], 'rdoc'].compact.join('.')
29
- self.extra_rdoc_files = FileList['*.rdoc','ext/nokogiri/*.c']
30
- self.clean_globs = [
23
+ developer 'Aaron Patterson', 'aaronp@rubyforge.org'
24
+ developer 'Mike Dalessio', 'mike.dalessio@gmail.com'
25
+ developer 'Yoko Harada', 'yokolet@gmail.com'
26
+
27
+ self.readme_file = ['README', ENV['HLANG'], 'rdoc'].compact.join('.')
28
+ self.history_file = ['CHANGELOG', ENV['HLANG'], 'rdoc'].compact.join('.')
29
+
30
+ self.extra_rdoc_files = FileList['*.rdoc','ext/nokogiri/*.c']
31
+
32
+ self.clean_globs += [
33
+ 'nokogiri.gemspec',
31
34
  'lib/nokogiri/*.{o,so,bundle,a,log,dll}',
35
+ 'lib/nokogiri/nokogiri.{so,dylib,rb,bundle}',
32
36
  'lib/nokogiri/nokogiri.rb',
33
37
  'lib/nokogiri/1.{8,9}',
34
38
  GENERATED_PARSER,
35
- GENERATED_TOKENIZER,
36
- 'cross',
39
+ GENERATED_TOKENIZER
37
40
  ]
38
41
 
39
- %w{ racc rexical rake-compiler }.each do |dep|
40
- extra_dev_deps << [dep, '>= 0']
41
- end
42
- extra_dev_deps << ["minitest", ">= 1.6.0"]
42
+ self.extra_dev_deps += [
43
+ ["racc", ">= 1.4.6"],
44
+ ["rexical", ">= 1.0.5"],
45
+ ["rake-compiler", ">= 0.7.9"],
46
+ ["minitest", "~> 2.2.2"],
47
+ ["mini_portile", ">= 0.2.2"],
48
+ ["hoe-debugging", ">= 0"],
49
+ ["hoe-git", ">= 0"],
50
+ ["hoe-gemspec", ">= 0"],
51
+ ["hoe-bundler", ">= 0"]
52
+ ]
43
53
 
44
- if java
54
+ if java?
45
55
  self.spec_extras = { :platform => 'java' }
46
56
  else
47
- self.spec_extras = { :extensions => ["ext/nokogiri/extconf.rb"] }
57
+ self.spec_extras = {
58
+ :extensions => ["ext/nokogiri/extconf.rb"],
59
+ :required_ruby_version => '>= 1.8.7'
60
+ }
48
61
  end
49
62
 
50
63
  self.testlib = :minitest
51
64
  end
52
65
 
53
- Hoe.add_include_dirs '.'
54
-
55
- task :ws_docs do
56
- title = "#{HOE.name}-#{HOE.version} Documentation"
57
-
58
- options = []
59
- options << "--main=#{HOE.readme_file}"
60
- options << '--format=activerecord'
61
- options << '--threads=1'
62
- options << "--title=#{title.inspect}"
63
-
64
- options += HOE.spec.require_paths
65
- options += HOE.spec.extra_rdoc_files
66
- require 'rdoc/rdoc'
67
- ENV['RAILS_ROOT'] ||= File.expand_path(File.join('..', 'nokogiri_ws'))
68
- RDoc::RDoc.new.document options
69
- end
70
-
66
+ # ----------------------------------------
71
67
 
72
- gem 'rake-compiler', '>= 0.4.1'
73
- if java
68
+ if java?
69
+ # TODO: clean this section up.
74
70
  require "rake/javaextensiontask"
75
71
  Rake::JavaExtensionTask.new("nokogiri", HOE.spec) do |ext|
72
+ jruby_home = RbConfig::CONFIG['prefix']
76
73
  ext.ext_dir = 'ext/java'
77
- ext.classpath = CLASSPATH
74
+ ext.lib_dir = 'lib/nokogiri'
75
+ jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar']
76
+ ext.classpath = jars.map { |x| File.expand_path x }.join ':'
78
77
  end
79
- path = "pkg/#{HOE.spec.name}-#{HOE.spec.version}"
80
- task path => :compile do
81
- cp 'lib/nokogiri/nokogiri.jar', File.join(path, 'lib')
78
+
79
+ gem_build_path = File.join 'pkg', HOE.spec.full_name
80
+
81
+ task gem_build_path => [:compile] do
82
+ cp 'lib/nokogiri/nokogiri.jar', File.join(gem_build_path, 'lib', 'nokogiri')
82
83
  HOE.spec.files += ['lib/nokogiri/nokogiri.jar']
83
84
  end
84
85
  else
86
+ require 'tasks/cross_compile'
85
87
  require "rake/extensiontask"
86
88
  Rake::ExtensionTask.new("nokogiri", HOE.spec) do |ext|
87
89
  ext.lib_dir = File.join(*['lib', 'nokogiri', ENV['FAT_DIR']].compact)
88
-
89
90
  ext.config_options << ENV['EXTOPTS']
90
- ext.cross_compile = true
91
- ext.cross_platform = 'i386-mingw32'
92
- # ext.cross_platform = 'i386-mswin32'
93
- ext.cross_config_options <<
94
- "--with-xml2-include=#{File.join(CROSS_DIR, 'include', 'libxml2')}"
95
- ext.cross_config_options <<
96
- "--with-xml2-lib=#{File.join(CROSS_DIR, 'lib')}"
97
- ext.cross_config_options << "--with-iconv-dir=#{CROSS_DIR}"
98
- ext.cross_config_options << "--with-xslt-dir=#{CROSS_DIR}"
91
+ ext.cross_compile = true
92
+ ext.cross_platform = ["x86-mswin32-60", "x86-mingw32"]
93
+ ext.cross_config_options << "--with-xml2-include=#{File.join($recipes[:libxml2].path, 'include', 'libxml2')}"
94
+ ext.cross_config_options << "--with-xml2-lib=#{File.join($recipes[:libxml2].path, 'lib')}"
95
+ ext.cross_config_options << "--with-iconv-dir=#{$recipes[:libiconv].path}"
96
+ ext.cross_config_options << "--with-xslt-dir=#{$recipes[:libxslt].path}"
99
97
  ext.cross_config_options << "--with-zlib-dir=#{CROSS_DIR}"
100
98
  end
101
99
  end
102
100
 
103
- namespace :java do
104
- task :spec do
105
- File.open("#{HOE.name}.gemspec", 'w') do |f|
106
- f.write(HOE.spec.to_ruby)
107
- end
108
- end
109
- end
110
-
111
- namespace :gem do
112
- namespace :dev do
113
- task :spec => [ GENERATED_PARSER, GENERATED_TOKENIZER ] do
114
- File.open("#{HOE.name}.gemspec", 'w') do |f|
115
- HOE.spec.version = "#{HOE.version}.#{Time.now.strftime("%Y%m%d%H%M%S")}"
116
- f.write(HOE.spec.to_ruby)
117
- end
118
- end
119
- end
101
+ # ----------------------------------------
120
102
 
121
- task :spec => ['gem:dev:spec']
122
- end
103
+ desc "Generate css/parser.rb and css/tokenizer.rex"
104
+ task 'generate' => [GENERATED_PARSER, GENERATED_TOKENIZER]
105
+ task 'gem:spec' => 'generate' if Rake::Task.task_defined?("gem:spec")
123
106
 
124
107
  file GENERATED_PARSER => "lib/nokogiri/css/parser.y" do |t|
125
- racc = Config::CONFIG['target_os'] =~ /mswin32/ ? '' : `which racc`.strip
126
- racc = "#{::Config::CONFIG['bindir']}/racc" if racc.empty?
108
+ racc = RbConfig::CONFIG['target_os'] =~ /mswin32/ ? '' : `which racc`.strip
109
+ racc = "#{::RbConfig::CONFIG['bindir']}/racc" if racc.empty?
127
110
  sh "#{racc} -l -o #{t.name} #{t.prerequisites.first}"
128
111
  end
129
112
 
@@ -131,13 +114,13 @@ file GENERATED_TOKENIZER => "lib/nokogiri/css/tokenizer.rex" do |t|
131
114
  sh "rex --independent -o #{t.name} #{t.prerequisites.first}"
132
115
  end
133
116
 
134
- require 'tasks/test'
135
- begin
136
- require 'tasks/cross_compile' unless java
137
- rescue RuntimeError => e
138
- warn "WARNING: Could not perform some cross-compiling: #{e}"
117
+ [:compile, :check_manifest].each do |task_name|
118
+ Rake::Task[task_name].prerequisites << GENERATED_PARSER
119
+ Rake::Task[task_name].prerequisites << GENERATED_TOKENIZER
139
120
  end
140
121
 
122
+ # ----------------------------------------
123
+
141
124
  desc "set environment variables to build and/or test with debug options"
142
125
  task :debug do
143
126
  ENV['NOKOGIRI_DEBUG'] = "true"
@@ -145,29 +128,37 @@ task :debug do
145
128
  ENV['CFLAGS'] += " -DDEBUG"
146
129
  end
147
130
 
148
- # required_ruby_version
131
+ require 'tasks/test'
149
132
 
150
- # Only do this on unix, since we can't build on windows
151
- unless windows
152
- [:compile, :check_manifest].each do |task_name|
153
- Rake::Task[task_name].prerequisites << GENERATED_PARSER
154
- Rake::Task[task_name].prerequisites << GENERATED_TOKENIZER
155
- if java
156
- Rake::Task[task_name].prerequisites.concat EXTERNAL_JAVA_LIBRARIES
157
- end
133
+ Rake::Task[:test].prerequisites << :compile
134
+ Rake::Task[:test].prerequisites << :check_extra_deps unless java?
135
+ if Hoe.plugins.include?(:debugging)
136
+ ['valgrind', 'valgrind:mem', 'valgrind:mem0'].each do |task_name|
137
+ Rake::Task["test:#{task_name}"].prerequisites << :compile
158
138
  end
139
+ end
159
140
 
160
- Rake::Task[:test].prerequisites << :compile
161
- Rake::Task[:test].prerequisites << :check_extra_deps unless java
162
- if Hoe.plugins.include?(:debugging)
163
- ['valgrind', 'valgrind:mem', 'valgrind:mem0'].each do |task_name|
164
- Rake::Task["test:#{task_name}"].prerequisites << :compile
141
+ # ----------------------------------------
142
+
143
+ desc "build a windows gem without all the ceremony."
144
+ task "gem:windows" do
145
+ rake_compiler_config = YAML.load_file("#{ENV['HOME']}/.rake-compiler/config.yml")
146
+
147
+ # check that rake-compiler config contains the right patchlevels of 1.8.6 and 1.9.1. see #279.
148
+ ["1.8.6-p383", "1.9.1-p243"].each do |version|
149
+ majmin, patchlevel = version.split("-")
150
+ rbconfig = "rbconfig-#{majmin}"
151
+ unless rake_compiler_config.key?(rbconfig) && rake_compiler_config[rbconfig] =~ /-#{patchlevel}/
152
+ raise "rake-compiler '#{rbconfig}' not #{patchlevel}. try running 'env --unset=HOST rake-compiler cross-ruby VERSION=#{version}'"
165
153
  end
166
154
  end
167
- end
168
155
 
169
- namespace :rip do
170
- task :install => [GENERATED_TOKENIZER, GENERATED_PARSER]
156
+ # verify that --export-all is in the 1.9.1 rbconfig. see #279,#374,#375.
157
+ rbconfig_191 = rake_compiler_config["rbconfig-1.9.1"]
158
+ raise "rbconfig #{rbconfig_191} needs --export-all in its DLDFLAGS value" if File.read(rbconfig_191).grep(/CONFIG\["DLDFLAGS"\].*--export-all/).empty?
159
+
160
+ pkg_config_path = [:libxslt, :libxml2].collect { |pkg| File.join($recipes[pkg].path, "lib/pkgconfig") }.join(":")
161
+ sh("env PKG_CONFIG_PATH=#{pkg_config_path} RUBY_CC_VERSION=1.8.6:1.9.1 rake cross native gem") || raise("build failed!")
171
162
  end
172
163
 
173
164
  # vim: syntax=Ruby
@@ -33,8 +33,7 @@ opts = OptionParser.new do |opts|
33
33
  end
34
34
 
35
35
  opts.on_tail("-v", "--version", "Show version") do
36
- require 'yaml'
37
- puts Nokogiri::VERSION_INFO.to_yaml
36
+ puts Nokogiri::VersionInfo.instance.to_markdown
38
37
  exit
39
38
  end
40
39
  end