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,66 @@
|
|
1
|
+
--- stdlib/orig/lib/shellwords.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/shellwords.rb 2015-06-25 16:25:25 +0000
|
3
|
+
@@ -25,7 +25,7 @@
|
4
|
+
# Be careful you don't leave a quote unmatched.
|
5
|
+
#
|
6
|
+
# argv = "they all ran after the farmer's wife".shellsplit
|
7
|
+
-# #=> ArgumentError: Unmatched double quote: ...
|
8
|
+
+# # raises ArgumentError: Unmatched double quote
|
9
|
+
#
|
10
|
+
# In this case, you might want to use Shellwords.escape, or it's alias
|
11
|
+
# String#shellescape.
|
12
|
+
@@ -33,13 +33,24 @@
|
13
|
+
# This method will escape the String for you to safely use with a Bourne shell.
|
14
|
+
#
|
15
|
+
# argv = Shellwords.escape("special's.txt")
|
16
|
+
-# argv #=> "special\\s.txt"
|
17
|
+
+# argv #=> "special\\'s.txt"
|
18
|
+
+# :rdx: off
|
19
|
+
# system("cat " + argv)
|
20
|
+
+# :rdx: on
|
21
|
+
#
|
22
|
+
# Shellwords also comes with a core extension for Array, Array#shelljoin.
|
23
|
+
#
|
24
|
+
+# :rdx: off
|
25
|
+
# argv = %w{ls -lta lib}
|
26
|
+
# system(argv.shelljoin)
|
27
|
+
+# on my system produces:
|
28
|
+
+# total 1020
|
29
|
+
+# drwxr-xr-x 24 11270410 Administrators 40960 Apr 29 12:11 ..
|
30
|
+
+# drwxr-xr-x 23 11270410 Administrators 16384 Apr 29 12:11 .
|
31
|
+
+# drwxr-xr-x 5 11270410 Administrators 0 Apr 29 12:11 irb
|
32
|
+
+# drwxr-xr-x 2 11270410 Administrators 0 Apr 29 12:11 matrix
|
33
|
+
+# drwxr-xr-x 3 11270410 Administrators 0 Apr 29 12:11 net
|
34
|
+
+# ... (many other lines) ...
|
35
|
+
#
|
36
|
+
# You can use this method to create an escaped string out of an array of tokens
|
37
|
+
# separated by a space. In this example we'll use the literal shortcut for
|
38
|
+
@@ -105,6 +116,7 @@
|
39
|
+
# argv = "It's better to give than to receive".shellescape
|
40
|
+
# argv #=> "It\\'s\\ better\\ to\\ give\\ than\\ to\\ receive"
|
41
|
+
#
|
42
|
+
+ # :rdx: off
|
43
|
+
# # Search files in lib for method definitions
|
44
|
+
# pattern = "^[ \t]*def "
|
45
|
+
# open("| grep -Ern #{pattern.shellescape} lib") { |grep|
|
46
|
+
@@ -164,12 +176,18 @@
|
47
|
+
#
|
48
|
+
# You can also mix non-string objects in the elements as allowed in Array#join.
|
49
|
+
#
|
50
|
+
- # output = `#{['ps', '-p', $$].shelljoin}`
|
51
|
+
+ # :rdx: off
|
52
|
+
+ # system ['ps', '-p', $$].shelljoin
|
53
|
+
+ #
|
54
|
+
+ # on my machine (running CYGWIN) produces:
|
55
|
+
+ #
|
56
|
+
+ # PID PPID PGID WINPID TTY UID STIME COMMAND
|
57
|
+
+ # 2736 888 2736 3692 pty1 1000 10:59:52 /usr/bin/bash
|
58
|
+
#
|
59
|
+
def shelljoin(array)
|
60
|
+
array.map { |arg| shellescape(arg) }.join(' ')
|
61
|
+
end
|
62
|
+
-
|
63
|
+
+
|
64
|
+
module_function :shelljoin
|
65
|
+
|
66
|
+
class << self
|
@@ -0,0 +1,37 @@
|
|
1
|
+
--- stdlib/orig/lib/singleton.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/singleton.rb 2015-06-25 16:25:55 +0000
|
3
|
+
@@ -19,7 +19,7 @@
|
4
|
+
# # => true
|
5
|
+
#
|
6
|
+
# Klass.new
|
7
|
+
-# # => NoMethodError - new is private ...
|
8
|
+
+# # raises NoMethodError # new is private ...
|
9
|
+
#
|
10
|
+
# The instance is created at upon the first call of Klass.instance().
|
11
|
+
#
|
12
|
+
@@ -62,7 +62,8 @@
|
13
|
+
# state, from the instance. Classes using Singleton can provide custom
|
14
|
+
# _load(str) and _dump(depth) methods to retain some of the previous state of
|
15
|
+
# the instance.
|
16
|
+
-#
|
17
|
+
+# :rdx: toplevel
|
18
|
+
+#
|
19
|
+
# require 'singleton'
|
20
|
+
#
|
21
|
+
# class Example
|
22
|
+
@@ -89,9 +90,12 @@
|
23
|
+
# a.keep = nil
|
24
|
+
# a.strip = nil
|
25
|
+
# b = Marshal.load(stored_state)
|
26
|
+
-# p a == b # => true
|
27
|
+
-# p a.keep # => "keep this"
|
28
|
+
-# p a.strip # => nil
|
29
|
+
+# a == b # => true
|
30
|
+
+# a.keep # => "keep this"
|
31
|
+
+# a.strip # => nil
|
32
|
+
+#
|
33
|
+
+#-- rdx
|
34
|
+
+# Object.send :remove_const, :Example
|
35
|
+
#
|
36
|
+
module Singleton
|
37
|
+
# Raises a TypeError to prevent cloning.
|
@@ -0,0 +1,104 @@
|
|
1
|
+
--- stdlib/orig/lib/tempfile.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/tempfile.rb 2015-06-11 07:51:48 +0000
|
3
|
+
@@ -21,9 +21,10 @@
|
4
|
+
# require 'tempfile'
|
5
|
+
#
|
6
|
+
# file = Tempfile.new('foo')
|
7
|
+
-# file.path # => A unique filename in the OS's temp directory,
|
8
|
+
-# # e.g.: "/tmp/foo.24722.0"
|
9
|
+
-# # This filename contains 'foo' in its basename.
|
10
|
+
+# # A unique filename in the OS's temp directory,
|
11
|
+
+# # e.g.: "/tmp/foo.24722.0"
|
12
|
+
+# # Its basename starts with 'foo':
|
13
|
+
+# File.fnmatch? '**/foo*', file.path #=> true
|
14
|
+
# file.write("hello world")
|
15
|
+
# file.rewind
|
16
|
+
# file.read # => "hello world"
|
17
|
+
@@ -42,12 +43,12 @@
|
18
|
+
# until they're garbage collected. The existence of these temp files can make
|
19
|
+
# it harder to determine a new Tempfile filename.
|
20
|
+
#
|
21
|
+
-# Therefore, one should always call #unlink or close in an ensure block, like
|
22
|
+
+# Therefore, one should always call #unlink or #close in an ensure block, like
|
23
|
+
# this:
|
24
|
+
#
|
25
|
+
# file = Tempfile.new('foo')
|
26
|
+
# begin
|
27
|
+
-# ...do something with file...
|
28
|
+
+# # ...do something with file...
|
29
|
+
# ensure
|
30
|
+
# file.close
|
31
|
+
# file.unlink # deletes the temp file
|
32
|
+
@@ -95,11 +96,13 @@
|
33
|
+
# element, and end with the second element. For example:
|
34
|
+
#
|
35
|
+
# file = Tempfile.new('hello')
|
36
|
+
- # file.path # => something like: "/tmp/hello2843-8392-92849382--0"
|
37
|
+
+ # File.fnmatch? '**/hello*', file.path #=> true
|
38
|
+
+ # # file.path is something like: "/tmp/hello2843-8392-92849382--0"
|
39
|
+
#
|
40
|
+
# # Use the Array form to enforce an extension in the filename:
|
41
|
+
# file = Tempfile.new(['hello', '.jpg'])
|
42
|
+
- # file.path # => something like: "/tmp/hello2843-8392-92849382--0.jpg"
|
43
|
+
+ # File.fnmatch? '**/hello*.jpg', file.path #=> true
|
44
|
+
+ # # file.path is something like: "/tmp/hello2843-8392-70154257--0.jpg"
|
45
|
+
#
|
46
|
+
# The temporary file will be placed in the directory as specified
|
47
|
+
# by the +tmpdir+ parameter. By default, this is +Dir.tmpdir+.
|
48
|
+
@@ -108,15 +111,16 @@
|
49
|
+
# are tainted by default, and +Dir.tmpdir+'s return value might
|
50
|
+
# come from environment variables (e.g. <tt>$TMPDIR</tt>).
|
51
|
+
#
|
52
|
+
- # file = Tempfile.new('hello', '/home/aisaka')
|
53
|
+
- # file.path # => something like: "/home/aisaka/hello2843-8392-92849382--0"
|
54
|
+
+ # file = Tempfile.new('hello', Dir.pwd)
|
55
|
+
+ # File.fnmatch? "#{Dir.pwd}/hello*", file.path
|
56
|
+
+ # # file.path is something like: "./hello2843-8392-92849382--0"
|
57
|
+
#
|
58
|
+
# You can also pass an options hash. Under the hood, Tempfile creates
|
59
|
+
# the temporary file using +File.open+. These options will be passed to
|
60
|
+
# +File.open+. This is mostly useful for specifying encoding
|
61
|
+
# options, e.g.:
|
62
|
+
#
|
63
|
+
- # Tempfile.new('hello', '/home/aisaka', :encoding => 'ascii-8bit')
|
64
|
+
+ # Tempfile.new('hello', Dir.tmpdir, :encoding => 'ascii-8bit')
|
65
|
+
#
|
66
|
+
# # You can also omit the 'tmpdir' parameter:
|
67
|
+
# Tempfile.new('hello', :encoding => 'ascii-8bit')
|
68
|
+
@@ -199,7 +203,7 @@
|
69
|
+
#
|
70
|
+
# file = Tempfile.new('foo')
|
71
|
+
# begin
|
72
|
+
- # ...do something with file...
|
73
|
+
+ # # ...do something with file...
|
74
|
+
# ensure
|
75
|
+
# file.close
|
76
|
+
# file.unlink # deletes the temp file
|
77
|
+
@@ -220,7 +224,7 @@
|
78
|
+
# file = Tempfile.new('foo')
|
79
|
+
# file.unlink # On Windows this silently fails.
|
80
|
+
# begin
|
81
|
+
- # ... do something with file ...
|
82
|
+
+ # # ... do something with file ...
|
83
|
+
# ensure
|
84
|
+
# file.close! # Closes the file handle. If the file wasn't unlinked
|
85
|
+
# # because #unlink failed, then this method will attempt
|
86
|
+
@@ -305,14 +309,14 @@
|
87
|
+
#
|
88
|
+
# In any case, all arguments (+*args+) will be passed to Tempfile.new.
|
89
|
+
#
|
90
|
+
- # Tempfile.open('foo', '/home/temp') do |f|
|
91
|
+
- # ... do something with f ...
|
92
|
+
+ # Tempfile.open('foo') do |f|
|
93
|
+
+ # # ... do something with f ...
|
94
|
+
# end
|
95
|
+
#
|
96
|
+
# # Equivalent:
|
97
|
+
- # f = Tempfile.open('foo', '/home/temp')
|
98
|
+
+ # f = Tempfile.open('foo')
|
99
|
+
# begin
|
100
|
+
- # ... do something with f ...
|
101
|
+
+ # # ... do something with f ...
|
102
|
+
# ensure
|
103
|
+
# f.close
|
104
|
+
# end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
--- stdlib/orig/lib/thread.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/thread.rb 2015-06-25 16:26:51 +0000
|
3
|
+
@@ -1,4 +1,4 @@
|
4
|
+
-#
|
5
|
+
+# :rdx: off
|
6
|
+
# thread.rb - thread support classes
|
7
|
+
# by Yukihiro Matsumoto <matz@netlab.co.jp>
|
8
|
+
#
|
9
|
+
@@ -120,6 +120,8 @@
|
10
|
+
# This class provides a way to synchronize communication between threads.
|
11
|
+
#
|
12
|
+
# Example:
|
13
|
+
+#
|
14
|
+
+# :rdx: is_slow
|
15
|
+
#
|
16
|
+
# require 'thread'
|
17
|
+
#
|
18
|
+
@@ -142,6 +144,20 @@
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# consumer.join
|
22
|
+
+#
|
23
|
+
+# produces something like:
|
24
|
+
+# :rdx: indicative_output
|
25
|
+
+#
|
26
|
+
+# 0 produced
|
27
|
+
+# 1 produced
|
28
|
+
+# consumed 0
|
29
|
+
+# 2 produced
|
30
|
+
+# 3 produced
|
31
|
+
+# consumed 1
|
32
|
+
+# consumed 2
|
33
|
+
+# consumed 3
|
34
|
+
+# 4 produced
|
35
|
+
+# consumed 4
|
36
|
+
#
|
37
|
+
class Queue
|
38
|
+
#
|
@@ -0,0 +1,140 @@
|
|
1
|
+
--- stdlib/orig/lib/time.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/time.rb 2015-06-25 17:34:52 +0000
|
3
|
+
@@ -28,21 +28,21 @@
|
4
|
+
# === Converting to a String
|
5
|
+
#
|
6
|
+
# t = Time.now
|
7
|
+
-# t.iso8601 # => "2011-10-05T22:26:12-04:00"
|
8
|
+
-# t.rfc2822 # => "Wed, 05 Oct 2011 22:26:12 -0400"
|
9
|
+
-# t.httpdate # => "Thu, 06 Oct 2011 02:26:12 GMT"
|
10
|
+
+# t.iso8601 # -> "2011-10-05T22:26:12-04:00"
|
11
|
+
+# t.rfc2822 # -> "Wed, 05 Oct 2011 22:26:12 -0400"
|
12
|
+
+# t.httpdate # -> "Thu, 06 Oct 2011 02:26:12 GMT"
|
13
|
+
#
|
14
|
+
# === Time.parse
|
15
|
+
#
|
16
|
+
# #parse takes a string representation of a Time and attempts to parse it
|
17
|
+
# using a heuristic.
|
18
|
+
#
|
19
|
+
-# Date.parse("2010-10-31") #=> 2010-10-31 00:00:00 -0500
|
20
|
+
+# Date.parse("2010-10-31") # 2010-10-31 00:00:00 -0500
|
21
|
+
#
|
22
|
+
# Any missing pieces of the date are inferred based on the current date.
|
23
|
+
#
|
24
|
+
# # assuming the current date is "2011-10-31"
|
25
|
+
-# Time.parse("12:00") #=> 2011-10-31 12:00:00 -0500
|
26
|
+
+# Time.parse("12:00") # 2011-10-31 12:00:00 -0500
|
27
|
+
#
|
28
|
+
# We can change the date used to infer our missing elements by passing a second
|
29
|
+
# object that responds to #mon, #day and #year, such as Date, Time or DateTime.
|
30
|
+
@@ -61,10 +61,10 @@
|
31
|
+
# dt = DateTime.parse("2010-10-30")
|
32
|
+
# md = MyDate.new(10,31,2010)
|
33
|
+
#
|
34
|
+
-# Time.parse("12:00", d) #=> 2010-10-28 12:00:00 -0500
|
35
|
+
-# Time.parse("12:00", t) #=> 2010-10-29 12:00:00 -0500
|
36
|
+
-# Time.parse("12:00", dt) #=> 2010-10-30 12:00:00 -0500
|
37
|
+
-# Time.parse("12:00", md) #=> 2010-10-31 12:00:00 -0500
|
38
|
+
+# Time.parse("12:00", d) #=> Time.new(2010,10,28, 12,0,0)
|
39
|
+
+# Time.parse("12:00", t) #=> Time.new(2010,10,29, 12,0,0)
|
40
|
+
+# Time.parse("12:00", dt) #=> Time.new(2010,10,30, 12,0,0)
|
41
|
+
+# Time.parse("12:00", md) #=> Time.new(2010,10,31, 12,0,0)
|
42
|
+
#
|
43
|
+
# #parse also accepts an optional block. You can use this block to specify how
|
44
|
+
# to handle the year component of the date. This is specifically designed for
|
45
|
+
@@ -72,9 +72,9 @@
|
46
|
+
# years prior to 70 as the year 2000+ you could write this:
|
47
|
+
#
|
48
|
+
# Time.parse("01-10-31") {|year| year + (year < 70 ? 2000 : 1900)}
|
49
|
+
-# #=> 2001-10-31 00:00:00 -0500
|
50
|
+
+# #=> Time.new(2001,10,31)
|
51
|
+
# Time.parse("70-10-31") {|year| year + (year < 70 ? 2000 : 1900)}
|
52
|
+
-# #=> 1970-10-31 00:00:00 -0500
|
53
|
+
+# #=> Time.new(1970,10,31)
|
54
|
+
#
|
55
|
+
# === Time.strptime
|
56
|
+
#
|
57
|
+
@@ -82,7 +82,7 @@
|
58
|
+
# to detect the format of the input string, you provide a second argument that
|
59
|
+
# is describes the format of the string. For example:
|
60
|
+
#
|
61
|
+
-# Time.strptime("2000-10-31", "%Y-%m-%d") #=> 2000-10-31 00:00:00 -0500
|
62
|
+
+# Time.strptime("2000-10-31", "%Y-%m-%d") #=> Time.new(2000,10,31)
|
63
|
+
|
64
|
+
class Time
|
65
|
+
class << Time
|
66
|
+
@@ -272,6 +272,7 @@
|
67
|
+
# If a block is given, the year described in +date+ is converted by the
|
68
|
+
# block. For example:
|
69
|
+
#
|
70
|
+
+ # :rdx: off -
|
71
|
+
# Time.parse(...) {|y| 0 <= y && y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
|
72
|
+
#
|
73
|
+
# If the upper components of the given time are broken or missing, they are
|
74
|
+
@@ -281,16 +282,16 @@
|
75
|
+
# # Suppose it is "Thu Nov 29 14:33:20 GMT 2001" now and
|
76
|
+
# # your time zone is GMT:
|
77
|
+
# now = Time.parse("Thu Nov 29 14:33:20 GMT 2001")
|
78
|
+
- # Time.parse("16:30", now) #=> 2001-11-29 16:30:00 +0900
|
79
|
+
- # Time.parse("7/23", now) #=> 2001-07-23 00:00:00 +0900
|
80
|
+
- # Time.parse("Aug 31", now) #=> 2001-08-31 00:00:00 +0900
|
81
|
+
- # Time.parse("Aug 2000", now) #=> 2000-08-01 00:00:00 +0900
|
82
|
+
+ # Time.parse("16:30", now) #=> Time.new(2001,11,29, 16,30,0)
|
83
|
+
+ # Time.parse("7/23", now) #=> Time.new(2001, 7,23)
|
84
|
+
+ # Time.parse("Aug 31", now) #=> Time.new(2001, 8,31)
|
85
|
+
+ # Time.parse("Aug 2000", now) #=> Time.new(2000, 8, 1)
|
86
|
+
#
|
87
|
+
# Since there are numerous conflicts among locally defined time zone
|
88
|
+
# abbreviations all over the world, this method is not intended to
|
89
|
+
# understand all of them. For example, the abbreviation "CST" is
|
90
|
+
# used variously as:
|
91
|
+
- #
|
92
|
+
+ # :rdx: off -
|
93
|
+
# -06:00 in America/Chicago,
|
94
|
+
# -05:00 in America/Havana,
|
95
|
+
# +08:00 in Asia/Harbin,
|
96
|
+
@@ -311,7 +312,7 @@
|
97
|
+
# +date+ or if the Time class cannot represent specified date.
|
98
|
+
#
|
99
|
+
# This method can be used as a fail-safe for other parsing methods as:
|
100
|
+
- #
|
101
|
+
+ # :rdx: off -
|
102
|
+
# Time.rfc2822(date) rescue Time.parse(date)
|
103
|
+
# Time.httpdate(date) rescue Time.parse(date)
|
104
|
+
# Time.xmlschema(date) rescue Time.parse(date)
|
105
|
+
@@ -336,7 +337,7 @@
|
106
|
+
#
|
107
|
+
# If a block is given, the year described in +date+ is converted by the
|
108
|
+
# block. For example:
|
109
|
+
- #
|
110
|
+
+ # :rdx: off -
|
111
|
+
# Time.strptime(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
|
112
|
+
#
|
113
|
+
# Below is a list of the formating options:
|
114
|
+
@@ -553,7 +554,7 @@
|
115
|
+
|
116
|
+
#
|
117
|
+
# Returns a string which represents the time as date-time defined by RFC 2822:
|
118
|
+
- #
|
119
|
+
+ # :rdx: off -
|
120
|
+
# day-of-week, DD month-name CCYY hh:mm:ss zone
|
121
|
+
#
|
122
|
+
# where zone is [+-]hhmm.
|
123
|
+
@@ -588,7 +589,7 @@
|
124
|
+
#
|
125
|
+
# Returns a string which represents the time as RFC 1123 date of HTTP-date
|
126
|
+
# defined by RFC 2616:
|
127
|
+
- #
|
128
|
+
+ # :rdx: off -
|
129
|
+
# day-of-week, DD month-name CCYY hh:mm:ss GMT
|
130
|
+
#
|
131
|
+
# Note that the result is always UTC (GMT).
|
132
|
+
@@ -606,7 +607,7 @@
|
133
|
+
#
|
134
|
+
# Returns a string which represents the time as a dateTime defined by XML
|
135
|
+
# Schema:
|
136
|
+
- #
|
137
|
+
+ # :rdx: off -
|
138
|
+
# CCYY-MM-DDThh:mm:ssTZD
|
139
|
+
# CCYY-MM-DDThh:mm:ss.sssTZD
|
140
|
+
#
|
@@ -0,0 +1,52 @@
|
|
1
|
+
--- stdlib/orig/lib/tmpdir.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/tmpdir.rb 2015-06-11 07:51:48 +0000
|
3
|
+
@@ -47,15 +47,16 @@
|
4
|
+
# - If it is a string, it is used as the prefix and no suffix is used.
|
5
|
+
# - If it is an array, first element is used as the prefix and second element is used as a suffix.
|
6
|
+
#
|
7
|
+
- # Dir.mktmpdir {|dir| dir is ".../d..." }
|
8
|
+
- # Dir.mktmpdir("foo") {|dir| dir is ".../foo..." }
|
9
|
+
- # Dir.mktmpdir(["foo", "bar"]) {|dir| dir is ".../foo...bar" }
|
10
|
+
+ # Dir.mktmpdir {|dir| File.fnmatch? '**/d*', dir } #=> true
|
11
|
+
+ # Dir.mktmpdir("foo") {|dir| File.fnmatch? '**/foo*', dir } #=> true
|
12
|
+
+ # Dir.mktmpdir(["foo", "bar"]) {|dir| File.fnmatch? '**/foo*bar', dir } #=> true
|
13
|
+
#
|
14
|
+
# The directory is created under Dir.tmpdir or
|
15
|
+
# the optional second argument <i>tmpdir</i> if non-nil value is given.
|
16
|
+
#
|
17
|
+
- # Dir.mktmpdir {|dir| dir is "#{Dir.tmpdir}/d..." }
|
18
|
+
- # Dir.mktmpdir(nil, "/var/tmp") {|dir| dir is "/var/tmp/d..." }
|
19
|
+
+ # Dir.mktmpdir {|dir| File.fnmatch? "#{Dir.tmpdir}/d*", dir } #=> true
|
20
|
+
+ # :rdx: if File.directory? '/tmp'
|
21
|
+
+ # Dir.mktmpdir(nil, "/tmp") {|dir| File.fnmatch? "/tmp/d*", dir } #=> true
|
22
|
+
#
|
23
|
+
# If a block is given,
|
24
|
+
# it is yielded with the path of the directory.
|
25
|
+
@@ -63,10 +64,15 @@
|
26
|
+
# using FileUtils.remove_entry before Dir.mktmpdir returns.
|
27
|
+
# The value of the block is returned.
|
28
|
+
#
|
29
|
+
+ # tmp_path = nil
|
30
|
+
# Dir.mktmpdir {|dir|
|
31
|
+
+ # tmp_path = dir
|
32
|
+
# # use the directory...
|
33
|
+
- # open("#{dir}/foo", "w") { ... }
|
34
|
+
+ # open("#{dir}/foo", "w") { |file|
|
35
|
+
+ # # ...
|
36
|
+
+ # }
|
37
|
+
# }
|
38
|
+
+ # File.exist? tmp_path #=> false
|
39
|
+
#
|
40
|
+
# If a block is not given,
|
41
|
+
# The path of the directory is returned.
|
42
|
+
@@ -75,7 +81,9 @@
|
43
|
+
# dir = Dir.mktmpdir
|
44
|
+
# begin
|
45
|
+
# # use the directory...
|
46
|
+
- # open("#{dir}/foo", "w") { ... }
|
47
|
+
+ # open("#{dir}/foo", "w") {
|
48
|
+
+ # # ...
|
49
|
+
+ # }
|
50
|
+
# ensure
|
51
|
+
# # remove the directory.
|
52
|
+
# FileUtils.remove_entry dir
|
@@ -0,0 +1,39 @@
|
|
1
|
+
--- stdlib/orig/lib/uri.rb 2015-06-11 07:51:45 +0000
|
2
|
+
+++ stdlib/patched/lib/uri.rb 2015-06-25 16:33:12 +0000
|
3
|
+
@@ -13,8 +13,7 @@
|
4
|
+
# require 'uri'
|
5
|
+
#
|
6
|
+
# uri = URI("http://foo.com/posts?id=30&limit=5#time=1305298413")
|
7
|
+
-# #=> #<URI::HTTP:0x00000000b14880
|
8
|
+
-# URL:http://foo.com/posts?id=30&limit=5#time=1305298413>
|
9
|
+
+# # > #<URI::HTTP:0x00000000b14880 URL:http://foo.com/posts?id=30&limit=5#time=1305298413>
|
10
|
+
# uri.scheme
|
11
|
+
# #=> "http"
|
12
|
+
# uri.host
|
13
|
+
@@ -30,22 +29,21 @@
|
14
|
+
# #=> "http://foo.com/posts?id=30&limit=5#time=1305298413"
|
15
|
+
#
|
16
|
+
# == Adding custom URIs
|
17
|
+
-#
|
18
|
+
+# :rdx: toplevel
|
19
|
+
# module URI
|
20
|
+
# class RSYNC < Generic
|
21
|
+
# DEFAULT_PORT = 873
|
22
|
+
# end
|
23
|
+
# @@schemes['RSYNC'] = RSYNC
|
24
|
+
# end
|
25
|
+
-# #=> URI::RSYNC
|
26
|
+
#
|
27
|
+
# URI.scheme_list
|
28
|
+
# #=> {"FTP"=>URI::FTP, "HTTP"=>URI::HTTP, "HTTPS"=>URI::HTTPS,
|
29
|
+
-# "LDAP"=>URI::LDAP, "LDAPS"=>URI::LDAPS, "MAILTO"=>URI::MailTo,
|
30
|
+
-# "RSYNC"=>URI::RSYNC}
|
31
|
+
+# # "LDAP"=>URI::LDAP, "LDAPS"=>URI::LDAPS, "MAILTO"=>URI::MailTo,
|
32
|
+
+# # "RSYNC"=>URI::RSYNC}
|
33
|
+
#
|
34
|
+
# uri = URI("rsync://rsync.foo.com")
|
35
|
+
-# #=> #<URI::RSYNC:0x00000000f648c8 URL:rsync://rsync.foo.com>
|
36
|
+
+# # > #<URI::RSYNC:0x00000000f648c8 URL:rsync://rsync.foo.com>
|
37
|
+
#
|
38
|
+
# == RFC References
|
39
|
+
#
|