rdx 0.9.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rdx +20 -0
- data/README +19 -0
- data/bin/rdx +7 -0
- data/examples/minimal/.rdx +8 -0
- data/examples/minimal/README +10 -0
- data/examples/minimal/lib/other_conventions.rb +64 -0
- data/examples/minimal/lib/the_basics.rb +94 -0
- data/examples/minimal/lib/using_directives.rb +66 -0
- data/examples/minimal/rakefile +27 -0
- data/examples/ruby-2.0.0-p0/README +7 -0
- data/examples/ruby-2.0.0-p0/install/core/.rdx +6 -0
- data/examples/ruby-2.0.0-p0/install/core/README +19 -0
- data/examples/ruby-2.0.0-p0/install/core/Rakefile +61 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/array.c.diff +166 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/bignum.c.diff +11 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/class.c.diff +36 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/compar.c.diff +11 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/complex.c.diff +301 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/cont.c.diff +65 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/dir.c.diff +147 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/re.rdoc.diff +328 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/security.rdoc.diff +8 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/standard_library.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/assignment.rdoc.diff +160 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/calling_methods.rdoc.diff +130 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/control_expressions.rdoc.diff +254 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/exceptions.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/literals.rdoc.diff +54 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/methods.rdoc.diff +157 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/miscellaneous.rdoc.diff +91 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/modules_and_classes.rdoc.diff +161 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/precedence.rdoc.diff +8 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/refinements.rdoc.diff +146 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/encoding.c.diff +276 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/enum.c.diff +281 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/enumerator.c.diff +479 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/error.c.diff +143 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/eval.c.diff +47 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/eval_jump.c.diff +23 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/file.c.diff +752 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/gc.c.diff +195 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/hash.c.diff +84 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/iseq.c.diff +354 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/load.c.diff +53 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/marshal.c.diff +98 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/math.c.diff +110 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/numeric.c.diff +103 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/object.c.diff +295 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/pack.c.diff +18 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/parse.y.diff +23 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/proc.c.diff +155 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/random.c.diff +126 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/range.c.diff +49 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/rational.c.diff +312 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/re.c.diff +207 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/ruby.c.diff +21 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/signal.c.diff +67 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/sprintf.c.diff +29 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/string.c.diff +73 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/struct.c.diff +20 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/time.c.diff +691 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/transcode.c.diff +435 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/variable.c.diff +62 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_backtrace.c.diff +164 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_eval.c.diff +99 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_method.c.diff +17 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_trace.c.diff +393 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/.rdx +6 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/README +19 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/Rakefile +53 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/abbrev.rb.diff +77 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/base64.rb.diff +42 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/benchmark.rb.diff +144 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/cmath.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/forwardable.rb.diff +150 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/mathn.rb.diff +58 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/matrix.rb.diff +657 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/observer.rb.diff +31 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/optparse.rb.diff +147 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/ostruct.rb.diff +78 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/prime.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/pstore.rb.diff +110 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/scanf.rb.diff +100 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/securerandom.rb.diff +144 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/set.rb.diff +637 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/shellwords.rb.diff +66 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/singleton.rb.diff +37 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tempfile.rb.diff +104 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/thread.rb.diff +38 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/time.rb.diff +140 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tmpdir.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri.rb.diff +39 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri/common.rb.diff +237 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/weakref.rb.diff +36 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/yaml/store.rb.diff +27 -0
- data/examples/ruby-2.0.0-p0/rakefile +165 -0
- data/lib/rdx.rb +331 -0
- data/lib/rdx/assertions.rb +484 -0
- data/lib/rdx/binding.rb +151 -0
- data/lib/rdx/code_object.rb +598 -0
- data/lib/rdx/comment.rb +338 -0
- data/lib/rdx/convention.rb +1174 -0
- data/lib/rdx/directive.rb +1432 -0
- data/lib/rdx/example.rb +679 -0
- data/lib/rdx/generator.rb +112 -0
- data/lib/rdx/generator/rdoc.rb +1006 -0
- data/lib/rdx/options.rb +359 -0
- data/lib/rdx/plain_text.rb +65 -0
- data/lib/rdx/reporter.rb +421 -0
- data/lib/rdx/ruby_lex.rb +324 -0
- data/lib/rdx/runner.rb +309 -0
- data/lib/rdx/source_file.rb +94 -0
- data/lib/rdx/specification.rb +194 -0
- data/lib/rdx/statement.rb +248 -0
- data/lib/rdx/store.rb +119 -0
- data/lib/rdx/task.rb +361 -0
- data/lib/rdx/text.rb +688 -0
- data/lib/rdx/version.rb +15 -0
- data/rakefile +64 -0
- metadata +203 -0
@@ -0,0 +1,237 @@
|
|
1
|
+
--- stdlib/orig/lib/uri/common.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/uri/common.rb 2015-06-25 17:34:52 +0000
|
3
|
+
@@ -67,6 +67,7 @@
|
4
|
+
#
|
5
|
+
# == Synopsis
|
6
|
+
#
|
7
|
+
+ # :rdx: off -
|
8
|
+
# URI::Parser.new([opts])
|
9
|
+
#
|
10
|
+
# == Args
|
11
|
+
@@ -77,6 +78,8 @@
|
12
|
+
# The constructor generetes set of regexps for parsing URIs.
|
13
|
+
#
|
14
|
+
# You can use the following keys:
|
15
|
+
+ #
|
16
|
+
+ # :rdx: off -
|
17
|
+
#
|
18
|
+
# * :ESCAPED (URI::PATTERN::ESCAPED in default)
|
19
|
+
# * :UNRESERVED (URI::PATTERN::UNRESERVED in default)
|
20
|
+
@@ -87,12 +90,12 @@
|
21
|
+
# == Examples
|
22
|
+
#
|
23
|
+
# p = URI::Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})")
|
24
|
+
- # u = p.parse("http://example.jp/%uABCD") #=> #<URI::HTTP:0xb78cf4f8 URL:http://example.jp/%uABCD>
|
25
|
+
- # URI.parse(u.to_s) #=> raises URI::InvalidURIError
|
26
|
+
+ # u = p.parse("http://example.jp/%uABCD") # > #<URI::HTTP:0xb78cf4f8 URL:http://example.jp/%uABCD>
|
27
|
+
+ # URI.parse(u.to_s) # raises URI::InvalidURIError
|
28
|
+
#
|
29
|
+
- # s = "http://examle.com/ABCD"
|
30
|
+
- # u1 = p.parse(s) #=> #<URI::HTTP:0xb78c3220 URL:http://example.com/ABCD>
|
31
|
+
- # u2 = URI.parse(s) #=> #<URI::HTTP:0xb78b6d54 URL:http://example.com/ABCD>
|
32
|
+
+ # s = "http://example.com/ABCD"
|
33
|
+
+ # u1 = p.parse(s) # > #<URI::HTTP:0xb78c3220 URL:http://example.com/ABCD>
|
34
|
+
+ # u2 = URI.parse(s) # > #<URI::HTTP:0xb78b6d54 URL:http://example.com/ABCD>
|
35
|
+
# u1 == u2 #=> true
|
36
|
+
# u1.eql?(u2) #=> false
|
37
|
+
#
|
38
|
+
@@ -204,7 +207,7 @@
|
39
|
+
#
|
40
|
+
# p = URI::Parser.new
|
41
|
+
# p.parse("ldap://ldap.example.com/dc=example?user=john")
|
42
|
+
- # #=> #<URI::LDAP:0x00000000b9e7e8 URL:ldap://ldap.example.com/dc=example?user=john>
|
43
|
+
+ # # > #<URI::LDAP:0x00000000b9e7e8 URL:ldap://ldap.example.com/dc=example?user=john>
|
44
|
+
#
|
45
|
+
def parse(uri)
|
46
|
+
scheme, userinfo, host, port,
|
47
|
+
@@ -589,6 +592,7 @@
|
48
|
+
#
|
49
|
+
# == Synopsis
|
50
|
+
#
|
51
|
+
+ # :rdx: off -
|
52
|
+
# URI.escape(str [, unsafe])
|
53
|
+
#
|
54
|
+
# == Args
|
55
|
+
@@ -609,13 +613,12 @@
|
56
|
+
# require 'uri'
|
57
|
+
#
|
58
|
+
# enc_uri = URI.escape("http://example.com/?a=\11\15")
|
59
|
+
- # p enc_uri
|
60
|
+
# # => "http://example.com/?a=%09%0D"
|
61
|
+
#
|
62
|
+
- # p URI.unescape(enc_uri)
|
63
|
+
+ # URI.unescape(enc_uri)
|
64
|
+
# # => "http://example.com/?a=\t\r"
|
65
|
+
#
|
66
|
+
- # p URI.escape("@?@!", "!?")
|
67
|
+
+ # URI.escape("@?@!", "!?")
|
68
|
+
# # => "@%3F@%21"
|
69
|
+
#
|
70
|
+
def escape(*arg)
|
71
|
+
@@ -626,6 +629,7 @@
|
72
|
+
#
|
73
|
+
# == Synopsis
|
74
|
+
#
|
75
|
+
+ # :rdx: off -
|
76
|
+
# URI.unescape(str)
|
77
|
+
#
|
78
|
+
# == Args
|
79
|
+
@@ -638,10 +642,9 @@
|
80
|
+
# require 'uri'
|
81
|
+
#
|
82
|
+
# enc_uri = URI.escape("http://example.com/?a=\11\15")
|
83
|
+
- # p enc_uri
|
84
|
+
# # => "http://example.com/?a=%09%0D"
|
85
|
+
#
|
86
|
+
- # p URI.unescape(enc_uri)
|
87
|
+
+ # URI.unescape(enc_uri)
|
88
|
+
# # => "http://example.com/?a=\t\r"
|
89
|
+
#
|
90
|
+
def unescape(*arg)
|
91
|
+
@@ -680,6 +683,7 @@
|
92
|
+
#
|
93
|
+
# == Synopsis
|
94
|
+
#
|
95
|
+
+ # :rdx: off -
|
96
|
+
# URI::split(uri)
|
97
|
+
#
|
98
|
+
# == Args
|
99
|
+
@@ -691,6 +695,7 @@
|
100
|
+
#
|
101
|
+
# Splits the string on following parts and returns array with result:
|
102
|
+
#
|
103
|
+
+ # :rdx: off -
|
104
|
+
# * Scheme
|
105
|
+
# * Userinfo
|
106
|
+
# * Host
|
107
|
+
@@ -705,7 +710,7 @@
|
108
|
+
#
|
109
|
+
# require 'uri'
|
110
|
+
#
|
111
|
+
- # p URI.split("http://www.ruby-lang.org/")
|
112
|
+
+ # URI.split("http://www.ruby-lang.org/")
|
113
|
+
# # => ["http", nil, "www.ruby-lang.org", nil, nil, "/", nil, nil, nil]
|
114
|
+
#
|
115
|
+
def self.split(uri)
|
116
|
+
@@ -715,6 +720,7 @@
|
117
|
+
#
|
118
|
+
# == Synopsis
|
119
|
+
#
|
120
|
+
+ # :rdx: off -
|
121
|
+
# URI::parse(uri_str)
|
122
|
+
#
|
123
|
+
# == Args
|
124
|
+
@@ -729,18 +735,17 @@
|
125
|
+
# == Raises
|
126
|
+
#
|
127
|
+
# URI::InvalidURIError
|
128
|
+
- # Raised if URI given is not a correct one.
|
129
|
+
+ # Raised if URI given is not a correct one.
|
130
|
+
#
|
131
|
+
# == Usage
|
132
|
+
#
|
133
|
+
# require 'uri'
|
134
|
+
#
|
135
|
+
# uri = URI.parse("http://www.ruby-lang.org/")
|
136
|
+
- # p uri
|
137
|
+
- # # => #<URI::HTTP:0x202281be URL:http://www.ruby-lang.org/>
|
138
|
+
- # p uri.scheme
|
139
|
+
+ # # > #<URI::HTTP:0x202281be URL:http://www.ruby-lang.org/>
|
140
|
+
+ # uri.scheme
|
141
|
+
# # => "http"
|
142
|
+
- # p uri.host
|
143
|
+
+ # uri.host
|
144
|
+
# # => "www.ruby-lang.org"
|
145
|
+
#
|
146
|
+
def self.parse(uri)
|
147
|
+
@@ -750,6 +755,7 @@
|
148
|
+
#
|
149
|
+
# == Synopsis
|
150
|
+
#
|
151
|
+
+ # :rdx: off -
|
152
|
+
# URI::join(str[, str, ...])
|
153
|
+
#
|
154
|
+
# == Args
|
155
|
+
@@ -765,20 +771,20 @@
|
156
|
+
#
|
157
|
+
# require 'uri'
|
158
|
+
#
|
159
|
+
- # p URI.join("http://example.com/","main.rbx")
|
160
|
+
- # # => #<URI::HTTP:0x2022ac02 URL:http://localhost/main.rbx>
|
161
|
+
+ # URI.join("http://example.com/","main.rbx")
|
162
|
+
+ # # > #<URI::HTTP:0x2022ac02 URL:http://example.com/main.rbx>
|
163
|
+
#
|
164
|
+
- # p URI.join('http://example.com', 'foo')
|
165
|
+
- # # => #<URI::HTTP:0x01ab80a0 URL:http://example.com/foo>
|
166
|
+
+ # URI.join('http://example.com', 'foo')
|
167
|
+
+ # # > #<URI::HTTP:0x01ab80a0 URL:http://example.com/foo>
|
168
|
+
#
|
169
|
+
- # p URI.join('http://example.com', '/foo', '/bar')
|
170
|
+
- # # => #<URI::HTTP:0x01aaf0b0 URL:http://example.com/bar>
|
171
|
+
+ # URI.join('http://example.com', '/foo', '/bar')
|
172
|
+
+ # # > #<URI::HTTP:0x01aaf0b0 URL:http://example.com/bar>
|
173
|
+
#
|
174
|
+
- # p URI.join('http://example.com', '/foo', 'bar')
|
175
|
+
- # # => #<URI::HTTP:0x801a92af0 URL:http://example.com/bar>
|
176
|
+
+ # URI.join('http://example.com', '/foo', 'bar')
|
177
|
+
+ # # > #<URI::HTTP:0x801a92af0 URL:http://example.com/bar>
|
178
|
+
#
|
179
|
+
- # p URI.join('http://example.com', '/foo/', 'bar')
|
180
|
+
- # # => #<URI::HTTP:0x80135a3a0 URL:http://example.com/foo/bar>
|
181
|
+
+ # URI.join('http://example.com', '/foo/', 'bar')
|
182
|
+
+ # # > #<URI::HTTP:0x80135a3a0 URL:http://example.com/foo/bar>
|
183
|
+
#
|
184
|
+
#
|
185
|
+
def self.join(*str)
|
186
|
+
@@ -788,6 +794,7 @@
|
187
|
+
#
|
188
|
+
# == Synopsis
|
189
|
+
#
|
190
|
+
+ # :rdx: off -
|
191
|
+
# URI::extract(str[, schemes][,&blk])
|
192
|
+
#
|
193
|
+
# == Args
|
194
|
+
@@ -807,7 +814,7 @@
|
195
|
+
# require "uri"
|
196
|
+
#
|
197
|
+
# URI.extract("text here http://foo.example.org/bla and here mailto:test@example.com and here also.")
|
198
|
+
- # # => ["http://foo.example.com/bla", "mailto:test@example.com"]
|
199
|
+
+ # # => ["http://foo.example.org/bla", "mailto:test@example.com"]
|
200
|
+
#
|
201
|
+
def self.extract(str, schemes = nil, &block)
|
202
|
+
DEFAULT_PARSER.extract(str, schemes, &block)
|
203
|
+
@@ -816,6 +823,7 @@
|
204
|
+
#
|
205
|
+
# == Synopsis
|
206
|
+
#
|
207
|
+
+ # :rdx: off -
|
208
|
+
# URI::regexp([match_schemes])
|
209
|
+
#
|
210
|
+
# == Args
|
211
|
+
@@ -831,6 +839,7 @@
|
212
|
+
#
|
213
|
+
# == Usage
|
214
|
+
#
|
215
|
+
+ # :rdx: off
|
216
|
+
# require 'uri'
|
217
|
+
#
|
218
|
+
# # extract first URI from html_string
|
219
|
+
@@ -961,12 +970,12 @@
|
220
|
+
#
|
221
|
+
# This refers http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
|
222
|
+
#
|
223
|
+
- # ary = URI.decode_www_form("a=1&a=2&b=3")
|
224
|
+
- # p ary #=> [['a', '1'], ['a', '2'], ['b', '3']]
|
225
|
+
- # p ary.assoc('a').last #=> '1'
|
226
|
+
- # p ary.assoc('b').last #=> '3'
|
227
|
+
- # p ary.rassoc('a').last #=> '2'
|
228
|
+
- # p Hash[ary] # => {"a"=>"2", "b"=>"3"}
|
229
|
+
+ # ary = URI.decode_www_form("a=1&a=2&b=3")
|
230
|
+
+ # ary #=> [['a', '1'], ['a', '2'], ['b', '3']]
|
231
|
+
+ # ary.assoc('a').last #=> '1'
|
232
|
+
+ # ary.assoc('b').last #=> '3'
|
233
|
+
+ # hsh = Hash[ary] #=> {"a"=>"2", "b"=>"3"}
|
234
|
+
+ # hsh['a'] #=> "2"
|
235
|
+
#
|
236
|
+
# See URI.decode_www_form_component, URI.encode_www_form
|
237
|
+
def self.decode_www_form(str, enc=Encoding::UTF_8)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
--- stdlib/orig/lib/weakref.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/weakref.rb 2015-06-27 15:19:00 +0000
|
3
|
+
@@ -8,11 +8,12 @@
|
4
|
+
# Usage:
|
5
|
+
#
|
6
|
+
# foo = Object.new # create a new object instance
|
7
|
+
-# p foo.to_s # original's class
|
8
|
+
+# foo.to_s # -> "#<Object:0x00000002e26920>"
|
9
|
+
# foo = WeakRef.new(foo) # reassign foo with WeakRef instance
|
10
|
+
-# p foo.to_s # should be same class
|
11
|
+
+# foo.to_s # -> "#<Object:0x00000002e26920>" # same as above
|
12
|
+
# GC.start # start the garbage collector
|
13
|
+
-# p foo.to_s # should raise exception (recycled)
|
14
|
+
+# GC.start # sometimes two cycles are required
|
15
|
+
+# foo.to_s # raises WeakRef::RefError: Invalid Reference - probably recycled
|
16
|
+
#
|
17
|
+
# == Example
|
18
|
+
#
|
19
|
+
@@ -45,7 +46,7 @@
|
20
|
+
# c['baz'] = Object.new
|
21
|
+
# c['qux'] = omg
|
22
|
+
# puts c.inspect
|
23
|
+
-# #=> {"foo"=>"bar", "baz"=>#<Object:0x007f4ddfc6cb48>, "qux"=>"lol"}
|
24
|
+
+# # prints: {"foo"=>"bar", "baz"=>#<Object:0x00000003599888>, "qux"=>"lol"}
|
25
|
+
#
|
26
|
+
# # Now run the garbage collector
|
27
|
+
# GC.start
|
28
|
+
@@ -55,7 +56,7 @@
|
29
|
+
# omg #=> "lol"
|
30
|
+
#
|
31
|
+
# puts c.inspect
|
32
|
+
-# #=> WeakRef::RefError: Invalid Reference - probably recycled
|
33
|
+
+# # raises WeakRef::RefError: Invalid Reference - probably recycled
|
34
|
+
#
|
35
|
+
# You can see the local variable +omg+ stayed, although it's reference in our
|
36
|
+
# hash object was garbage collected, along with the rest of the keys and
|
@@ -0,0 +1,27 @@
|
|
1
|
+
--- stdlib/orig/lib/yaml/store.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/yaml/store.rb 2015-06-11 07:51:48 +0000
|
3
|
+
@@ -8,7 +8,9 @@
|
4
|
+
# to dump objects instead of Marshal.
|
5
|
+
#
|
6
|
+
# == Example
|
7
|
+
-#
|
8
|
+
+# :rdx: in_tmpdir!
|
9
|
+
+# :rdx: toplevel
|
10
|
+
+#
|
11
|
+
# require 'yaml/store'
|
12
|
+
#
|
13
|
+
# Person = Struct.new :first_name, :last_name
|
14
|
+
@@ -21,8 +23,13 @@
|
15
|
+
# store["people"] = people
|
16
|
+
# store["greeting"] = { "hello" => "world" }
|
17
|
+
# end
|
18
|
+
+#
|
19
|
+
+#-- rdx
|
20
|
+
+# Object.send :remove_const, :Person
|
21
|
+
+#++
|
22
|
+
#
|
23
|
+
# After running the above code, the contents of "test.store" will be:
|
24
|
+
+# :rdx: check_file test.store
|
25
|
+
#
|
26
|
+
# ---
|
27
|
+
# people:
|
@@ -0,0 +1,165 @@
|
|
1
|
+
|
2
|
+
Dir.chdir File.dirname(__FILE__)
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'rake'
|
6
|
+
require 'pathname'
|
7
|
+
|
8
|
+
SRC_URL = 'http://cache.ruby-lang.org/pub/ruby/ruby-2.0.0-p0.tar.gz'.freeze
|
9
|
+
ARCHIVE_NAME = Pathname(SRC_URL).basename
|
10
|
+
ARCHIVE_BASENAME = ARCHIVE_NAME.basename('.tar.gz')
|
11
|
+
INSTALL = Pathname 'install'
|
12
|
+
CORE = Pathname 'core'
|
13
|
+
STDLIB = Pathname 'stdlib'
|
14
|
+
DIFF = Pathname 'diffs'
|
15
|
+
OLD = Pathname 'orig'
|
16
|
+
NEW = Pathname 'patched'
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
def uninstall unit
|
21
|
+
rm_r unit + NEW rescue nil
|
22
|
+
rm_r unit + OLD rescue nil
|
23
|
+
Pathname.glob INSTALL+unit+'{*,.rdx*}' do |install_entry|
|
24
|
+
entry = install_entry.relative_path_from(INSTALL)
|
25
|
+
rm_r entry rescue nil
|
26
|
+
end
|
27
|
+
rmdir unit rescue nil
|
28
|
+
end
|
29
|
+
desc "Remove installation products for Ruby 2.0.0-p0 RDX examples"
|
30
|
+
task :uninstall do
|
31
|
+
uninstall CORE
|
32
|
+
uninstall STDLIB
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
task :cp_install do
|
37
|
+
cp_r INSTALL+CORE, '.'
|
38
|
+
cp_r INSTALL+STDLIB, '.'
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
task :fetch do
|
43
|
+
require 'open-uri'
|
44
|
+
if File.exist? ARCHIVE_NAME
|
45
|
+
puts "File #{ARCHIVE_NAME} already downloaded!"
|
46
|
+
else
|
47
|
+
begin
|
48
|
+
print "Fetching #{SRC_URL} (may require a few minutes)... "
|
49
|
+
open SRC_URL, 'rb' do |file|
|
50
|
+
File.binwrite ARCHIVE_NAME, file.read
|
51
|
+
puts 'Done!'
|
52
|
+
puts
|
53
|
+
end
|
54
|
+
rescue
|
55
|
+
puts "Failed!"
|
56
|
+
puts "Retry later or download it manually and place it in this directory"
|
57
|
+
exit -1
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
task :unpack do
|
64
|
+
require 'rubygems/package'
|
65
|
+
require 'zlib'
|
66
|
+
begin
|
67
|
+
tar_extract = Gem::Package::TarReader.new(Zlib::GzipReader.open(ARCHIVE_NAME))
|
68
|
+
tar_extract.rewind
|
69
|
+
puts "Extracting files:"
|
70
|
+
core_diff = CORE + DIFF
|
71
|
+
stdlib_diff = STDLIB + DIFF
|
72
|
+
core_old = CORE + OLD
|
73
|
+
stdlib_old = STDLIB + OLD
|
74
|
+
tar_extract.each do |entry|
|
75
|
+
next if entry.directory?
|
76
|
+
entry_name = Pathname(entry.full_name).relative_path_from(ARCHIVE_BASENAME)
|
77
|
+
if (core_diff + "#{entry_name}.diff").exist?
|
78
|
+
path = core_old + entry_name
|
79
|
+
path.dirname.mkpath
|
80
|
+
puts "\t#{path}"
|
81
|
+
File.binwrite path, entry.read
|
82
|
+
elsif (stdlib_diff + "#{entry_name}.diff").exist?
|
83
|
+
path = stdlib_old + entry_name
|
84
|
+
path.dirname.mkpath
|
85
|
+
puts "\t#{path}"
|
86
|
+
File.binwrite path, entry.read
|
87
|
+
end
|
88
|
+
end
|
89
|
+
puts
|
90
|
+
ensure
|
91
|
+
tar_extract.close
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
task :cp_all do
|
96
|
+
cp_r CORE+OLD, CORE+NEW
|
97
|
+
cp_r STDLIB+OLD, STDLIB+NEW
|
98
|
+
end
|
99
|
+
|
100
|
+
def mk_unit unit
|
101
|
+
base_dir = unit + DIFF
|
102
|
+
Pathname.glob base_dir+'**/*.diff' do |diff_file|
|
103
|
+
filename = diff_file.relative_path_from(base_dir).sub_ext('')
|
104
|
+
target = unit + NEW + filename
|
105
|
+
sh "patch -u #{target} #{diff_file}" do end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
task :mk_all => :cp_all do
|
109
|
+
mk_unit CORE
|
110
|
+
mk_unit STDLIB
|
111
|
+
end
|
112
|
+
|
113
|
+
task :clean do
|
114
|
+
GC.start
|
115
|
+
rm ARCHIVE_NAME rescue nil
|
116
|
+
rm_r CORE + DIFF rescue nil
|
117
|
+
rm_r STDLIB + DIFF rescue nil
|
118
|
+
end
|
119
|
+
|
120
|
+
desc "Install RDX examples of Ruby 2.0.0-p0"
|
121
|
+
task :install => [:uninstall, :cp_install, :fetch, :unpack, :mk_all, :clean]
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
task :rm_diffs do
|
126
|
+
rm_r CORE + DIFF rescue nil
|
127
|
+
rm_r STDLIB + DIFF rescue nil
|
128
|
+
end
|
129
|
+
|
130
|
+
def mk_diffs_of unit
|
131
|
+
base_dir = unit + NEW
|
132
|
+
Pathname.glob "#{base_dir}/**/*" do |new_file|
|
133
|
+
next unless new_file.file?
|
134
|
+
filename = new_file.relative_path_from(base_dir)
|
135
|
+
old_file = unit + OLD + filename
|
136
|
+
unless old_file.file?
|
137
|
+
warn "Missing file: #{old_file}, skipping..."
|
138
|
+
next
|
139
|
+
end
|
140
|
+
diff_file = unit + DIFF + "#{filename}.diff"
|
141
|
+
diff_file.dirname.mkpath
|
142
|
+
sh "diff -u #{old_file} #{new_file} > #{diff_file}" do end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
task :mk_diffs => :rm_diffs do
|
146
|
+
mk_diffs_of CORE
|
147
|
+
mk_diffs_of STDLIB
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
def mk_install_of unit
|
153
|
+
Pathname.glob INSTALL+unit+'{*,.rdx*}' do |install_entry|
|
154
|
+
entry = install_entry.relative_path_from(INSTALL)
|
155
|
+
rm_r install_entry rescue nil
|
156
|
+
cp_r entry, install_entry
|
157
|
+
end
|
158
|
+
rm_r unit + DIFF rescue nil
|
159
|
+
end
|
160
|
+
|
161
|
+
desc "Generate the installation (for developers)"
|
162
|
+
task :mk_install => [:mk_diffs] do
|
163
|
+
mk_install_of CORE
|
164
|
+
mk_install_of STDLIB
|
165
|
+
end
|