aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/commands
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands')
-rw-r--r--lib/rubygems/commands/cleanup_command.rb11
-rw-r--r--lib/rubygems/commands/setup_command.rb2
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index 49bf660bc1..124c4c203a 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -61,6 +61,8 @@ installed elsewhere in GEM_PATH the cleanup command won't touch it.
deps = deplist.strongly_connected_components.flatten.reverse
+ original_path = Gem.path
+
deps.each do |spec|
if options[:dryrun] then
say "Dry Run Mode: Would uninstall #{spec.full_name}"
@@ -74,20 +76,21 @@ installed elsewhere in GEM_PATH the cleanup command won't touch it.
:version => "= #{spec.version}",
}
- if Gem.user_dir == spec.base_dir then
- uninstall_options[:install_dir] = spec.base_dir
- end
+ uninstall_options[:user_install] = Gem.user_dir == spec.base_dir
uninstaller = Gem::Uninstaller.new spec.name, uninstall_options
begin
uninstaller.uninstall
rescue Gem::DependencyRemovalException, Gem::InstallError,
- Gem::GemNotInHomeException => e
+ Gem::GemNotInHomeException, Gem::FilePermissionError => e
say "Unable to uninstall #{spec.full_name}:"
say "\t#{e.class}: #{e.message}"
end
end
+
+ # Restore path Gem::Uninstaller may have change
+ Gem.use_paths(*original_path)
end
say "Clean Up Complete"
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 97880bc45c..52a3b88fe3 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -124,7 +124,7 @@ By default, this RubyGems will install gem as:
open release_notes do |io|
text = io.gets '==='
text << io.gets('===')
- text[0...-3]
+ text[0...-3].sub(/^# coding:.*?^=/m, '')
end
else
"Oh-no! Unable to find release notes!"