nokogiri 1.5.0.beta.4 → 1.5.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 (107) 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 +100 -104
  7. data/bin/nokogiri +1 -2
  8. data/ext/nokogiri/nokogiri.c +24 -1
  9. data/ext/nokogiri/xml_io.c +32 -7
  10. data/ext/nokogiri/xml_node.c +14 -13
  11. data/ext/nokogiri/xml_sax_parser.c +9 -4
  12. data/ext/nokogiri/xslt_stylesheet.c +7 -1
  13. data/lib/nokogiri.rb +3 -22
  14. data/lib/nokogiri/css.rb +4 -0
  15. data/lib/nokogiri/html/document.rb +10 -14
  16. data/lib/nokogiri/version.rb +76 -23
  17. data/lib/nokogiri/xml/builder.rb +7 -0
  18. data/lib/nokogiri/xml/document.rb +17 -1
  19. data/lib/nokogiri/xml/document_fragment.rb +14 -0
  20. data/lib/nokogiri/xml/node.rb +36 -28
  21. data/lib/nokogiri/xml/node/save_options.rb +17 -1
  22. data/lib/nokogiri/xml/node_set.rb +7 -0
  23. data/lib/nokogiri/xml/parse_options.rb +8 -0
  24. data/lib/nokogiri/xml/reader.rb +6 -6
  25. data/lib/nokogiri/xml/schema.rb +7 -1
  26. data/nokogiri_help_responses.md +40 -0
  27. data/tasks/cross_compile.rb +134 -159
  28. data/tasks/nokogiri.org.rb +18 -0
  29. data/tasks/test.rb +1 -1
  30. data/test/files/encoding.html +82 -0
  31. data/test/files/encoding.xhtml +84 -0
  32. data/test/files/metacharset.html +10 -0
  33. data/test/files/noencoding.html +47 -0
  34. data/test/helper.rb +2 -0
  35. data/test/html/test_document.rb +15 -0
  36. data/test/html/test_document_encoding.rb +13 -0
  37. data/test/test_memory_leak.rb +20 -0
  38. data/test/test_reader.rb +22 -0
  39. data/test/test_xslt_transforms.rb +6 -2
  40. data/test/xml/node/test_save_options.rb +10 -2
  41. data/test/xml/test_builder.rb +17 -0
  42. data/test/xml/test_document.rb +22 -0
  43. data/test/xml/test_node.rb +19 -1
  44. data/test/xml/test_node_reparenting.rb +16 -3
  45. data/test/xml/test_node_set.rb +34 -0
  46. data/test/xml/test_schema.rb +5 -0
  47. data/test/xslt/test_exception_handling.rb +37 -0
  48. metadata +185 -157
  49. data/deps.rip +0 -5
  50. data/ext/java/nokogiri/EncodingHandler.java +0 -124
  51. data/ext/java/nokogiri/HtmlDocument.java +0 -149
  52. data/ext/java/nokogiri/HtmlElementDescription.java +0 -145
  53. data/ext/java/nokogiri/HtmlEntityLookup.java +0 -79
  54. data/ext/java/nokogiri/HtmlSaxParserContext.java +0 -259
  55. data/ext/java/nokogiri/NokogiriService.java +0 -535
  56. data/ext/java/nokogiri/XmlAttr.java +0 -191
  57. data/ext/java/nokogiri/XmlAttributeDecl.java +0 -130
  58. data/ext/java/nokogiri/XmlCdata.java +0 -91
  59. data/ext/java/nokogiri/XmlComment.java +0 -86
  60. data/ext/java/nokogiri/XmlDocument.java +0 -529
  61. data/ext/java/nokogiri/XmlDocumentFragment.java +0 -217
  62. data/ext/java/nokogiri/XmlDtd.java +0 -467
  63. data/ext/java/nokogiri/XmlElement.java +0 -222
  64. data/ext/java/nokogiri/XmlElementContent.java +0 -382
  65. data/ext/java/nokogiri/XmlElementDecl.java +0 -148
  66. data/ext/java/nokogiri/XmlEntityDecl.java +0 -162
  67. data/ext/java/nokogiri/XmlEntityReference.java +0 -75
  68. data/ext/java/nokogiri/XmlNamespace.java +0 -128
  69. data/ext/java/nokogiri/XmlNode.java +0 -1399
  70. data/ext/java/nokogiri/XmlNodeSet.java +0 -311
  71. data/ext/java/nokogiri/XmlProcessingInstruction.java +0 -103
  72. data/ext/java/nokogiri/XmlReader.java +0 -411
  73. data/ext/java/nokogiri/XmlRelaxng.java +0 -144
  74. data/ext/java/nokogiri/XmlSaxParserContext.java +0 -367
  75. data/ext/java/nokogiri/XmlSaxPushParser.java +0 -184
  76. data/ext/java/nokogiri/XmlSchema.java +0 -319
  77. data/ext/java/nokogiri/XmlSyntaxError.java +0 -119
  78. data/ext/java/nokogiri/XmlText.java +0 -136
  79. data/ext/java/nokogiri/XmlXpathContext.java +0 -179
  80. data/ext/java/nokogiri/XsltStylesheet.java +0 -183
  81. data/ext/java/nokogiri/internals/HtmlDomParserContext.java +0 -206
  82. data/ext/java/nokogiri/internals/NokogiriDocumentCache.java +0 -73
  83. data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +0 -86
  84. data/ext/java/nokogiri/internals/NokogiriHandler.java +0 -327
  85. data/ext/java/nokogiri/internals/NokogiriHelpers.java +0 -582
  86. data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +0 -171
  87. data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +0 -118
  88. data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler.java +0 -74
  89. data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +0 -121
  90. data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +0 -79
  91. data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +0 -126
  92. data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +0 -56
  93. data/ext/java/nokogiri/internals/ParserContext.java +0 -278
  94. data/ext/java/nokogiri/internals/PushInputStream.java +0 -411
  95. data/ext/java/nokogiri/internals/ReaderNode.java +0 -474
  96. data/ext/java/nokogiri/internals/SaveContext.java +0 -288
  97. data/ext/java/nokogiri/internals/SchemaErrorHandler.java +0 -76
  98. data/ext/java/nokogiri/internals/XmlDeclHandler.java +0 -42
  99. data/ext/java/nokogiri/internals/XmlDomParser.java +0 -77
  100. data/ext/java/nokogiri/internals/XmlDomParserContext.java +0 -238
  101. data/ext/java/nokogiri/internals/XmlSaxParser.java +0 -65
  102. data/ext/java/nokogiri/internals/XsltExtensionFunction.java +0 -72
  103. data/lib/isorelax.jar +0 -0
  104. data/lib/jing.jar +0 -0
  105. data/lib/nekodtd.jar +0 -0
  106. data/lib/nekohtml.jar +0 -0
  107. data/lib/xercesImpl.jar +0 -0
data/.gemtest ADDED
File without changes
data/CHANGELOG.ja.rdoc CHANGED
@@ -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
  * 新機能
data/CHANGELOG.rdoc CHANGED
@@ -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
 
data/Manifest.txt CHANGED
@@ -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
data/README.rdoc CHANGED
@@ -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,117 @@
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"
88
+
89
+ HOE.spec.files.reject! { |f| f =~ %r{^ext/java|\.jar$} }
90
+
86
91
  Rake::ExtensionTask.new("nokogiri", HOE.spec) do |ext|
87
92
  ext.lib_dir = File.join(*['lib', 'nokogiri', ENV['FAT_DIR']].compact)
88
-
89
93
  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}"
94
+ ext.cross_compile = true
95
+ ext.cross_platform = ["x86-mswin32-60", "x86-mingw32"]
96
+ ext.cross_config_options << "--with-xml2-include=#{File.join($recipes[:libxml2].path, 'include', 'libxml2')}"
97
+ ext.cross_config_options << "--with-xml2-lib=#{File.join($recipes[:libxml2].path, 'lib')}"
98
+ ext.cross_config_options << "--with-iconv-dir=#{$recipes[:libiconv].path}"
99
+ ext.cross_config_options << "--with-xslt-dir=#{$recipes[:libxslt].path}"
99
100
  ext.cross_config_options << "--with-zlib-dir=#{CROSS_DIR}"
100
101
  end
101
102
  end
102
103
 
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
104
+ puts HOE.spec.files
110
105
 
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
106
+ # ----------------------------------------
120
107
 
121
- task :spec => ['gem:dev:spec']
122
- end
108
+ desc "Generate css/parser.rb and css/tokenizer.rex"
109
+ task 'generate' => [GENERATED_PARSER, GENERATED_TOKENIZER]
110
+ task 'gem:spec' => 'generate' if Rake::Task.task_defined?("gem:spec")
123
111
 
124
112
  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?
113
+ racc = RbConfig::CONFIG['target_os'] =~ /mswin32/ ? '' : `which racc`.strip
114
+ racc = "#{::RbConfig::CONFIG['bindir']}/racc" if racc.empty?
127
115
  sh "#{racc} -l -o #{t.name} #{t.prerequisites.first}"
128
116
  end
129
117
 
@@ -131,13 +119,13 @@ file GENERATED_TOKENIZER => "lib/nokogiri/css/tokenizer.rex" do |t|
131
119
  sh "rex --independent -o #{t.name} #{t.prerequisites.first}"
132
120
  end
133
121
 
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}"
122
+ [:compile, :check_manifest].each do |task_name|
123
+ Rake::Task[task_name].prerequisites << GENERATED_PARSER
124
+ Rake::Task[task_name].prerequisites << GENERATED_TOKENIZER
139
125
  end
140
126
 
127
+ # ----------------------------------------
128
+
141
129
  desc "set environment variables to build and/or test with debug options"
142
130
  task :debug do
143
131
  ENV['NOKOGIRI_DEBUG'] = "true"
@@ -145,29 +133,37 @@ task :debug do
145
133
  ENV['CFLAGS'] += " -DDEBUG"
146
134
  end
147
135
 
148
- # required_ruby_version
136
+ require 'tasks/test'
149
137
 
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
138
+ Rake::Task[:test].prerequisites << :compile
139
+ Rake::Task[:test].prerequisites << :check_extra_deps unless java?
140
+ if Hoe.plugins.include?(:debugging)
141
+ ['valgrind', 'valgrind:mem', 'valgrind:mem0'].each do |task_name|
142
+ Rake::Task["test:#{task_name}"].prerequisites << :compile
158
143
  end
144
+ end
159
145
 
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
146
+ # ----------------------------------------
147
+
148
+ desc "build a windows gem without all the ceremony."
149
+ task "gem:windows" do
150
+ rake_compiler_config = YAML.load_file("#{ENV['HOME']}/.rake-compiler/config.yml")
151
+
152
+ # check that rake-compiler config contains the right patchlevels of 1.8.6 and 1.9.1. see #279.
153
+ ["1.8.6-p383", "1.9.1-p243"].each do |version|
154
+ majmin, patchlevel = version.split("-")
155
+ rbconfig = "rbconfig-#{majmin}"
156
+ unless rake_compiler_config.key?(rbconfig) && rake_compiler_config[rbconfig] =~ /-#{patchlevel}/
157
+ raise "rake-compiler '#{rbconfig}' not #{patchlevel}. try running 'env --unset=HOST rake-compiler cross-ruby VERSION=#{version}'"
165
158
  end
166
159
  end
167
- end
168
160
 
169
- namespace :rip do
170
- task :install => [GENERATED_TOKENIZER, GENERATED_PARSER]
161
+ # verify that --export-all is in the 1.9.1 rbconfig. see #279,#374,#375.
162
+ rbconfig_191 = rake_compiler_config["rbconfig-1.9.1"]
163
+ raise "rbconfig #{rbconfig_191} needs --export-all in its DLDFLAGS value" if File.read(rbconfig_191).grep(/CONFIG\["DLDFLAGS"\].*--export-all/).empty?
164
+
165
+ pkg_config_path = [:libxslt, :libxml2].collect { |pkg| File.join($recipes[pkg].path, "lib/pkgconfig") }.join(":")
166
+ 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
167
  end
172
168
 
173
169
  # vim: syntax=Ruby
data/bin/nokogiri CHANGED
@@ -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