nokogiri 1.5.2-java → 1.5.3-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.
- data/CHANGELOG.ja.rdoc +35 -0
- data/CHANGELOG.rdoc +37 -2
- data/Manifest.txt +11 -3
- data/README.rdoc +1 -1
- data/ROADMAP.md +86 -0
- data/{nokogiri_help_responses.md → STANDARD_RESPONSES.md} +11 -4
- data/Y_U_NO_GEMSPEC.md +155 -0
- data/build_all +58 -0
- data/ext/java/nokogiri/HtmlDocument.java +10 -1
- data/ext/java/nokogiri/XmlAttr.java +11 -1
- data/ext/java/nokogiri/XmlDocument.java +4 -0
- data/ext/java/nokogiri/XmlNamespace.java +25 -0
- data/ext/java/nokogiri/XmlNode.java +6 -6
- data/ext/java/nokogiri/XmlReader.java +19 -4
- data/ext/java/nokogiri/XmlSaxPushParser.java +88 -57
- data/ext/java/nokogiri/XmlSyntaxError.java +15 -3
- data/ext/java/nokogiri/XmlXpathContext.java +3 -3
- data/ext/java/nokogiri/internals/HtmlDomParserContext.java +2 -1
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +89 -1
- data/ext/java/nokogiri/internals/ParserContext.java +23 -2
- data/ext/java/nokogiri/internals/SaveContextVisitor.java +18 -1
- data/ext/java/nokogiri/internals/XmlDomParserContext.java +2 -3
- data/ext/nokogiri/extconf.rb +1 -1
- data/ext/nokogiri/xml_io.c +1 -1
- data/ext/nokogiri/xml_namespace.c +0 -6
- data/ext/nokogiri/xml_node.c +11 -11
- data/ext/nokogiri/xml_node_set.c +1 -1
- data/ext/nokogiri/xml_xpath_context.c +20 -16
- data/ext/nokogiri/xml_xpath_context.h +1 -0
- data/ext/nokogiri/xslt_stylesheet.c +7 -64
- data/lib/nokogiri/css/node.rb +3 -0
- data/lib/nokogiri/css/parser.rb +244 -203
- data/lib/nokogiri/css/parser.y +20 -2
- data/lib/nokogiri/css/xpath_visitor.rb +2 -2
- data/lib/nokogiri/html/document.rb +2 -1
- data/lib/nokogiri/html/element_description_defaults.rb +1 -1
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml/document.rb +1 -1
- data/lib/nokogiri/xml/parse_options.rb +2 -2
- data/lib/nokogiri/xml/sax/document.rb +1 -1
- data/lib/nokogiri/xml/sax/parser.rb +1 -1
- data/lib/nokogiri/xslt.rb +1 -1
- data/test/css/test_parser.rb +38 -0
- data/test/files/to_be_xincluded.xml +2 -0
- data/test/files/xinclude.xml +4 -0
- data/test/helper.rb +18 -45
- data/test/html/sax/test_parser.rb +5 -3
- data/test/html/sax/test_parser_context.rb +8 -10
- data/test/html/test_document.rb +19 -5
- data/test/html/test_node.rb +2 -4
- data/test/test_reader.rb +63 -0
- data/test/test_xslt_transforms.rb +3 -1
- data/test/xml/sax/test_parser_context.rb +10 -17
- data/test/xml/sax/test_push_parser.rb +1 -0
- data/test/xml/test_attr.rb +5 -6
- data/test/xml/test_builder.rb +5 -6
- data/test/xml/test_cdata.rb +1 -3
- data/test/xml/test_document.rb +11 -14
- data/test/xml/test_document_encoding.rb +3 -1
- data/test/xml/test_document_fragment.rb +27 -8
- data/test/xml/test_node.rb +21 -0
- data/test/xml/test_node_set.rb +2 -2
- data/test/xml/test_text.rb +1 -3
- data/test/xml/test_unparented_node.rb +2 -2
- data/test/xml/test_xpath.rb +15 -6
- data/test/xslt/test_custom_functions.rb +35 -0
- data/test_all +84 -0
- metadata +13 -8
- data/ext/java/nokogiri/internals/PushInputStream.java +0 -411
data/CHANGELOG.ja.rdoc
CHANGED
@@ -1,3 +1,38 @@
|
|
1
|
+
== 1.5.3 / 2012-06-01
|
2
|
+
|
3
|
+
* Features
|
4
|
+
|
5
|
+
* Support for "prefixless" CSS selectors ~, > and + like jQuery
|
6
|
+
supports. #621, #623. (Thanks, David Lee!)
|
7
|
+
* Attempting to improve installation on homebrew 0.9 (with regards
|
8
|
+
to iconv). Isn't package management convenient?
|
9
|
+
|
10
|
+
* Bugfixes
|
11
|
+
|
12
|
+
* Custom xpath functions with empty nodeset arguments cause a
|
13
|
+
segfault. #634.
|
14
|
+
* Nokogiri::XML::Node#css now works for XML documents with default
|
15
|
+
namespaces when the rule contains attribute selector without
|
16
|
+
namespace.
|
17
|
+
* Fixed marshalling bugs around how arguments are passed to (and
|
18
|
+
returned from) XSLT custom xpath functions. #640.
|
19
|
+
* Nokogiri::XML::Reader#outer_xml がJRubyで正しく動作しない #617
|
20
|
+
* Nokogiri::XML::Attribute が JRuby 上で nil namespace を返す #647
|
21
|
+
* Nokogiri::XML::Node#namespace= メソッドが JRuby 上で prefix
|
22
|
+
が無い namespace を設定できない #648
|
23
|
+
* [JRuby] 1.9 モードで rake を実行するとデッドロックを引き起こす #571
|
24
|
+
* HTML::Document#meta_encoding does not raise exception on docs with
|
25
|
+
malformed content-type. #655
|
26
|
+
* Fixing segfault related to unsupported encodings in in-context
|
27
|
+
parsing on 1.8.7. #643
|
28
|
+
* [JRuby] Concurrency issue in XPath parsing. #682
|
29
|
+
|
30
|
+
|
31
|
+
== 1.5.2 / 2012-03-09
|
32
|
+
|
33
|
+
Repackaging of 1.5.1 with a gemspec that is compatible with older Rubies. #631, #632.
|
34
|
+
|
35
|
+
|
1
36
|
== 1.5.1 / 2012年3月9日
|
2
37
|
|
3
38
|
* 新機能
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,38 @@
|
|
1
|
+
== 1.5.3 / 2012-06-01
|
2
|
+
|
3
|
+
* Features
|
4
|
+
|
5
|
+
* Support for "prefixless" CSS selectors ~, > and + like jQuery
|
6
|
+
supports. #621, #623. (Thanks, David Lee!)
|
7
|
+
* Attempting to improve installation on homebrew 0.9 (with regards
|
8
|
+
to iconv). Isn't package management convenient?
|
9
|
+
|
10
|
+
* Bugfixes
|
11
|
+
|
12
|
+
* Custom xpath functions with empty nodeset arguments cause a
|
13
|
+
segfault. #634.
|
14
|
+
* Nokogiri::XML::Node#css now works for XML documents with default
|
15
|
+
namespaces when the rule contains attribute selector without
|
16
|
+
namespace.
|
17
|
+
* Fixed marshalling bugs around how arguments are passed to (and
|
18
|
+
returned from) XSLT custom xpath functions. #640.
|
19
|
+
* Nokogiri::XML::Reader#outer_xml is broken in JRuby #617
|
20
|
+
* Nokogiri::XML::Attribute on JRuby returns a nil namespace #647
|
21
|
+
* Nokogiri::XML::Node#namespace= cannot set a namespace without a
|
22
|
+
prefix on JRuby #648
|
23
|
+
* [JRuby] 1.9 mode causes dead lock while running rake #571
|
24
|
+
* HTML::Document#meta_encoding does not raise exception on docs with
|
25
|
+
malformed content-type. #655
|
26
|
+
* Fixing segfault related to unsupported encodings in in-context
|
27
|
+
parsing on 1.8.7. #643
|
28
|
+
* [JRuby] Concurrency issue in XPath parsing. #682
|
29
|
+
|
30
|
+
|
31
|
+
== 1.5.2 / 2012-03-09
|
32
|
+
|
33
|
+
Repackaging of 1.5.1 with a gemspec that is compatible with older Rubies. #631, #632.
|
34
|
+
|
35
|
+
|
1
36
|
== 1.5.1 / 2012-03-09
|
2
37
|
|
3
38
|
* Features
|
@@ -422,7 +457,7 @@
|
|
422
457
|
* Nokogiri::HTML.fragment will properly handle text only nodes (LH #43)
|
423
458
|
* Nokogiri::XML::Node#before will prepend text nodes (LH #44)
|
424
459
|
* Nokogiri::XML::Node#after will append text nodes
|
425
|
-
* Nokogiri::XML::Node#search automatically registers root
|
460
|
+
* Nokogiri::XML::Node#search automatically registers root namespaces (LH #42)
|
426
461
|
* Nokogiri::XML::NodeSet#search automatically registers namespaces
|
427
462
|
* Nokogiri::HTML::NamedCharacters delegates to libxml2
|
428
463
|
* Nokogiri::XML::Node#[] can take a symbol (LH #48)
|
@@ -542,7 +577,7 @@
|
|
542
577
|
|
543
578
|
* Bugfixes
|
544
579
|
|
545
|
-
* Changed memory
|
580
|
+
* Changed memory management from weak refs to document refs
|
546
581
|
* Plugged some memory leaks
|
547
582
|
* Builder blocks can call methods from surrounding contexts
|
548
583
|
|
data/Manifest.txt
CHANGED
@@ -2,11 +2,16 @@
|
|
2
2
|
.gemtest
|
3
3
|
CHANGELOG.ja.rdoc
|
4
4
|
CHANGELOG.rdoc
|
5
|
+
C_CODING_STYLE.rdoc
|
5
6
|
Manifest.txt
|
6
7
|
README.ja.rdoc
|
7
8
|
README.rdoc
|
9
|
+
ROADMAP.md
|
8
10
|
Rakefile
|
11
|
+
STANDARD_RESPONSES.md
|
12
|
+
Y_U_NO_GEMSPEC.md
|
9
13
|
bin/nokogiri
|
14
|
+
build_all
|
10
15
|
ext/java/nokogiri/EncodingHandler.java
|
11
16
|
ext/java/nokogiri/HtmlDocument.java
|
12
17
|
ext/java/nokogiri/HtmlElementDescription.java
|
@@ -53,7 +58,6 @@ ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java
|
|
53
58
|
ext/java/nokogiri/internals/NokogiriXPathVariableResolver.java
|
54
59
|
ext/java/nokogiri/internals/NokogiriXsltErrorListener.java
|
55
60
|
ext/java/nokogiri/internals/ParserContext.java
|
56
|
-
ext/java/nokogiri/internals/PushInputStream.java
|
57
61
|
ext/java/nokogiri/internals/ReaderNode.java
|
58
62
|
ext/java/nokogiri/internals/SaveContextVisitor.java
|
59
63
|
ext/java/nokogiri/internals/SchemaErrorHandler.java
|
@@ -198,7 +202,6 @@ lib/nokogiri/xslt.rb
|
|
198
202
|
lib/nokogiri/xslt/stylesheet.rb
|
199
203
|
lib/xercesImpl.jar
|
200
204
|
lib/xsd/xmlparser/nokogiri.rb
|
201
|
-
nokogiri_help_responses.md
|
202
205
|
tasks/cross_compile.rb
|
203
206
|
tasks/nokogiri.org.rb
|
204
207
|
tasks/test.rb
|
@@ -228,7 +231,9 @@ test/files/staff.dtd
|
|
228
231
|
test/files/staff.xml
|
229
232
|
test/files/staff.xslt
|
230
233
|
test/files/tlm.html
|
234
|
+
test/files/to_be_xincluded.xml
|
231
235
|
test/files/valid_bar.xml
|
236
|
+
test/files/xinclude.xml
|
232
237
|
test/helper.rb
|
233
238
|
test/html/sax/test_parser.rb
|
234
239
|
test/html/sax/test_parser_context.rb
|
@@ -256,6 +261,7 @@ test/xml/sax/test_push_parser.rb
|
|
256
261
|
test/xml/test_attr.rb
|
257
262
|
test/xml/test_attribute_decl.rb
|
258
263
|
test/xml/test_builder.rb
|
264
|
+
test/xml/test_c14n.rb
|
259
265
|
test/xml/test_cdata.rb
|
260
266
|
test/xml/test_comment.rb
|
261
267
|
test/xml/test_document.rb
|
@@ -271,9 +277,9 @@ test/xml/test_namespace.rb
|
|
271
277
|
test/xml/test_node.rb
|
272
278
|
test/xml/test_node_attributes.rb
|
273
279
|
test/xml/test_node_encoding.rb
|
280
|
+
test/xml/test_node_inheritance.rb
|
274
281
|
test/xml/test_node_reparenting.rb
|
275
282
|
test/xml/test_node_set.rb
|
276
|
-
test/xml/test_node_inheritance.rb
|
277
283
|
test/xml/test_parse_options.rb
|
278
284
|
test/xml/test_processing_instruction.rb
|
279
285
|
test/xml/test_reader_encoding.rb
|
@@ -282,6 +288,8 @@ test/xml/test_schema.rb
|
|
282
288
|
test/xml/test_syntax_error.rb
|
283
289
|
test/xml/test_text.rb
|
284
290
|
test/xml/test_unparented_node.rb
|
291
|
+
test/xml/test_xinclude.rb
|
285
292
|
test/xml/test_xpath.rb
|
286
293
|
test/xslt/test_custom_functions.rb
|
287
294
|
test/xslt/test_exception_handling.rb
|
295
|
+
test_all
|
data/README.rdoc
CHANGED
@@ -91,7 +91,7 @@ encoded like the source document.
|
|
91
91
|
Some documents declare one particular encoding, but use a different
|
92
92
|
one. So, which encoding should the parser choose?
|
93
93
|
|
94
|
-
Remember that data is just a stream of bytes. Only
|
94
|
+
Remember that data is just a stream of bytes. Only we humans add
|
95
95
|
meaning to that stream. Any particular set of bytes could be valid
|
96
96
|
characters in multiple encodings, so detecting encoding with 100%
|
97
97
|
accuracy is not possible. libxml2 does its best, but it can't be right
|
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/tenderlove/nokogiri/issues/530
|
6
|
+
XHTML formatting can't be turned off
|
7
|
+
|
8
|
+
* https://github.com/tenderlove/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/tenderlove/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/tenderlove/nokogiri/issues/666
|
23
|
+
Some ideas for a better attributes API?
|
24
|
+
|
25
|
+
|
26
|
+
## improve CSS query parsing
|
27
|
+
|
28
|
+
* https://github.com/tenderlove/nokogiri/issues/528
|
29
|
+
support `:not()` with a nontrivial argument, like `:not(div p.c)`
|
30
|
+
|
31
|
+
* https://github.com/tenderlove/nokogiri/issues/451
|
32
|
+
chained :not pseudoselectors
|
33
|
+
|
34
|
+
* better jQuery selector support:
|
35
|
+
* https://github.com/tenderlove/nokogiri/issues/621
|
36
|
+
* https://github.com/tenderlove/nokogiri/issues/342
|
37
|
+
* https://github.com/tenderlove/nokogiri/issues/628
|
38
|
+
* https://github.com/tenderlove/nokogiri/issues/652
|
39
|
+
* https://github.com/tenderlove/nokogiri/issues/688
|
40
|
+
|
41
|
+
* https://github.com/tenderlove/nokogiri/issues/394
|
42
|
+
nth-of-type is wrong, and possibly other selectors as well
|
43
|
+
|
44
|
+
* https://github.com/tenderlove/nokogiri/issues/309
|
45
|
+
incorrect query being executed
|
46
|
+
|
47
|
+
* https://github.com/tenderlove/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/tenderlove/nokogiri/issues/213
|
56
|
+
- https://github.com/tenderlove/nokogiri/issues/370
|
57
|
+
- https://github.com/tenderlove/nokogiri/issues/454
|
58
|
+
- https://github.com/tenderlove/nokogiri/issues/572
|
59
|
+
|
60
|
+
|
61
|
+
## Better Syntax for custom XPath function handler
|
62
|
+
|
63
|
+
* https://github.com/tenderlove/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/tenderlove/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.
|
@@ -1,4 +1,10 @@
|
|
1
|
-
#
|
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
|
2
8
|
|
3
9
|
Hello!
|
4
10
|
|
@@ -22,12 +28,13 @@ take a look at http://bit.ly/nokohelp
|
|
22
28
|
|
23
29
|
Thank you so much!
|
24
30
|
|
25
|
-
|
31
|
+
|
32
|
+
# Not a bug
|
26
33
|
|
27
34
|
Hello!
|
28
35
|
|
29
|
-
Thanks for asking this question! Your request for
|
30
|
-
unanswered!
|
36
|
+
Thanks for asking this question! Your request for assistance using
|
37
|
+
Nokogiri will not go unanswered!
|
31
38
|
|
32
39
|
However, Nokogiri's Github Issues is reserved for reporting bugs or
|
33
40
|
submitting patches. If you ask your question on the mailing list, Team
|
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/tenderlove/nokogiri/issues/274)
|
20
|
+
* [Issue #371](https://github.com/tenderlove/nokogiri/issues/371)
|
21
|
+
* [A commit removing nokogiri.gemspec](https://github.com/tenderlove/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.
|
data/build_all
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#! /usr/bin/env bash
|
2
|
+
#
|
3
|
+
# script to build gems for all relevant platforms:
|
4
|
+
# - MRI et al (standard gem)
|
5
|
+
# - windows (x86-mingw32 and x86-msin32-60)
|
6
|
+
# - jruby
|
7
|
+
#
|
8
|
+
# prerequisite is the mingw32 packages.
|
9
|
+
# on ubuntu, `sudo apt-get install mingw32`
|
10
|
+
# for others, read up at https://github.com/luislavena/rake-compiler
|
11
|
+
#
|
12
|
+
|
13
|
+
# Load RVM into a shell session *as a function*
|
14
|
+
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
|
15
|
+
source "$HOME/.rvm/scripts/rvm"
|
16
|
+
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
|
17
|
+
source "/usr/local/rvm/scripts/rvm"
|
18
|
+
else
|
19
|
+
echo "ERROR: An RVM installation was not found.\n"
|
20
|
+
fi
|
21
|
+
|
22
|
+
function rvm_use {
|
23
|
+
current_ruby=$1
|
24
|
+
rvm use "${1}@nokogiri" --create
|
25
|
+
}
|
26
|
+
|
27
|
+
set -o errexit
|
28
|
+
|
29
|
+
# initialize
|
30
|
+
rvm_use 1.8.7
|
31
|
+
rm -rf tmp pkg
|
32
|
+
bundle exec rake clean clobber
|
33
|
+
|
34
|
+
# holding pen
|
35
|
+
rm -rf gems
|
36
|
+
mkdir -p gems
|
37
|
+
|
38
|
+
# MRI
|
39
|
+
rvm_use 1.8.7
|
40
|
+
bundle exec rake gem
|
41
|
+
cp -v pkg/nokogiri*.gem gems # should only be one at this point in the script
|
42
|
+
|
43
|
+
# windows
|
44
|
+
rvm_use 1.8.7
|
45
|
+
bundle exec rake-compiler cross-ruby VERSION=1.8.7-p330
|
46
|
+
bundle exec rake-compiler cross-ruby VERSION=1.9.2-p136
|
47
|
+
bundle exec rake cross
|
48
|
+
rake gem:windows # don't use bundler here. it blows up. *shrug*
|
49
|
+
cp -v pkg/nokogiri*x86-{mingw32,mswin32}*.gem gems
|
50
|
+
|
51
|
+
# jruby
|
52
|
+
rvm_use jruby-1.6.5
|
53
|
+
bundle exec rake clean clobber
|
54
|
+
rvm_use 1.8.7
|
55
|
+
bundle exec rake generate
|
56
|
+
rvm_use jruby-1.6.5
|
57
|
+
bundle exec rake gem
|
58
|
+
cp -v pkg/nokogiri*java.gem gems
|