Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 566b9d6ec232
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 924a5ee2dd47
Choose a head ref
  • 4 commits
  • 167 files changed
  • 1 contributor

Commits on Oct 28, 2014

  1. Copy the full SHA
    2bd2879 View commit details
  2. Copy the full SHA
    9ff5675 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8cfc303 View commit details
  4. Copy the full SHA
    924a5ee View commit details
Showing with 5,256 additions and 6,276 deletions.
  1. +0 −1 lib/ruby/1.8/resolv.rb
  2. +6 −0 lib/ruby/1.8/rexml/entity.rb
  3. +11 −0 lib/ruby/1.9/cgi/core.rb
  4. +3 −0 lib/ruby/1.9/dl/func.rb
  5. +3 −2 lib/ruby/1.9/drb/ssl.rb
  6. +1 −1 lib/ruby/1.9/gserver.rb
  7. +8 −3 lib/ruby/1.9/ipaddr.rb
  8. +6 −5 lib/ruby/1.9/net/http.rb
  9. +4 −3 lib/ruby/1.9/net/imap.rb
  10. +2 −2 lib/ruby/1.9/net/pop.rb
  11. +7 −6 lib/ruby/1.9/net/smtp.rb
  12. +4 −3 lib/ruby/1.9/open-uri.rb
  13. +34 −9 lib/ruby/1.9/optparse.rb
  14. +0 −4 lib/ruby/1.9/rake.rb
  15. +4 −3 lib/ruby/1.9/rake/alt_system.rb
  16. +201 −334 lib/ruby/1.9/rake/application.rb
  17. +11 −0 lib/ruby/1.9/rake/classic_namespace.rb
  18. +5 −28 lib/ruby/1.9/rake/clean.rb
  19. +16 −7 lib/ruby/1.9/rake/cloneable.rb
  20. +19 −8 lib/ruby/1.9/rake/contrib/ftptools.rb
  21. +191 −2 lib/ruby/1.9/rake/contrib/sys.rb
  22. +32 −13 lib/ruby/1.9/rake/dsl_definition.rb
  23. +1 −2 lib/ruby/1.9/rake/ext/core.rb
  24. +39 −0 lib/ruby/1.9/rake/ext/module.rb
  25. +4 −3 lib/ruby/1.9/rake/ext/string.rb
  26. +1 −2 lib/ruby/1.9/rake/ext/time.rb
  27. +20 −33 lib/ruby/1.9/rake/file_list.rb
  28. +2 −1 lib/ruby/1.9/rake/file_task.rb
  29. +10 −12 lib/ruby/1.9/rake/file_utils.rb
  30. +7 −6 lib/ruby/1.9/rake/file_utils_ext.rb
  31. +15 −2 lib/ruby/1.9/rake/gempackagetask.rb
  32. +18 −24 lib/ruby/1.9/rake/invocation_chain.rb
  33. +21 −0 lib/ruby/1.9/rake/lib/project.rake
  34. +5 −2 lib/ruby/1.9/rake/multi_task.rb
  35. +6 −11 lib/ruby/1.9/rake/packagetask.rb
  36. +0 −5 lib/ruby/1.9/rake/pseudo_status.rb
  37. +0 −8 lib/ruby/1.9/rake/rake_module.rb
  38. +234 −2 lib/ruby/1.9/rake/rdoctask.rb
  39. +2 −4 lib/ruby/1.9/rake/ruby182_test_unit_fix.rb
  40. +2 −3 lib/ruby/1.9/rake/runtest.rb
  41. +49 −100 lib/ruby/1.9/rake/task.rb
  42. +3 −14 lib/ruby/1.9/rake/task_arguments.rb
  43. +35 −25 lib/ruby/1.9/rake/task_manager.rb
  44. +1 −1 lib/ruby/1.9/rake/tasklib.rb
  45. +6 −16 lib/ruby/1.9/rake/testtask.rb
  46. +3 −4 lib/ruby/1.9/rake/version.rb
  47. +2 −3 lib/ruby/1.9/rake/win32.rb
  48. +68 −103 lib/ruby/1.9/rdoc.rb
  49. +2 −0 lib/ruby/1.9/rdoc/alias.rb
  50. +2 −0 lib/ruby/1.9/rdoc/anon_class.rb
  51. +26 −83 lib/ruby/1.9/rdoc/any_method.rb
  52. +12 −51 lib/ruby/1.9/rdoc/attr.rb
  53. +45 −248 lib/ruby/1.9/rdoc/class_module.rb
  54. +15 −76 lib/ruby/1.9/rdoc/code_object.rb
  55. +21 −3 lib/ruby/1.9/rdoc/code_objects.rb
  56. +8 −100 lib/ruby/1.9/rdoc/constant.rb
  57. +164 −163 lib/ruby/1.9/rdoc/context.rb
  58. +63 −73 lib/ruby/1.9/rdoc/cross_reference.rb
  59. +32 −37 lib/ruby/1.9/rdoc/encoding.rb
  60. +11 −21 lib/ruby/1.9/rdoc/generator.rb
  61. +67 −397 lib/ruby/1.9/rdoc/generator/darkfish.rb
  62. +65 −26 lib/ruby/1.9/rdoc/generator/markup.rb
  63. +63 −7 lib/ruby/1.9/rdoc/generator/ri.rb
  64. +321 −0 lib/ruby/1.9/rdoc/generator/template/darkfish/classpage.rhtml
  65. +124 −0 lib/ruby/1.9/rdoc/generator/template/darkfish/filepage.rhtml
  66. +61 −16 lib/ruby/1.9/rdoc/generator/template/darkfish/index.rhtml
  67. +64 −101 lib/ruby/1.9/rdoc/generator/template/darkfish/js/darkfish.js
  68. +4 −18 lib/ruby/1.9/rdoc/generator/template/darkfish/js/jquery.js
  69. +114 −0 lib/ruby/1.9/rdoc/generator/template/darkfish/js/quicksearch.js
  70. +10 −0 lib/ruby/1.9/rdoc/generator/template/darkfish/js/thickbox-compressed.js
  71. +338 −170 lib/ruby/1.9/rdoc/generator/template/darkfish/rdoc.css
  72. +2 −0 lib/ruby/1.9/rdoc/ghost_method.rb
  73. +12 −31 lib/ruby/1.9/rdoc/include.rb
  74. +49 −269 lib/ruby/1.9/rdoc/markup.rb
  75. +17 −24 lib/ruby/1.9/rdoc/markup/attribute_manager.rb
  76. +12 −49 lib/ruby/1.9/rdoc/markup/document.rb
  77. +17 −112 lib/ruby/1.9/rdoc/markup/formatter.rb
  78. +26 −94 lib/ruby/1.9/rdoc/markup/formatter_test_case.rb
  79. +1 −46 lib/ruby/1.9/rdoc/markup/heading.rb
  80. +0 −14 lib/ruby/1.9/rdoc/markup/indented_paragraph.rb
  81. +144 −1 lib/ruby/1.9/rdoc/markup/inline.rb
  82. +4 −24 lib/ruby/1.9/rdoc/markup/list.rb
  83. +4 −17 lib/ruby/1.9/rdoc/markup/list_item.rb
  84. +0 −14 lib/ruby/1.9/rdoc/markup/paragraph.rb
  85. +70 −124 lib/ruby/1.9/rdoc/markup/parser.rb
  86. +11 −77 lib/ruby/1.9/rdoc/markup/pre_process.rb
  87. +5 −5 lib/ruby/1.9/rdoc/markup/raw.rb
  88. +2 −0 lib/ruby/1.9/rdoc/markup/text_formatter_test_case.rb
  89. +3 −12 lib/ruby/1.9/rdoc/markup/to_ansi.rb
  90. +2 −0 lib/ruby/1.9/rdoc/markup/to_bs.rb
  91. +80 −138 lib/ruby/1.9/rdoc/markup/to_html.rb
  92. +13 −50 lib/ruby/1.9/rdoc/markup/to_html_crossref.rb
  93. +10 −42 lib/ruby/1.9/rdoc/markup/to_rdoc.rb
  94. +3 −0 lib/ruby/1.9/rdoc/markup/to_test.rb
  95. +5 −11 lib/ruby/1.9/rdoc/markup/to_tt_only.rb
  96. +0 −38 lib/ruby/1.9/rdoc/markup/verbatim.rb
  97. +2 −0 lib/ruby/1.9/rdoc/meta_method.rb
  98. +19 −62 lib/ruby/1.9/rdoc/method_attr.rb
  99. +9 −26 lib/ruby/1.9/rdoc/normal_class.rb
  100. +7 −10 lib/ruby/1.9/rdoc/normal_module.rb
  101. +25 −420 lib/ruby/1.9/rdoc/options.rb
  102. +50 −150 lib/ruby/1.9/rdoc/parser.rb
  103. +210 −386 lib/ruby/1.9/rdoc/parser/c.rb
  104. +114 −289 lib/ruby/1.9/rdoc/parser/ruby.rb
  105. +3 −8 lib/ruby/1.9/rdoc/parser/ruby_tools.rb
  106. +9 −21 lib/ruby/1.9/rdoc/parser/simple.rb
  107. +70 −117 lib/ruby/1.9/rdoc/rdoc.rb
  108. +2 −0 lib/ruby/1.9/rdoc/require.rb
  109. +2 −4 lib/ruby/1.9/rdoc/ri.rb
  110. +83 −331 lib/ruby/1.9/rdoc/ri/driver.rb
  111. +31 −90 lib/ruby/1.9/rdoc/ri/paths.rb
  112. +354 −2 lib/ruby/1.9/rdoc/ri/store.rb
  113. +46 −103 lib/ruby/1.9/rdoc/ruby_lex.rb
  114. +4 −47 lib/ruby/1.9/rdoc/ruby_token.rb
  115. +17 −44 lib/ruby/1.9/rdoc/rubygems_hook.rb
  116. +2 −0 lib/ruby/1.9/rdoc/single_class.rb
  117. +26 −32 lib/ruby/1.9/rdoc/stats.rb
  118. +12 −16 lib/ruby/1.9/rdoc/task.rb
  119. +31 −44 lib/ruby/1.9/rdoc/text.rb
  120. +0 −45 lib/ruby/1.9/rdoc/token_stream.rb
  121. +278 −86 lib/ruby/1.9/rdoc/top_level.rb
  122. +19 −8 lib/ruby/1.9/resolv.rb
  123. +7 −5 lib/ruby/1.9/rexml/document.rb
  124. +6 −0 lib/ruby/1.9/rexml/entity.rb
  125. +12 −0 lib/ruby/1.9/rexml/rexml.rb
  126. +2 −1 lib/ruby/1.9/rexml/text.rb
  127. +7 −3 lib/ruby/1.9/ripper/lexer.rb
  128. +49 −30 lib/ruby/1.9/socket.rb
  129. +5 −1 lib/ruby/1.9/time.rb
  130. +3 −2 lib/ruby/1.9/webrick/htmlutils.rb
  131. +12 −2 lib/ruby/1.9/webrick/httputils.rb
  132. +40 −12 lib/ruby/1.9/yaml.rb
  133. +7 −6 lib/ruby/2.0/bigdecimal/util.rb
  134. +3 −2 lib/ruby/2.0/cgi/core.rb
  135. +11 −9 lib/ruby/2.0/csv.rb
  136. +1 −1 lib/ruby/2.0/erb.rb
  137. +19 −12 lib/ruby/2.0/fileutils.rb
  138. +7 −7 lib/ruby/2.0/gserver.rb
  139. +24 −18 lib/ruby/2.0/net/ftp.rb
  140. +3 −1 lib/ruby/2.0/net/http/response.rb
  141. +29 −20 lib/ruby/2.0/net/imap.rb
  142. +3 −3 lib/ruby/2.0/net/pop.rb
  143. +6 −2 lib/ruby/2.0/net/protocol.rb
  144. +9 −8 lib/ruby/2.0/net/smtp.rb
  145. +5 −4 lib/ruby/2.0/open-uri.rb
  146. +16 −15 lib/ruby/2.0/openssl/buffering.rb
  147. +1 −1 lib/ruby/2.0/openssl/digest.rb
  148. +60 −10 lib/ruby/2.0/openssl/ssl.rb
  149. +37 −44 lib/ruby/2.0/racc/rdoc/grammar.en.rdoc
  150. +4 −18 lib/ruby/2.0/rdoc/generator/template/darkfish/js/jquery.js
  151. +1 −1 lib/ruby/2.0/rdoc/rd/block_parser.rb
  152. +22 −9 lib/ruby/2.0/resolv.rb
  153. +6 −0 lib/ruby/2.0/rexml/entity.rb
  154. +1 −1 lib/ruby/2.0/rinda/tuplespace.rb
  155. +51 −32 lib/ruby/2.0/socket.rb
  156. +3 −2 lib/ruby/2.0/ssl.rb
  157. +5 −0 lib/ruby/2.0/test/unit/parallel.rb
  158. +12 −0 lib/ruby/2.0/thread.rb
  159. +5 −1 lib/ruby/2.0/time.rb
  160. +3 −1 lib/ruby/2.0/uri/common.rb
  161. +16 −17 lib/ruby/2.0/uri/generic.rb
  162. +3 −2 lib/ruby/2.0/webrick/htmlutils.rb
  163. +1 −1 lib/ruby/2.0/webrick/httprequest.rb
  164. +12 −2 lib/ruby/2.0/webrick/httputils.rb
  165. +0 −4 lib/ruby/2.0/xmlrpc/client.rb
  166. +2 −2 lib/ruby/2.0/xmlrpc/server.rb
  167. +54 −21 lib/ruby/2.0/yaml.rb
1 change: 0 additions & 1 deletion lib/ruby/1.8/resolv.rb
Original file line number Diff line number Diff line change
@@ -855,7 +855,6 @@ def Config.default_config_hash(filename="/etc/resolv.conf")
if File.exist? filename
config_hash = Config.parse_resolv_conf(filename)
else
require 'rbconfig'
if WINDOWS
require 'win32/resolv'
search, nameserver = Win32::Resolv.get_resolv_info
6 changes: 6 additions & 0 deletions lib/ruby/1.8/rexml/entity.rb
Original file line number Diff line number Diff line change
@@ -138,8 +138,14 @@ def value
matches = @value.scan(PEREFERENCE_RE)
rv = @value.clone
if @parent
sum = 0
matches.each do |entity_reference|
entity_value = @parent.entity( entity_reference[0] )
if sum + entity_value.bytesize > Document.entity_expansion_text_limit
raise "entity expansion has grown too large"
else
sum += entity_value.bytesize
end
rv.gsub!( /%#{entity_reference};/um, entity_value )
end
end
11 changes: 11 additions & 0 deletions lib/ruby/1.9/cgi/core.rb
Original file line number Diff line number Diff line change
@@ -478,10 +478,12 @@ def read_multipart(boundary, content_length)
bufsize = 10 * 1024
max_count = MAX_MULTIPART_COUNT
n = 0
tempfiles = []
while true
(n += 1) < max_count or raise StandardError.new("too many parameters.")
## create body (StringIO or Tempfile)
body = create_body(bufsize < content_length)
tempfiles << body if defined?(Tempfile) && body.kind_of?(Tempfile)
class << body
if method_defined?(:path)
alias local_path path
@@ -562,6 +564,15 @@ class << params[name].last;self;end.class_eval do
raise EOFError, "bad boundary end of body part" unless boundary_end =~ /--/
params.default = []
params
rescue Exception
if tempfiles
tempfiles.each {|t|
if t.path
t.unlink
end
}
end
raise
end # read_multipart
private :read_multipart
def create_body(is_large) #:nodoc:
3 changes: 3 additions & 0 deletions lib/ruby/1.9/dl/func.rb
Original file line number Diff line number Diff line change
@@ -92,6 +92,9 @@ def call(*args, &block)
super
else
funcs = []
if $SAFE >= 1 && args.any? { |x| x.tainted? }
raise SecurityError, "tainted parameter not allowed"
end
_args = wrap_args(args, @stack.types, funcs, &block)
r = @cfunc.call(@stack.pack(_args))
funcs.each{|f| f.unbind_at_call()}
5 changes: 3 additions & 2 deletions lib/ruby/1.9/drb/ssl.rb
Original file line number Diff line number Diff line change
@@ -179,8 +179,9 @@ def accept
end
begin
ssl = @config.accept(soc)
ensure
soc.close if $!
rescue Exception
soc.close
raise
end
self.class.new(uri, ssl, @config, true)
rescue OpenSSL::SSL::SSLError
2 changes: 1 addition & 1 deletion lib/ruby/1.9/gserver.rb
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
#
# Author:: John W. Small
# Documentation:: Gavin Sinclair
# Licence:: Freeware.
# Licence:: Ruby License

require "socket"
require "thread"
11 changes: 8 additions & 3 deletions lib/ruby/1.9/ipaddr.rb
Original file line number Diff line number Diff line change
@@ -392,7 +392,7 @@ def set(addr, *family)
return self
end

# Set current netmask to given mask.
# Set current netmask to given mask.
def mask!(mask)
if mask.kind_of?(String)
if mask =~ /^\d+$/
@@ -534,7 +534,8 @@ def in6_addr(left)
left = $1
right = $3 + '0:0'
else
left.count(':') <= 7 or raise ArgumentError, "invalid address"
left.count(':') <= ($1.empty? || $2.empty? ? 8 : 7) or
raise InvalidAddressError, "invalid address"
left = $1
right = $2
addr = 0
@@ -626,7 +627,7 @@ def valid_v6?(addr)

# Returns a +String+ based representation of a valid DNS hostname,
# IPv4 or IPv6 address.
#
#
# IPSocket.getaddress 'localhost' #=> "::1"
# IPSocket.getaddress 'broadcasthost' #=> "255.255.255.255"
# IPSocket.getaddress 'www.ruby-lang.org' #=> "221.186.184.68"
@@ -656,6 +657,8 @@ def test_s_new
["0:0:0:1::"],
["2001:200:300::/48"],
["2001:200:300::192.168.1.2/48"],
["1:2:3:4:5:6:7::"],
["::2:3:4:5:6:7:8"],
].each { |args|
assert_nothing_raised {
IPAddr.new(*args)
@@ -712,6 +715,8 @@ def test_s_new
assert_equal("2001:200:300::", IPAddr.new("2001:200:300::/48").to_s)

assert_equal("2001:200:300::", IPAddr.new("[2001:200:300::]/48").to_s)
assert_equal("1:2:3:4:5:6:7:0", IPAddr.new("1:2:3:4:5:6:7::").to_s)
assert_equal("0:2:3:4:5:6:7:8", IPAddr.new("::2:3:4:5:6:7:8").to_s)

[
["192.168.0.256"],
11 changes: 6 additions & 5 deletions lib/ruby/1.9/net/http.rb
Original file line number Diff line number Diff line change
@@ -623,13 +623,13 @@ def set_debug_output(output)
# Number of seconds to wait for the connection to open. Any number
# may be used, including Floats for fractional seconds. If the HTTP
# object cannot open a connection in this many seconds, it raises a
# TimeoutError exception.
# TimeoutError exception. The default value is +nil+.
attr_accessor :open_timeout

# Number of seconds to wait for one block to be read (via one read(2)
# call). Any number may be used, including Floats for fractional
# seconds. If the HTTP object cannot read data in this many seconds,
# it raises a TimeoutError exception.
# it raises a TimeoutError exception. The default value is 60 seconds.
attr_reader :read_timeout

# Setter for the read_timeout attribute.
@@ -638,8 +638,9 @@ def read_timeout=(sec)
@read_timeout = sec
end

# Seconds to wait for 100 Continue response. If the HTTP object does not
# receive a response in this many seconds it sends the request body.
# Seconds to wait for 100 Continue response. If the HTTP object does not
# receive a response in this many seconds it sends the request body. The
# default value is +nil+.
attr_reader :continue_timeout

# Setter for the continue_timeout attribute.
@@ -1955,7 +1956,7 @@ def send_request_with_body_stream(sock, ver, path, f)
wait_for_continue sock, ver if sock.continue_timeout
if chunked?
while s = f.read(1024)
sock.write(sprintf("%x\r\n", s.length) << s << "\r\n")
sock.write(sprintf("%x\r\n", s.bytesize) << s << "\r\n")
end
sock.write "0\r\n\r\n"
else
7 changes: 4 additions & 3 deletions lib/ruby/1.9/net/imap.rb
Original file line number Diff line number Diff line change
@@ -1725,7 +1725,7 @@ def ensure_nz_number(num)
# rights:: The access rights the indicated user has to the
# mailbox.
#
MailboxACLItem = Struct.new(:user, :rights)
MailboxACLItem = Struct.new(:user, :rights, :mailbox)

# Net::IMAP::StatusData represents contents of the STATUS response.
#
@@ -2722,6 +2722,7 @@ def getacl_response
token = match(T_ATOM)
name = token.value.upcase
match(T_SPACE)
mailbox = astring
data = []
token = lookahead
if token.symbol == T_SPACE
@@ -2737,8 +2738,7 @@ def getacl_response
user = astring
match(T_SPACE)
rights = astring
##XXX data.push([user, rights])
data.push(MailboxACLItem.new(user, rights))
data.push(MailboxACLItem.new(user, rights, mailbox))
end
end
return UntaggedResponse.new(name, data, @str)
@@ -2869,6 +2869,7 @@ def capability_response
break
when T_SPACE
shift_token
next
end
data.push(atom.upcase)
end
4 changes: 2 additions & 2 deletions lib/ruby/1.9/net/pop.rb
Original file line number Diff line number Diff line change
@@ -498,12 +498,12 @@ def port

# Seconds to wait until a connection is opened.
# If the POP3 object cannot open a connection within this time,
# it raises a TimeoutError exception.
# it raises a TimeoutError exception. The default value is 30 seconds.
attr_accessor :open_timeout

# Seconds to wait until reading one block (by one read(1) call).
# If the POP3 object cannot complete a read() within this time,
# it raises a TimeoutError exception.
# it raises a TimeoutError exception. The default value is 60 seconds.
attr_reader :read_timeout

# Set the read timeout.
13 changes: 7 additions & 6 deletions lib/ruby/1.9/net/smtp.rb
Original file line number Diff line number Diff line change
@@ -78,8 +78,9 @@ class SMTPUnsupportedCommand < ProtocolError
#
# This library does NOT provide functions to compose internet mails.
# You must create them by yourself. If you want better mail support,
# try RubyMail or TMail. You can get both libraries from RAA.
# (http://www.ruby-lang.org/en/raa.html)
# try RubyMail or TMail or search for alternatives in
# {RubyGems.org}[https://rubygems.org/] or {The Ruby
# Toolbox}[https://www.ruby-toolbox.com/].
#
# FYI: the official documentation on internet mail is: [RFC2822] (http://www.ietf.org/rfc/rfc2822.txt).
#
@@ -364,12 +365,12 @@ def disable_starttls

# Seconds to wait while attempting to open a connection.
# If the connection cannot be opened within this time, a
# TimeoutError is raised.
# TimeoutError is raised. The default value is 30 seconds.
attr_accessor :open_timeout

# Seconds to wait while reading one block (by one read(2) call).
# If the read(2) call does not complete within this time, a
# TimeoutError is raised.
# TimeoutError is raised. The default value is 60 seconds.
attr_reader :read_timeout

# Set the number of seconds to wait until timing-out a read(2)
@@ -934,11 +935,11 @@ def recv_response
end

def critical(&block)
return '200 dummy reply code' if @error_occured
return Response.parse('200 dummy reply code') if @error_occurred
begin
return yield()
rescue Exception
@error_occured = true
@error_occurred = true
raise
end
end
7 changes: 4 additions & 3 deletions lib/ruby/1.9/open-uri.rb
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ def open(name, *rest, &block) # :doc:
# The environment variables such as http_proxy, https_proxy and ftp_proxy
# are in effect by default. :proxy => nil disables proxy.
#
# open("http://www.ruby-lang.org/en/raa.html", :proxy => nil) {|f|
# open("http://www.ruby-lang.org/en/", :proxy => nil) {|f|
# # ...
# }
#
@@ -508,8 +508,9 @@ def charset
end
end

# returns a list of encodings in Content-Encoding field
# as an Array of String.
# Returns a list of encodings in Content-Encoding field as an array of
# strings.
#
# The encodings are downcased for canonicalization.
def content_encoding
v = @meta['content-encoding']
43 changes: 34 additions & 9 deletions lib/ruby/1.9/optparse.rb
Original file line number Diff line number Diff line change
@@ -1631,23 +1631,30 @@ def environment(env = File.basename($0, '.*'))
decimal = '\d+(?:_\d+)*'
binary = 'b[01]+(?:_[01]+)*'
hex = 'x[\da-f]+(?:_[\da-f]+)*'
octal = "0(?:[0-7]*(?:_[0-7]+)*|#{binary}|#{hex})"
octal = "0(?:[0-7]+(?:_[0-7]+)*|#{binary}|#{hex})?"
integer = "#{octal}|#{decimal}"
accept(Integer, %r"\A[-+]?(?:#{integer})"io) {|s,| Integer(s) if s}

accept(Integer, %r"\A[-+]?(?:#{integer})\z"io) {|s,|
begin
Integer(s)
rescue ArgumentError
raise OptionParser::InvalidArgument, s
end if s
}

#
# Float number format, and converts to Float.
#
float = "(?:#{decimal}(?:\\.(?:#{decimal})?)?|\\.#{decimal})(?:E[-+]?#{decimal})?"
floatpat = %r"\A[-+]?#{float}"io
floatpat = %r"\A[-+]?#{float}\z"io
accept(Float, floatpat) {|s,| s.to_f if s}

#
# Generic numeric format, converts to Integer for integer format, Float
# for float format, and Rational for rational format.
#
real = "[-+]?(?:#{octal}|#{float})"
accept(Numeric, /\A(#{real})(?:\/(#{real}))?/io) {|s, d, n|
accept(Numeric, /\A(#{real})(?:\/(#{real}))?\z/io) {|s, d, n|
if n
Rational(d, n)
elsif s
@@ -1658,22 +1665,40 @@ def environment(env = File.basename($0, '.*'))
#
# Decimal integer format, to be converted to Integer.
#
DecimalInteger = /\A[-+]?#{decimal}/io
accept(DecimalInteger) {|s,| s.to_i if s}
DecimalInteger = /\A[-+]?#{decimal}\z/io
accept(DecimalInteger, DecimalInteger) {|s,|
begin
Integer(s)
rescue ArgumentError
raise OptionParser::InvalidArgument, s
end if s
}

#
# Ruby/C like octal/hexadecimal/binary integer format, to be converted to
# Integer.
#
OctalInteger = /\A[-+]?(?:[0-7]+(?:_[0-7]+)*|0(?:#{binary}|#{hex}))/io
accept(OctalInteger) {|s,| s.oct if s}
OctalInteger = /\A[-+]?(?:[0-7]+(?:_[0-7]+)*|0(?:#{binary}|#{hex}))\z/io
accept(OctalInteger, OctalInteger) {|s,|
begin
Integer(s, 8)
rescue ArgumentError
raise OptionParser::InvalidArgument, s
end if s
}

#
# Decimal integer/float number format, to be converted to Integer for
# integer format, Float for float format.
#
DecimalNumeric = floatpat # decimal integer is allowed as float also.
accept(DecimalNumeric) {|s,| eval(s) if s}
accept(DecimalNumeric, floatpat) {|s,|
begin
eval(s)
rescue SyntaxError
raise OptionParser::InvalidArgument, s
end if s
}

#
# Boolean switch, which means whether it is present or not, whether it is
4 changes: 0 additions & 4 deletions lib/ruby/1.9/rake.rb
Original file line number Diff line number Diff line change
@@ -40,12 +40,9 @@

require 'rake/win32'

require 'rake/linked_list'
require 'rake/scope'
require 'rake/task_argument_error'
require 'rake/rule_recursion_overflow_error'
require 'rake/rake_module'
require 'rake/trace_output'
require 'rake/pseudo_status'
require 'rake/task_arguments'
require 'rake/invocation_chain'
@@ -61,7 +58,6 @@
require 'rake/name_space'
require 'rake/task_manager'
require 'rake/application'
require 'rake/backtrace'

$trace = false

Loading