aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/doctor.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-19 00:34:13 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-19 00:34:13 +0000
commita7fa4d5d9aab150ad4b0c3f3217fe444df69f527 (patch)
tree88ab96d22f7228b556337aa7c34042d4fd279394 /lib/rubygems/doctor.rb
parente7ec3dad907f2c77f17faddb40a98b2ef4523222 (diff)
downloadruby-a7fa4d5d9aab150ad4b0c3f3217fe444df69f527.tar.gz
* lib/rubygems: Update to RubyGems master 6a3d9f9. Changes include:
Compatibly renamed Gem::DependencyResolver to Gem::Resolver. Added support for git gems in gem.deps.rb and Gemfile. Fixed resolver bugs. * test/rubygems: ditto. * lib/rubygems/LICENSE.txt: Updated to license from RubyGems trunk. [ruby-trunk - Bug #9086] * lib/rubygems/commands/which_command.rb: RubyGems now indicates failure when any file is missing. [ruby-trunk - Bug #9004] * lib/rubygems/ext/builder: Extensions are now installed into the extension install directory and the first directory in the require path from the gem. This allows backwards compatibility with msgpack and other gems that calculate full require paths. [ruby-trunk - Bug #9106] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/doctor.rb')
-rw-r--r--lib/rubygems/doctor.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/rubygems/doctor.rb b/lib/rubygems/doctor.rb
index 0de337f7de..2cb8901b4d 100644
--- a/lib/rubygems/doctor.rb
+++ b/lib/rubygems/doctor.rb
@@ -1,6 +1,5 @@
require 'rubygems'
require 'rubygems/user_interaction'
-require 'pathname'
##
# Cleans up after a partially-failed uninstall or for an invalid
@@ -39,7 +38,7 @@ class Gem::Doctor
# If +dry_run+ is true no files or directories will be removed.
def initialize gem_repository, dry_run = false
- @gem_repository = Pathname(gem_repository)
+ @gem_repository = gem_repository
@dry_run = dry_run
@installed_specs = nil
@@ -97,26 +96,29 @@ class Gem::Doctor
# Removes files in +sub_directory+ with +extension+
def doctor_child sub_directory, extension # :nodoc:
- directory = @gem_repository + sub_directory
+ directory = File.join(@gem_repository, sub_directory)
- directory.children.sort.each do |child|
- next unless child.exist?
+ Dir.entries(directory).sort.each do |ent|
+ next if ent == "." || ent == ".."
- basename = child.basename(extension).to_s
+ child = File.join(directory, ent)
+ next unless File.exists?(child)
+
+ basename = File.basename(child, extension)
next if installed_specs.include? basename
next if /^rubygems-\d/ =~ basename
next if 'specifications' == sub_directory and 'default' == basename
- type = child.directory? ? 'directory' : 'file'
+ type = File.directory?(child) ? 'directory' : 'file'
action = if @dry_run then
'Extra'
else
- child.rmtree
+ FileUtils.rm_r(child)
'Removed'
end
- say "#{action} #{type} #{sub_directory}/#{child.basename}"
+ say "#{action} #{type} #{sub_directory}/#{File.basename(child)}"
end
rescue Errno::ENOENT
# ignore