1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Merge rubygems master.

This is RC version of Rubygems 2.7.0.
  688fb7e83c

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2017-10-08 01:32:18 +00:00
parent 6b05153a3a
commit c00e84327f
96 changed files with 2021 additions and 701 deletions

View file

@ -109,26 +109,15 @@ module Gem::Util
##
# Enumerates the parents of +directory+.
def self.traverse_parents directory
def self.traverse_parents directory, &block
return enum_for __method__, directory unless block_given?
here = File.expand_path directory
start = here
Dir.chdir start
begin
loop do
yield here
Dir.chdir '..'
return if Dir.pwd == here # toplevel
here = Dir.pwd
end
ensure
Dir.chdir start
loop do
Dir.chdir here, &block
new_here = File.expand_path('..', here)
return if new_here == here # toplevel
here = new_here
end
end