Skip to content
Permalink
Browse files
Merge branch 'master' into ffi-io
Fixed a conflict in io.rb with #write_nonblock and a
conflict in spec/ruby/core/io/read_nonblock_spec.rb.
  • Loading branch information
chuckremes committed Jan 22, 2016
2 parents 685a4a5 + 9da9d6a commit 910d9f89ce30a31a19f37001773163295b767abd
Showing with 848 additions and 209 deletions.
  1. +1 −1 Gemfile.installed
  2. +1 −1 Gemfile.lock
  3. +6 −0 configure
  4. +0 −8 dockerfiles/ubuntu/14.04/Dockerfile
  5. +0 −8 dockerfiles/ubuntu/15.10/Dockerfile
  6. +4 −3 gems_list.txt
  7. +22 −0 kernel/common/argf.rb
  8. +4 −4 kernel/common/array.rb
  9. +39 −28 kernel/common/enumerable.rb
  10. +20 −10 kernel/common/enumerator.rb
  11. +15 −0 kernel/common/file.rb
  12. +39 −4 kernel/common/hash.rb
  13. +21 −4 kernel/common/io.rb
  14. +2 −1 kernel/common/string.rb
  15. +7 −7 kernel/common/struct.rb
  16. +1 −0 kernel/platform/posix.rb
  17. +8 −3 scripts/deploy.sh
  18. +4 −0 scripts/tag.sh
  19. +3 −41 spec/ruby/core/argf/read_spec.rb
  20. +75 −0 spec/ruby/core/argf/readpartial_spec.rb
  21. +62 −0 spec/ruby/core/argf/shared/read.rb
  22. +6 −0 spec/ruby/core/array/dig_spec.rb
  23. +5 −19 spec/ruby/core/enumerable/chunk_spec.rb
  24. +36 −0 spec/ruby/core/enumerable/chunk_while_spec.rb
  25. +34 −0 spec/ruby/core/enumerable/grep_v_spec.rb
  26. +2 −26 spec/ruby/core/enumerable/slice_before_spec.rb
  27. +2 −2 spec/ruby/core/enumerator/lazy/drop_while_spec.rb
  28. +4 −0 spec/ruby/core/enumerator/lazy/fixtures/classes.rb
  29. +2 −2 spec/ruby/core/enumerator/lazy/grep_spec.rb
  30. +84 −0 spec/ruby/core/enumerator/lazy/grep_v_spec.rb
  31. +2 −2 spec/ruby/core/enumerator/lazy/initialize_spec.rb
  32. +2 −2 spec/ruby/core/enumerator/lazy/reject_spec.rb
  33. +2 −2 spec/ruby/core/enumerator/lazy/shared/collect_concat.rb
  34. +2 −2 spec/ruby/core/enumerator/lazy/shared/select.rb
  35. +1 −1 spec/ruby/core/enumerator/lazy/shared/to_enum.rb
  36. +2 −2 spec/ruby/core/enumerator/lazy/take_while_spec.rb
  37. +10 −0 spec/ruby/core/exception/receiver_spec.rb
  38. +2 −2 spec/ruby/core/exception/system_call_error_spec.rb
  39. +51 −0 spec/ruby/core/file/mkfifo_spec.rb
  40. +6 −0 spec/ruby/core/hash/dig_spec.rb
  41. +31 −0 spec/ruby/core/hash/fetch_values_spec.rb
  42. +13 −0 spec/ruby/core/hash/greater_than_or_equal_spec.rb
  43. +13 −0 spec/ruby/core/hash/greater_than_spec.rb
  44. +13 −0 spec/ruby/core/hash/less_than_or_equal_spec.rb
  45. +13 −0 spec/ruby/core/hash/less_than_spec.rb
  46. +15 −0 spec/ruby/core/hash/shared/comparison.rb
  47. +23 −0 spec/ruby/core/hash/shared/greater_than.rb
  48. +23 −0 spec/ruby/core/hash/shared/less_than.rb
  49. +49 −15 spec/ruby/core/io/read_nonblock_spec.rb
  50. +13 −3 spec/ruby/core/io/write_nonblock_spec.rb
  51. +6 −0 spec/ruby/core/string/new_spec.rb
  52. +4 −0 spec/ruby/core/struct/dig_spec.rb
  53. +14 −0 spec/ruby/language/fixtures/super.rb
  54. +14 −0 spec/ruby/language/super_spec.rb
  55. +4 −6 spec/ruby/optional/capi/numeric_spec.rb
  56. +1 −0 spec/tags/ruby/core/exception/receiver_tags.txt
  57. +1 −0 spec/tags/ruby/language/super_tags.txt
  58. +8 −0 vm/capi/bignum.cpp
  59. +1 −0 vm/ontology.cpp
@@ -8,7 +8,7 @@ gem "daedalus-core", "~> 0.1"
gem "rubinius-build_tools", "~> 2.0"
gem "rubinius-developer_tools", "~> 2.0"

gem "rubysl", "~> 2.0"
gem "rubysl", "~> 2.2"
gem "rubysl-test-unit", "~> 2.0"
gem "minitest", "~> 4.7"
gem "racc", "~> 1.4"
@@ -2,7 +2,7 @@ GEM
remote: https://rubygems.org/
specs:
daedalus-core (0.5.0)
rake (10.4.2)
rake (10.5.0)
redcard (1.1.0)
rubinius-ast (2.3.2)
rubinius-bridge (1.1.0)
@@ -78,6 +78,7 @@ class Configure
@dtrace_const = false
@have_lchmod = false
@have_lchown = false
@have_mkfifo = false
@debug_build = false
@include_dirs = []
@lib_dirs = []
@@ -1290,6 +1291,10 @@ int main() { return tgetnum(""); }
if has_function("lchown", ["sys/stat.h", "unistd.h"])
@have_lchown = true
end

if has_function("mkfifo", ["sys/stat.h", "sys/types.h"])
@have_mkfifo = true
end
end

def detect_structures
@@ -1656,6 +1661,7 @@ int main() { return tgetnum(""); }
#define RBX_LIBC "#{@libc}"
#define RBX_HAVE_LCHMOD #{@have_lchmod}
#define RBX_HAVE_LCHOWN #{@have_lchown}
#define RBX_HAVE_MKFIFO #{@have_mkfifo}
#define RBX_DEBUG_BUILD #{@debug_build.inspect}
EOC

This file was deleted.

This file was deleted.

@@ -5,7 +5,7 @@ json-1.8.3.gem
minitest-4.7.5.gem
psych-2.0.17.gem
racc-1.4.14.gem
rake-10.4.2.gem
rake-10.5.0.gem
rb-readline-0.5.3.gem
rdoc-4.2.1.gem
redcard-1.1.0.gem
@@ -20,7 +20,7 @@ rubinius-melbourne-2.3.1.0.gem
rubinius-processor-2.3.0.gem
rubinius-profiler-2.0.2.gem
rubinius-toolset-2.3.1.gem
rubysl-2.1.0.gem
rubysl-2.2.0.gem
rubysl-abbrev-2.0.4.gem
rubysl-base64-2.0.0.gem
rubysl-benchmark-2.0.1.gem
@@ -70,9 +70,9 @@ rubysl-net-smtp-2.0.1.gem
rubysl-net-telnet-2.0.0.gem
rubysl-nkf-2.0.1.gem
rubysl-observer-2.0.0.gem
rubysl-open-uri-2.0.0.gem
rubysl-open3-2.0.0.gem
rubysl-openssl-2.8.0.gem
rubysl-open-uri-2.0.0.gem
rubysl-optparse-2.0.1.gem
rubysl-ostruct-2.1.0.gem
rubysl-pathname-2.1.0.gem
@@ -107,6 +107,7 @@ rubysl-timeout-2.0.0.gem
rubysl-tmpdir-2.0.1.gem
rubysl-tsort-2.0.1.gem
rubysl-un-2.0.0.gem
rubysl-unicode_normalize-2.0.gem
rubysl-uri-2.0.0.gem
rubysl-weakref-2.0.0.gem
rubysl-webrick-2.0.0.gem
@@ -330,6 +330,7 @@ def readbyte
def read(bytes=nil, output=nil)
# The user might try to pass in nil, so we have to check here
output ||= default_value
output.clear

if bytes
bytes_left = bytes
@@ -401,6 +402,27 @@ def readlines(sep=$/)

alias_method :to_a, :readlines

def readpartial(maxlen, output=nil)
output ||= default_value

unless advance!
output.clear
raise EOFError, "ARGF at end"
end

begin
@stream.readpartial(maxlen, output)
rescue EOFError => e
raise e if @use_stdin_only

@stream.close
@advance = true
advance! or raise e
end

return output
end

#
# Rewind the stream to its beginning.
#
@@ -597,13 +597,13 @@ def delete_if
self
end

def dig(*sequence)
item = self[sequence.shift]
return item if sequence.empty? || item.nil?
def dig(index, *remaining_indeces)
item = self[index]
return item if remaining_indeces.empty? || item.nil?

raise TypeError, "#{item.class} does not have #dig method" unless item.respond_to?(:dig)

item.dig(*sequence)
item.dig(*remaining_indeces)
end

def each_index
@@ -4,19 +4,13 @@
# these methods can be written *in those classes* to override these.

module Enumerable
def chunk(initial_state = nil, &original_block)
def chunk
raise ArgumentError, "no block given" unless block_given?
::Enumerator.new do |yielder|
previous = nil
accumulate = []
block = if initial_state.nil?
original_block
else
duplicated_initial_state = initial_state.dup
Proc.new{ |val| original_block.yield(val, duplicated_initial_state)}
end
each do |element|
key = block.yield(element)
key = yield(element)
if key.nil? || (key.is_a?(Symbol) && key.to_s[0, 1] == "_")
yielder.yield [previous, accumulate] unless accumulate.empty?
accumulate = []
@@ -136,18 +130,18 @@ def group_by
h
end

def slice_before(arg = undefined, &block)
if block_given?
has_init = !(undefined.equal? arg)
else
raise ArgumentError, "wrong number of arguments (0 for 1)" if undefined.equal? arg
block = Proc.new{ |elem| arg === elem }
end
def slice_before(pattern = undefined, &block)
pattern_given = !(undefined.equal? pattern)

raise ArgumentError, "cannot pass both pattern and block" if pattern_given && block_given?
raise ArgumentError, "a pattern or a block must be provided" if !pattern_given && !block_given?

block = Proc.new{ |elem| pattern === elem } if pattern_given

Enumerator.new do |yielder|
init = arg.dup if has_init
accumulator = nil
each do |element|
start_new = has_init ? block.yield(element, init) : block.yield(element)
start_new = block.yield(element)
if start_new
yielder.yield accumulator if accumulator
accumulator = [element]
@@ -164,7 +158,7 @@ def slice_after(pattern = undefined, &block)
pattern_given = !undefined.equal?(pattern)

raise ArgumentError, "cannot pass both pattern and block" if pattern_given && block_given?
raise ArgumentError, "wrong number of arguments (0 for 1)" if !pattern_given && !block_given?
raise ArgumentError, "a pattern or a block must be provided" if !pattern_given && !block_given?

block = Proc.new { |elem| pattern === elem } if pattern_given

@@ -212,6 +206,12 @@ def slice_when(&block)
end
end

def chunk_while(&block)
raise ArgumentError, "no block given" unless block_given?

slice_when { |before, after| !(yield before, after) }
end

def to_a(*arg)
ary = []
each(*arg) do
@@ -293,19 +293,30 @@ def each_with_index(*args)
def grep(pattern)
ary = []

if block_given?
each do
element = Rubinius.single_block_arg
if pattern === element
Regexp.set_block_last_match
each do
element = Rubinius.single_block_arg
if pattern === element
Regexp.set_block_last_match
if block_given?
ary << yield(element)
else
ary << element
end
end
else
each do
element = Rubinius.single_block_arg
if pattern === element
Regexp.set_block_last_match
end

ary
end

def grep_v(pattern)
ary = []

each do
element = Rubinius.single_block_arg
unless pattern === element
if block_given?
ary << yield(element)
else
ary << element
end
end
@@ -347,19 +347,29 @@ def reject
end

def grep(pattern)
if block_given?
Lazy.new(self, nil) do |yielder, *args|
val = args.length >= 2 ? args : args.first
if pattern === val
Regexp.set_block_last_match
Lazy.new(self, nil) do |yielder, *args|
val = args.length >= 2 ? args : args.first

if pattern === val
Regexp.set_block_last_match

if block_given?
yielder.yield yield(val)
else
yielder.yield val
end
end
else
Lazy.new(self, nil) do |yielder, *args|
val = args.length >= 2 ? args : args.first
if pattern === val
Regexp.set_block_last_match
end
end

def grep_v(pattern)
Lazy.new(self, nil) do |yielder, *args|
val = args.length >= 2 ? args : args.first

unless pattern === val
if block_given?
yielder.yield yield(val)
else
yielder.yield val
end
end
@@ -1195,6 +1195,21 @@ def self.sticky?(file_name)
return false
end

def self.mkfifo(file_name, mode = 0666)
raise NotImplementedError, "mkfifo is not implemented on this platform" unless Rubinius::HAVE_MKFIFO

file_name = file_name.to_path if file_name.respond_to?(:to_path)
file_name = StringValue(file_name)

ret = POSIX.mkfifo(file_name, mode)

if ret == 0
ret
else
Errno.handle(file_name)
end
end

class << self
alias_method :delete, :unlink
alias_method :exists?, :exist?
@@ -252,6 +252,37 @@ def ==(other)
true
end

def <(other)
other = Rubinius::Type.coerce_to(other, Hash, :to_hash)
other > self
end

def <=(other)
other = Rubinius::Type.coerce_to(other, Hash, :to_hash)
other >= self
end

def >(other)
other = Rubinius::Type.coerce_to(other, Hash, :to_hash)

return false if size <= other.size

self >= other
end

def >=(other)
other = Rubinius::Type.coerce_to(other, Hash, :to_hash)

return false if size < other.size

other.each do |other_key, other_val|
val = fetch(other_key, undefined)
return false if undefined.equal?(val) || val != other_val
end

true
end

def assoc(key)
each_item { |e| return e.key, e.value if key == e.key }
end
@@ -322,13 +353,13 @@ def delete(key)
return yield(key) if block_given?
end

def dig(*sequence)
item = self[sequence.shift]
return item if sequence.empty? || item.nil?
def dig(key, *remaining_keys)
item = self[key]
return item if remaining_keys.empty? || item.nil?

raise TypeError, "#{item.class} does not have #dig method" unless item.respond_to?(:dig)

item.dig(*sequence)
item.dig(*remaining_keys)
end

def each_item
@@ -367,6 +398,10 @@ def fetch(key, default=undefined)
raise KeyError, "key #{key} not found"
end

def fetch_values(*keys, &block)
keys.map { |key| fetch(key, &block) }
end

# Searches for an item matching +key+. Returns the item
# if found. Otherwise returns +nil+.
def find_item(key)
Loading

0 comments on commit 910d9f8

Please sign in to comment.