nokogiri-fitzsimmons 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +26 -0
- data/.gemtest +0 -0
- data/CHANGELOG.ja.rdoc +666 -0
- data/CHANGELOG.rdoc +659 -0
- data/C_CODING_STYLE.rdoc +33 -0
- data/Manifest.txt +295 -0
- data/README.ja.rdoc +106 -0
- data/README.rdoc +178 -0
- data/ROADMAP.md +86 -0
- data/Rakefile +194 -0
- data/STANDARD_RESPONSES.md +47 -0
- data/Y_U_NO_GEMSPEC.md +155 -0
- data/bin/nokogiri +63 -0
- data/build_all +58 -0
- data/ext/nokogiri/depend +358 -0
- data/ext/nokogiri/extconf.rb +142 -0
- data/ext/nokogiri/html_document.c +170 -0
- data/ext/nokogiri/html_document.h +10 -0
- data/ext/nokogiri/html_element_description.c +276 -0
- data/ext/nokogiri/html_element_description.h +10 -0
- data/ext/nokogiri/html_entity_lookup.c +32 -0
- data/ext/nokogiri/html_entity_lookup.h +8 -0
- data/ext/nokogiri/html_sax_parser_context.c +116 -0
- data/ext/nokogiri/html_sax_parser_context.h +11 -0
- data/ext/nokogiri/html_sax_push_parser.c +87 -0
- data/ext/nokogiri/html_sax_push_parser.h +9 -0
- data/ext/nokogiri/nokogiri.c +133 -0
- data/ext/nokogiri/nokogiri.h +160 -0
- data/ext/nokogiri/xml_attr.c +94 -0
- data/ext/nokogiri/xml_attr.h +9 -0
- data/ext/nokogiri/xml_attribute_decl.c +70 -0
- data/ext/nokogiri/xml_attribute_decl.h +9 -0
- data/ext/nokogiri/xml_cdata.c +56 -0
- data/ext/nokogiri/xml_cdata.h +9 -0
- data/ext/nokogiri/xml_comment.c +54 -0
- data/ext/nokogiri/xml_comment.h +9 -0
- data/ext/nokogiri/xml_document.c +576 -0
- data/ext/nokogiri/xml_document.h +23 -0
- data/ext/nokogiri/xml_document_fragment.c +48 -0
- data/ext/nokogiri/xml_document_fragment.h +10 -0
- data/ext/nokogiri/xml_dtd.c +202 -0
- data/ext/nokogiri/xml_dtd.h +10 -0
- data/ext/nokogiri/xml_element_content.c +123 -0
- data/ext/nokogiri/xml_element_content.h +10 -0
- data/ext/nokogiri/xml_element_decl.c +69 -0
- data/ext/nokogiri/xml_element_decl.h +9 -0
- data/ext/nokogiri/xml_encoding_handler.c +79 -0
- data/ext/nokogiri/xml_encoding_handler.h +8 -0
- data/ext/nokogiri/xml_entity_decl.c +110 -0
- data/ext/nokogiri/xml_entity_decl.h +10 -0
- data/ext/nokogiri/xml_entity_reference.c +52 -0
- data/ext/nokogiri/xml_entity_reference.h +9 -0
- data/ext/nokogiri/xml_io.c +56 -0
- data/ext/nokogiri/xml_io.h +11 -0
- data/ext/nokogiri/xml_libxml2_hacks.c +112 -0
- data/ext/nokogiri/xml_libxml2_hacks.h +12 -0
- data/ext/nokogiri/xml_namespace.c +78 -0
- data/ext/nokogiri/xml_namespace.h +13 -0
- data/ext/nokogiri/xml_node.c +1480 -0
- data/ext/nokogiri/xml_node.h +13 -0
- data/ext/nokogiri/xml_node_set.c +467 -0
- data/ext/nokogiri/xml_node_set.h +14 -0
- data/ext/nokogiri/xml_processing_instruction.c +56 -0
- data/ext/nokogiri/xml_processing_instruction.h +9 -0
- data/ext/nokogiri/xml_reader.c +684 -0
- data/ext/nokogiri/xml_reader.h +10 -0
- data/ext/nokogiri/xml_relax_ng.c +161 -0
- data/ext/nokogiri/xml_relax_ng.h +9 -0
- data/ext/nokogiri/xml_sax_parser.c +293 -0
- data/ext/nokogiri/xml_sax_parser.h +39 -0
- data/ext/nokogiri/xml_sax_parser_context.c +222 -0
- data/ext/nokogiri/xml_sax_parser_context.h +10 -0
- data/ext/nokogiri/xml_sax_push_parser.c +115 -0
- data/ext/nokogiri/xml_sax_push_parser.h +9 -0
- data/ext/nokogiri/xml_schema.c +205 -0
- data/ext/nokogiri/xml_schema.h +9 -0
- data/ext/nokogiri/xml_syntax_error.c +58 -0
- data/ext/nokogiri/xml_syntax_error.h +13 -0
- data/ext/nokogiri/xml_text.c +52 -0
- data/ext/nokogiri/xml_text.h +9 -0
- data/ext/nokogiri/xml_xpath_context.c +319 -0
- data/ext/nokogiri/xml_xpath_context.h +10 -0
- data/ext/nokogiri/xslt_stylesheet.c +270 -0
- data/ext/nokogiri/xslt_stylesheet.h +14 -0
- data/lib/nokogiri.rb +127 -0
- data/lib/nokogiri/css.rb +27 -0
- data/lib/nokogiri/css/node.rb +102 -0
- data/lib/nokogiri/css/parser.rb +720 -0
- data/lib/nokogiri/css/parser.y +258 -0
- data/lib/nokogiri/css/parser_extras.rb +91 -0
- data/lib/nokogiri/css/syntax_error.rb +7 -0
- data/lib/nokogiri/css/tokenizer.rb +152 -0
- data/lib/nokogiri/css/tokenizer.rex +55 -0
- data/lib/nokogiri/css/xpath_visitor.rb +171 -0
- data/lib/nokogiri/decorators/slop.rb +35 -0
- data/lib/nokogiri/html.rb +37 -0
- data/lib/nokogiri/html/builder.rb +35 -0
- data/lib/nokogiri/html/document.rb +254 -0
- data/lib/nokogiri/html/document_fragment.rb +41 -0
- data/lib/nokogiri/html/element_description.rb +23 -0
- data/lib/nokogiri/html/element_description_defaults.rb +671 -0
- data/lib/nokogiri/html/entity_lookup.rb +13 -0
- data/lib/nokogiri/html/sax/parser.rb +52 -0
- data/lib/nokogiri/html/sax/parser_context.rb +16 -0
- data/lib/nokogiri/html/sax/push_parser.rb +16 -0
- data/lib/nokogiri/syntax_error.rb +4 -0
- data/lib/nokogiri/version.rb +88 -0
- data/lib/nokogiri/xml.rb +73 -0
- data/lib/nokogiri/xml/attr.rb +14 -0
- data/lib/nokogiri/xml/attribute_decl.rb +18 -0
- data/lib/nokogiri/xml/builder.rb +431 -0
- data/lib/nokogiri/xml/cdata.rb +11 -0
- data/lib/nokogiri/xml/character_data.rb +7 -0
- data/lib/nokogiri/xml/document.rb +267 -0
- data/lib/nokogiri/xml/document_fragment.rb +103 -0
- data/lib/nokogiri/xml/dtd.rb +22 -0
- data/lib/nokogiri/xml/element_content.rb +36 -0
- data/lib/nokogiri/xml/element_decl.rb +13 -0
- data/lib/nokogiri/xml/entity_decl.rb +19 -0
- data/lib/nokogiri/xml/namespace.rb +13 -0
- data/lib/nokogiri/xml/node.rb +946 -0
- data/lib/nokogiri/xml/node/save_options.rb +61 -0
- data/lib/nokogiri/xml/node_set.rb +357 -0
- data/lib/nokogiri/xml/notation.rb +6 -0
- data/lib/nokogiri/xml/parse_options.rb +98 -0
- data/lib/nokogiri/xml/pp.rb +2 -0
- data/lib/nokogiri/xml/pp/character_data.rb +18 -0
- data/lib/nokogiri/xml/pp/node.rb +56 -0
- data/lib/nokogiri/xml/processing_instruction.rb +8 -0
- data/lib/nokogiri/xml/reader.rb +112 -0
- data/lib/nokogiri/xml/relax_ng.rb +32 -0
- data/lib/nokogiri/xml/sax.rb +4 -0
- data/lib/nokogiri/xml/sax/document.rb +164 -0
- data/lib/nokogiri/xml/sax/parser.rb +115 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +16 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +60 -0
- data/lib/nokogiri/xml/schema.rb +63 -0
- data/lib/nokogiri/xml/syntax_error.rb +47 -0
- data/lib/nokogiri/xml/text.rb +9 -0
- data/lib/nokogiri/xml/xpath.rb +10 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +11 -0
- data/lib/nokogiri/xml/xpath_context.rb +16 -0
- data/lib/nokogiri/xslt.rb +56 -0
- data/lib/nokogiri/xslt/stylesheet.rb +25 -0
- data/lib/xsd/xmlparser/nokogiri.rb +90 -0
- data/tasks/cross_compile.rb +153 -0
- data/tasks/nokogiri.org.rb +24 -0
- data/tasks/test.rb +95 -0
- data/test/css/test_nthiness.rb +159 -0
- data/test/css/test_parser.rb +341 -0
- data/test/css/test_tokenizer.rb +198 -0
- data/test/css/test_xpath_visitor.rb +91 -0
- data/test/decorators/test_slop.rb +16 -0
- data/test/files/2ch.html +108 -0
- data/test/files/address_book.rlx +12 -0
- data/test/files/address_book.xml +10 -0
- data/test/files/bar/bar.xsd +4 -0
- data/test/files/dont_hurt_em_why.xml +422 -0
- data/test/files/encoding.html +82 -0
- data/test/files/encoding.xhtml +84 -0
- data/test/files/exslt.xml +8 -0
- data/test/files/exslt.xslt +35 -0
- data/test/files/foo/foo.xsd +4 -0
- data/test/files/metacharset.html +10 -0
- data/test/files/noencoding.html +47 -0
- data/test/files/po.xml +32 -0
- data/test/files/po.xsd +66 -0
- data/test/files/shift_jis.html +10 -0
- data/test/files/shift_jis.xml +5 -0
- data/test/files/snuggles.xml +3 -0
- data/test/files/staff.dtd +10 -0
- data/test/files/staff.xml +59 -0
- data/test/files/staff.xslt +32 -0
- data/test/files/tlm.html +850 -0
- data/test/files/to_be_xincluded.xml +2 -0
- data/test/files/valid_bar.xml +2 -0
- data/test/files/xinclude.xml +4 -0
- data/test/helper.rb +147 -0
- data/test/html/sax/test_parser.rb +138 -0
- data/test/html/sax/test_parser_context.rb +46 -0
- data/test/html/test_builder.rb +164 -0
- data/test/html/test_document.rb +529 -0
- data/test/html/test_document_encoding.rb +138 -0
- data/test/html/test_document_fragment.rb +254 -0
- data/test/html/test_element_description.rb +100 -0
- data/test/html/test_named_characters.rb +14 -0
- data/test/html/test_node.rb +188 -0
- data/test/html/test_node_encoding.rb +27 -0
- data/test/test_convert_xpath.rb +135 -0
- data/test/test_css_cache.rb +45 -0
- data/test/test_encoding_handler.rb +46 -0
- data/test/test_memory_leak.rb +152 -0
- data/test/test_nokogiri.rb +132 -0
- data/test/test_reader.rb +488 -0
- data/test/test_soap4r_sax.rb +52 -0
- data/test/test_xslt_transforms.rb +254 -0
- data/test/xml/node/test_save_options.rb +28 -0
- data/test/xml/node/test_subclass.rb +44 -0
- data/test/xml/sax/test_parser.rb +338 -0
- data/test/xml/sax/test_parser_context.rb +106 -0
- data/test/xml/sax/test_push_parser.rb +157 -0
- data/test/xml/test_attr.rb +64 -0
- data/test/xml/test_attribute_decl.rb +86 -0
- data/test/xml/test_builder.rb +248 -0
- data/test/xml/test_c14n.rb +151 -0
- data/test/xml/test_cdata.rb +48 -0
- data/test/xml/test_comment.rb +29 -0
- data/test/xml/test_document.rb +742 -0
- data/test/xml/test_document_encoding.rb +28 -0
- data/test/xml/test_document_fragment.rb +216 -0
- data/test/xml/test_dtd.rb +103 -0
- data/test/xml/test_dtd_encoding.rb +33 -0
- data/test/xml/test_element_content.rb +56 -0
- data/test/xml/test_element_decl.rb +73 -0
- data/test/xml/test_entity_decl.rb +122 -0
- data/test/xml/test_entity_reference.rb +235 -0
- data/test/xml/test_namespace.rb +75 -0
- data/test/xml/test_node.rb +1029 -0
- data/test/xml/test_node_attributes.rb +53 -0
- data/test/xml/test_node_encoding.rb +107 -0
- data/test/xml/test_node_inheritance.rb +32 -0
- data/test/xml/test_node_reparenting.rb +374 -0
- data/test/xml/test_node_set.rb +755 -0
- data/test/xml/test_parse_options.rb +64 -0
- data/test/xml/test_processing_instruction.rb +30 -0
- data/test/xml/test_reader_encoding.rb +142 -0
- data/test/xml/test_relax_ng.rb +60 -0
- data/test/xml/test_schema.rb +94 -0
- data/test/xml/test_syntax_error.rb +12 -0
- data/test/xml/test_text.rb +45 -0
- data/test/xml/test_unparented_node.rb +413 -0
- data/test/xml/test_xinclude.rb +83 -0
- data/test/xml/test_xpath.rb +295 -0
- data/test/xslt/test_custom_functions.rb +129 -0
- data/test/xslt/test_exception_handling.rb +37 -0
- data/test_all +84 -0
- metadata +534 -0
data/ROADMAP.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Roadmap for 2.0
|
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
|
+
* (closed) https://github.com/sparklemotion/nokogiri/issues/666
|
23
|
+
Some ideas for a better attributes API?
|
24
|
+
|
25
|
+
|
26
|
+
## improve CSS query parsing
|
27
|
+
|
28
|
+
* https://github.com/sparklemotion/nokogiri/issues/528
|
29
|
+
support `:not()` with a nontrivial argument, like `:not(div p.c)`
|
30
|
+
|
31
|
+
* https://github.com/sparklemotion/nokogiri/issues/451
|
32
|
+
chained :not pseudoselectors
|
33
|
+
|
34
|
+
* better jQuery selector support:
|
35
|
+
* https://github.com/sparklemotion/nokogiri/issues/621
|
36
|
+
* https://github.com/sparklemotion/nokogiri/issues/342
|
37
|
+
* https://github.com/sparklemotion/nokogiri/issues/628
|
38
|
+
* https://github.com/sparklemotion/nokogiri/issues/652
|
39
|
+
* https://github.com/sparklemotion/nokogiri/issues/688
|
40
|
+
|
41
|
+
* https://github.com/sparklemotion/nokogiri/issues/394
|
42
|
+
nth-of-type is wrong, and possibly other selectors as well
|
43
|
+
|
44
|
+
* https://github.com/sparklemotion/nokogiri/issues/309
|
45
|
+
incorrect query being executed
|
46
|
+
|
47
|
+
* https://github.com/sparklemotion/nokogiri/issues/350
|
48
|
+
:has is wrong?
|
49
|
+
|
50
|
+
|
51
|
+
## DocumentFragment
|
52
|
+
|
53
|
+
* there are a few tickets about searches not working properly if you
|
54
|
+
use or do not use the context node as part of the search.
|
55
|
+
- https://github.com/sparklemotion/nokogiri/issues/213
|
56
|
+
- https://github.com/sparklemotion/nokogiri/issues/370
|
57
|
+
- https://github.com/sparklemotion/nokogiri/issues/454
|
58
|
+
- https://github.com/sparklemotion/nokogiri/issues/572
|
59
|
+
|
60
|
+
|
61
|
+
## Better Syntax for custom XPath function handler
|
62
|
+
|
63
|
+
* https://github.com/sparklemotion/nokogiri/pull/464
|
64
|
+
|
65
|
+
|
66
|
+
## Better Syntax around Node#xpath and NodeSet#xpath
|
67
|
+
|
68
|
+
* look at those methods, and use of Node#extract_params in Node#{css,search}
|
69
|
+
* we should standardize on a hash of options for these and other calls
|
70
|
+
* what should NodeSet#xpath return?
|
71
|
+
* https://github.com/sparklemotion/nokogiri/issues/656
|
72
|
+
|
73
|
+
## Encoding
|
74
|
+
|
75
|
+
We have a lot of issues open around encoding. How bad are things?
|
76
|
+
Would it help if we deprecated support for Ruby 1.8.7? Somebody who
|
77
|
+
knows encoding well should head this up.
|
78
|
+
|
79
|
+
* Extract EncodingReader as a real object that can be injected
|
80
|
+
https://groups.google.com/forum/#!msg/nokogiri-talk/arJeAtMqvkg/tGihB-iBRSAJ
|
81
|
+
|
82
|
+
|
83
|
+
## Reader
|
84
|
+
|
85
|
+
It's fundamentally broken, in that we can't stop people from crashing
|
86
|
+
their application if they want to use object reference unsafely.
|
data/Rakefile
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
require 'rubygems'
|
3
|
+
|
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
|
11
|
+
|
12
|
+
GENERATED_PARSER = "lib/nokogiri/css/parser.rb"
|
13
|
+
GENERATED_TOKENIZER = "lib/nokogiri/css/tokenizer.rb"
|
14
|
+
CROSS_DIR = File.join(File.dirname(__FILE__), 'ports')
|
15
|
+
|
16
|
+
def java?
|
17
|
+
!! (RUBY_PLATFORM =~ /java/)
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'tasks/nokogiri.org'
|
21
|
+
|
22
|
+
HOE = Hoe.spec 'nokogiri-fitzsimmons' do
|
23
|
+
developer 'Aaron Patterson', 'aaronp@rubyforge.org'
|
24
|
+
developer 'Mike Dalessio', 'mike.dalessio@gmail.com'
|
25
|
+
developer 'Yoko Harada', 'yokolet@gmail.com'
|
26
|
+
developer 'Tim Elliott', 'tle@holymonkey.com'
|
27
|
+
developer 'Justin Fitzsimmons', 'justin@fitzsimmons.ca'
|
28
|
+
|
29
|
+
self.readme_file = ['README', ENV['HLANG'], 'rdoc'].compact.join('.')
|
30
|
+
self.history_file = ['CHANGELOG', ENV['HLANG'], 'rdoc'].compact.join('.')
|
31
|
+
|
32
|
+
self.extra_rdoc_files = FileList['*.rdoc','ext/nokogiri/*.c']
|
33
|
+
|
34
|
+
self.clean_globs += [
|
35
|
+
'nokogiri.gemspec',
|
36
|
+
'lib/nokogiri/nokogiri.{bundle,jar,rb,so}',
|
37
|
+
'lib/nokogiri/1.{8,9}',
|
38
|
+
# GENERATED_PARSER,
|
39
|
+
# GENERATED_TOKENIZER
|
40
|
+
]
|
41
|
+
|
42
|
+
self.extra_dev_deps += [
|
43
|
+
["hoe-bundler", ">= 1.1"],
|
44
|
+
["hoe-debugging", ">= 1.0.3"],
|
45
|
+
["hoe-gemspec", ">= 1.0"],
|
46
|
+
["hoe-git", ">= 1.4"],
|
47
|
+
["mini_portile", ">= 0.2.2"],
|
48
|
+
["minitest", "~> 2.2.2"],
|
49
|
+
["rake", ">= 0.9"],
|
50
|
+
["rake-compiler", "= 0.8.0"]
|
51
|
+
]
|
52
|
+
if ! java?
|
53
|
+
self.extra_dev_deps += [
|
54
|
+
["racc", ">= 1.4.6"],
|
55
|
+
["rexical", ">= 1.0.5"]
|
56
|
+
]
|
57
|
+
end
|
58
|
+
|
59
|
+
if java?
|
60
|
+
self.spec_extras = { :platform => 'java' }
|
61
|
+
else
|
62
|
+
self.spec_extras = {
|
63
|
+
:extensions => ["ext/nokogiri/extconf.rb"],
|
64
|
+
:required_ruby_version => '>= 1.8.7'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
self.testlib = :minitest
|
69
|
+
end
|
70
|
+
|
71
|
+
# ----------------------------------------
|
72
|
+
|
73
|
+
if java?
|
74
|
+
# TODO: clean this section up.
|
75
|
+
require "rake/javaextensiontask"
|
76
|
+
Rake::JavaExtensionTask.new("nokogiri", HOE.spec) do |ext|
|
77
|
+
jruby_home = RbConfig::CONFIG['prefix']
|
78
|
+
ext.ext_dir = 'ext/java'
|
79
|
+
ext.lib_dir = 'lib/nokogiri'
|
80
|
+
jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar']
|
81
|
+
ext.classpath = jars.map { |x| File.expand_path x }.join ':'
|
82
|
+
end
|
83
|
+
|
84
|
+
gem_build_path = File.join 'pkg', HOE.spec.full_name
|
85
|
+
|
86
|
+
task gem_build_path => [:compile] do
|
87
|
+
cp 'lib/nokogiri/nokogiri.jar', File.join(gem_build_path, 'lib', 'nokogiri')
|
88
|
+
HOE.spec.files += ['lib/nokogiri/nokogiri.jar']
|
89
|
+
end
|
90
|
+
else
|
91
|
+
mingw_available = true
|
92
|
+
begin
|
93
|
+
require 'tasks/cross_compile'
|
94
|
+
rescue
|
95
|
+
mingw_available = false
|
96
|
+
end
|
97
|
+
require "rake/extensiontask"
|
98
|
+
|
99
|
+
HOE.spec.files.reject! { |f| f =~ %r{\.(java|jar)$} }
|
100
|
+
|
101
|
+
Rake::ExtensionTask.new("nokogiri", HOE.spec) do |ext|
|
102
|
+
ext.lib_dir = File.join(*['lib', 'nokogiri', ENV['FAT_DIR']].compact)
|
103
|
+
ext.config_options << ENV['EXTOPTS']
|
104
|
+
if mingw_available
|
105
|
+
ext.cross_compile = true
|
106
|
+
ext.cross_platform = ["x86-mswin32-60", "x86-mingw32"]
|
107
|
+
ext.cross_config_options << "--with-xml2-include=#{File.join($recipes[:libxml2].path, 'include', 'libxml2')}"
|
108
|
+
ext.cross_config_options << "--with-xml2-lib=#{File.join($recipes[:libxml2].path, 'lib')}"
|
109
|
+
ext.cross_config_options << "--with-iconv-dir=#{$recipes[:libiconv].path}"
|
110
|
+
ext.cross_config_options << "--with-xslt-dir=#{$recipes[:libxslt].path}"
|
111
|
+
ext.cross_config_options << "--with-zlib-dir=#{CROSS_DIR}"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# ----------------------------------------
|
117
|
+
|
118
|
+
desc "Generate css/parser.rb and css/tokenizer.rex"
|
119
|
+
task 'generate' => [GENERATED_PARSER, GENERATED_TOKENIZER]
|
120
|
+
task 'gem:spec' => 'generate' if Rake::Task.task_defined?("gem:spec")
|
121
|
+
|
122
|
+
file GENERATED_PARSER => "lib/nokogiri/css/parser.y" do |t|
|
123
|
+
racc = RbConfig::CONFIG['target_os'] =~ /mswin32/ ? '' : `which racc`.strip
|
124
|
+
racc = "#{::RbConfig::CONFIG['bindir']}/racc" if racc.empty?
|
125
|
+
racc = %x{command -v racc}.strip if racc.empty?
|
126
|
+
sh "#{racc} -l -o #{t.name} #{t.prerequisites.first}"
|
127
|
+
end
|
128
|
+
|
129
|
+
file GENERATED_TOKENIZER => "lib/nokogiri/css/tokenizer.rex" do |t|
|
130
|
+
sh "rex --independent -o #{t.name} #{t.prerequisites.first}"
|
131
|
+
end
|
132
|
+
|
133
|
+
[:compile, :check_manifest].each do |task_name|
|
134
|
+
Rake::Task[task_name].prerequisites << GENERATED_PARSER
|
135
|
+
Rake::Task[task_name].prerequisites << GENERATED_TOKENIZER
|
136
|
+
end
|
137
|
+
|
138
|
+
# ----------------------------------------
|
139
|
+
|
140
|
+
desc "set environment variables to build and/or test with debug options"
|
141
|
+
task :debug do
|
142
|
+
ENV['NOKOGIRI_DEBUG'] = "true"
|
143
|
+
ENV['CFLAGS'] ||= ""
|
144
|
+
ENV['CFLAGS'] += " -DDEBUG"
|
145
|
+
end
|
146
|
+
|
147
|
+
require 'tasks/test'
|
148
|
+
|
149
|
+
task :java_debug do
|
150
|
+
ENV['JAVA_OPTS'] = '-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y' if java? && ENV['JAVA_DEBUG']
|
151
|
+
end
|
152
|
+
|
153
|
+
Rake::Task[:test].prerequisites << :compile
|
154
|
+
Rake::Task[:test].prerequisites << :java_debug
|
155
|
+
Rake::Task[:test].prerequisites << :check_extra_deps unless java?
|
156
|
+
if Hoe.plugins.include?(:debugging)
|
157
|
+
['valgrind', 'valgrind:mem', 'valgrind:mem0'].each do |task_name|
|
158
|
+
Rake::Task["test:#{task_name}"].prerequisites << :compile
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
# ----------------------------------------
|
163
|
+
|
164
|
+
desc "build a windows gem without all the ceremony."
|
165
|
+
task "gem:windows" => "gem" do
|
166
|
+
cross_rubies = ["1.8.7-p330", "1.9.2-p136"]
|
167
|
+
ruby_cc_version = cross_rubies.collect { |_| _.split("-").first }.join(":") # e.g., "1.8.7:1.9.2"
|
168
|
+
rake_compiler_config_path = "#{ENV['HOME']}/.rake-compiler/config.yml"
|
169
|
+
|
170
|
+
unless File.exists? rake_compiler_config_path
|
171
|
+
raise "rake-compiler has not installed any cross rubies. try running 'env --unset=HOST rake-compiler cross-ruby VERSION=#{cross_rubies.first}'"
|
172
|
+
end
|
173
|
+
rake_compiler_config = YAML.load_file(rake_compiler_config_path)
|
174
|
+
|
175
|
+
# check that rake-compiler config contains the right patchlevels. see #279 for background,
|
176
|
+
# and http://blog.mmediasys.com/2011/01/22/rake-compiler-updated-list-of-supported-ruby-versions-for-cross-compilation/
|
177
|
+
# for more up-to-date docs.
|
178
|
+
cross_rubies.each do |version|
|
179
|
+
majmin, patchlevel = version.split("-")
|
180
|
+
rbconfig = "rbconfig-#{majmin}"
|
181
|
+
unless rake_compiler_config.key?(rbconfig) && rake_compiler_config[rbconfig] =~ /-#{patchlevel}/
|
182
|
+
raise "rake-compiler '#{rbconfig}' not #{patchlevel}. try running 'env --unset=HOST rake-compiler cross-ruby VERSION=#{version}'"
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
# verify that --export-all is in the 1.9 rbconfig. see #279,#374,#375.
|
187
|
+
rbconfig_19 = rake_compiler_config["rbconfig-1.9.2"]
|
188
|
+
raise "rbconfig #{rbconfig_19} needs --export-all in its DLDFLAGS value" if File.read(rbconfig_19).split("\n").grep(/CONFIG\["DLDFLAGS"\].*--export-all/).empty?
|
189
|
+
|
190
|
+
pkg_config_path = [:libxslt, :libxml2].collect { |pkg| File.join($recipes[pkg].path, "lib/pkgconfig") }.join(":")
|
191
|
+
sh("env PKG_CONFIG_PATH=#{pkg_config_path} RUBY_CC_VERSION=#{ruby_cc_version} rake cross native gem") || raise("build failed!")
|
192
|
+
end
|
193
|
+
|
194
|
+
# vim: syntax=Ruby
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Standard Responses to Requests
|
2
|
+
|
3
|
+
These responses are needed often enough that I figured, let's just
|
4
|
+
check them in for future reference and use.
|
5
|
+
|
6
|
+
|
7
|
+
# Not enough information to help
|
8
|
+
|
9
|
+
Hello!
|
10
|
+
|
11
|
+
Thanks for asking this question! However, without more information,
|
12
|
+
Team Nokogiri cannot reproduce your issue, and so we cannot offer much
|
13
|
+
help.
|
14
|
+
|
15
|
+
Please provide us with:
|
16
|
+
|
17
|
+
* A self-contained script (one that we can run without modification,
|
18
|
+
and preferably without making external network connections).
|
19
|
+
|
20
|
+
* Please note that you need to include the XML/HTML that you are
|
21
|
+
operating on.
|
22
|
+
|
23
|
+
* The output of `nokogiri -v`, which will provide details about your
|
24
|
+
platform and versions of ruby, libxml2 and nokogiri.
|
25
|
+
|
26
|
+
For more information about requesting help or reporting bugs, please
|
27
|
+
take a look at http://bit.ly/nokohelp
|
28
|
+
|
29
|
+
Thank you so much!
|
30
|
+
|
31
|
+
|
32
|
+
# Not a bug
|
33
|
+
|
34
|
+
Hello!
|
35
|
+
|
36
|
+
Thanks for asking this question! Your request for assistance using
|
37
|
+
Nokogiri will not go unanswered!
|
38
|
+
|
39
|
+
However, Nokogiri's Github Issues is reserved for reporting bugs or
|
40
|
+
submitting patches. If you ask your question on the mailing list, Team
|
41
|
+
Nokogiri promises someone will provide you with an answer in a timely
|
42
|
+
manner.
|
43
|
+
|
44
|
+
If you'd like to read up on Team Nokogiri's rationale for this policy,
|
45
|
+
please go to http://bit.ly/nokohelp.
|
46
|
+
|
47
|
+
Thank you so much for understanding! And thank you for using Nokogiri.
|
data/Y_U_NO_GEMSPEC.md
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
(note: this was originally a blog post published at http://blog.flavorjon.es/2012/03/y-u-no-gemspec.html)
|
2
|
+
|
3
|
+
## tl;dr
|
4
|
+
|
5
|
+
1. Team Nokogiri are not 10-foot-tall code-crunching robots, so `master` is usually unstable.
|
6
|
+
2. Unstable code can corrupt your data and crash your application, which would make everybody look bad.
|
7
|
+
3. Therefore, the _risk_ associated with using unstable code is severe; for you _and_ for Team Nokogiri.
|
8
|
+
4. The absence of a gemspec is a risk mitigation tactic.
|
9
|
+
5. You can always ask for an RC release.
|
10
|
+
|
11
|
+
|
12
|
+
## Why Isn't There a Gemspec!?
|
13
|
+
|
14
|
+
OHAI! Thank you for asking this question!
|
15
|
+
|
16
|
+
Team Nokogiri gets asked this pretty frequently. Just a sample from
|
17
|
+
the historical record:
|
18
|
+
|
19
|
+
* [Issue #274](https://github.com/sparklemotion/nokogiri/issues/274)
|
20
|
+
* [Issue #371](https://github.com/sparklemotion/nokogiri/issues/371)
|
21
|
+
* [A commit removing nokogiri.gemspec](https://github.com/sparklemotion/nokogiri/commit/7f17a643a05ca381d65131515b54d4a3a61ca2e1#commitcomment-667477)
|
22
|
+
* [A nokogiri-talk thread](http://groups.google.com/group/nokogiri-talk/browse_thread/thread/4706b002e492d23f)
|
23
|
+
* [Another nokogiri-talk thread](http://groups.google.com/group/nokogiri-talk/browse_thread/thread/0b201bb80ea3eea0)
|
24
|
+
|
25
|
+
Sometimes people imply that we've forgotten, or that we don't how to
|
26
|
+
properly manage our codebase. Those people are super fun to respond
|
27
|
+
to!
|
28
|
+
|
29
|
+
We've gone back and forth a couple of times over the past few years,
|
30
|
+
but the current policy of Team Nokogiri is to **not** provide a
|
31
|
+
gemspec in the Github repo. This is a conscious choice, not an
|
32
|
+
oversight.
|
33
|
+
|
34
|
+
|
35
|
+
## But You Didn't Answer the Question!
|
36
|
+
|
37
|
+
Ah, I was hoping you wouldn't notice. Well, OK, let's do this, if
|
38
|
+
you're serious about it.
|
39
|
+
|
40
|
+
I'd like to start by talking about _risk_. Specifically, the risk
|
41
|
+
associated with using a known-unstable version of Nokogiri.
|
42
|
+
|
43
|
+
|
44
|
+
### Risk
|
45
|
+
|
46
|
+
One common way to evaluate the _risk_ of an incident is:
|
47
|
+
|
48
|
+
risk = probability x impact
|
49
|
+
|
50
|
+
You can read more about this on [the internets](http://en.wikipedia.org/wiki/Risk_Matrix).
|
51
|
+
|
52
|
+
The _risk_ associated with a Nokogiri bug could be loosely defined by
|
53
|
+
answering the questions:
|
54
|
+
|
55
|
+
* "How likely is it that a bug exists?" (probability)
|
56
|
+
* "How severe will the consequences of a bug be?" (impact)
|
57
|
+
|
58
|
+
|
59
|
+
### Probability
|
60
|
+
|
61
|
+
The `master` branch should be considered unstable. Team Nokogiri are
|
62
|
+
not 10-foot-tall code-crunching robots; we are humans. We make
|
63
|
+
mistakes, and as a result, any arbitrary commit on `master` is likely
|
64
|
+
to contain bugs.
|
65
|
+
|
66
|
+
Just as an example, Nokogiri `master` was unstable for about five
|
67
|
+
months between November 2011 and March 2012. It was unstable not
|
68
|
+
because we were sloppy, or didn't care, but because the fixes were
|
69
|
+
hard and unobvious.
|
70
|
+
|
71
|
+
When we release Nokogiri, we test for memory leaks and invalid memory
|
72
|
+
access on all kinds of platforms with many flavors of Ruby and lots of
|
73
|
+
versions of libxml2. Because these tests are time-consuming, we don't
|
74
|
+
run them on every commit. We run them often when preparing a release.
|
75
|
+
|
76
|
+
If we're releasing Nokogiri, it means we think it's rock solid.
|
77
|
+
|
78
|
+
And if we're not releasing it, it means there are probably bugs.
|
79
|
+
|
80
|
+
|
81
|
+
### Impact
|
82
|
+
|
83
|
+
Nokogiri is a gem with native extensions. This means it's not pure
|
84
|
+
Ruby -- there's C or Java code being compiled and run, which means
|
85
|
+
that there's always a chance that the gem will crash your application,
|
86
|
+
or worse. Possible outcomes include:
|
87
|
+
|
88
|
+
* leaking memory
|
89
|
+
* corrupting data
|
90
|
+
* making benign code crash (due to memory corruption)
|
91
|
+
|
92
|
+
So, then, a bug in a native extension can have much worse downside
|
93
|
+
than you might think. It's not just going to do something unexpected;
|
94
|
+
it's possibly going to do terrible, awful things to your application
|
95
|
+
and data.
|
96
|
+
|
97
|
+
**Nobody** wants that to happen. Especially Team Nokogiri.
|
98
|
+
|
99
|
+
|
100
|
+
### Risk, Redux
|
101
|
+
|
102
|
+
So, if you accept the equation
|
103
|
+
|
104
|
+
risk = probability x impact
|
105
|
+
|
106
|
+
and you believe me when I say that:
|
107
|
+
|
108
|
+
* the probablility of a bug in unreleased code is high, and
|
109
|
+
* the impact of a bug is likely to be severe,
|
110
|
+
|
111
|
+
then you should easily see that the _risk_ associated with a bug in
|
112
|
+
Nokogiri is quite high.
|
113
|
+
|
114
|
+
Part of Team Nokogiri's job is to try to mitigate this risk. We have a
|
115
|
+
number of tactics that we use to accomplish this:
|
116
|
+
|
117
|
+
* we respond quickly to bug reports, particularly when they are possible memory issues
|
118
|
+
* we review each others' commits
|
119
|
+
* we have a thorough test suite, and we test-drive new features
|
120
|
+
* we discuss code design and issues on a core developer mailing list
|
121
|
+
* we use valgrind to test for memory issues (leaks and invalid
|
122
|
+
access) on multiple combinations of OS, libxml2 and Ruby
|
123
|
+
* we package release candidates, and encourage devs to use them
|
124
|
+
* **we do NOT commit a gemspec in our git repository**
|
125
|
+
|
126
|
+
Yes, that's right, the absence of a gemspec is a risk mitigation
|
127
|
+
tactic. Not only does Team Nokogiri not want to imply support for
|
128
|
+
`master`, we want to **actively discourage** people from using
|
129
|
+
it. Because it's not stable.
|
130
|
+
|
131
|
+
|
132
|
+
## But I Want to Do It Anyway
|
133
|
+
|
134
|
+
Another option, is to email the [nokogiri-talk
|
135
|
+
list](http://groups.google.com/group/nokogiri-talk) and ask for a
|
136
|
+
release candidate to be built. We're pretty accommodating if there's a
|
137
|
+
bugfix that's a blocker for you. And if we can't release an RC, we'll
|
138
|
+
tell you why.
|
139
|
+
|
140
|
+
And in the end, nothing is stopping you from cloning the repo and
|
141
|
+
generating a private gemspec. This is an extra step or two, but it has
|
142
|
+
the benefit of making sure developers have thought through the costs
|
143
|
+
and risks involved; and it tends to select for developers who know
|
144
|
+
what they're doing.
|
145
|
+
|
146
|
+
|
147
|
+
## In Conclusion
|
148
|
+
|
149
|
+
Team Nokogiri takes stability very seriously. We want everybody who
|
150
|
+
uses Nokogiri to have a pleasant experience. And so we want to make
|
151
|
+
sure that you're using the best software we can make.
|
152
|
+
|
153
|
+
Please keep in mind that we're trying very hard to do the right thing
|
154
|
+
for all Nokogiri users out there in Rubyland. Nokogiri loves you very
|
155
|
+
much, and we hope you love it back.
|