summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--NEWS2
-rw-r--r--lib/rubygems.rb6
-rw-r--r--lib/rubygems/commands/uninstall_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb29
5 files changed, 45 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index d97d347b86..9821746504 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Aug 24 07:57:43 2011 Eric Hodel <drbrain@segment7.net>
+
+ * backport r33040 from trunk.
+
+ * lib/rubygems: Update to RubyGems 1.8.9. Fixes uninstalling multiple
+ gems and gem cleanup.
+
Wed Aug 24 06:45:20 2011 Ryan Davis <ryand-ruby@zenspider.com>
* backport r33036 from trunk.
diff --git a/NEWS b/NEWS
index 3cab61b14b..e79d75356e 100644
--- a/NEWS
+++ b/NEWS
@@ -265,7 +265,7 @@ with all sufficient information, see the ChangeLog file.
* Support Ruby native encoding mechanism and iconv dependency is dropped.
* RubyGems
- * RubyGems has been upgraded to version 1.8.6.1. For full release notes see
+ * RubyGems has been upgraded to version 1.8.9. For full release notes see
http://rubygems.rubyforge.org/rubygems-update/History_txt.html
* stringio
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 8a7bfea551..f469deb9a8 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -118,7 +118,7 @@ require "rubygems/deprecate"
# -The RubyGems Team
module Gem
- VERSION = '1.8.8'
+ VERSION = '1.8.9'
##
# Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -1027,7 +1027,9 @@ module Gem
# Use the +home+ and +paths+ values for Gem.dir and Gem.path. Used mainly
# by the unit tests to provide environment isolation.
- def self.use_paths(home, paths=[])
+ def self.use_paths(home, *paths)
+ paths = nil if paths == [nil]
+ paths = paths.first if Array === Array(paths).first
self.paths = { "GEM_HOME" => home, "GEM_PATH" => paths }
# TODO: self.paths = home, paths
end
diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb
index 61e55f196e..67a3d38bba 100644
--- a/lib/rubygems/commands/uninstall_command.rb
+++ b/lib/rubygems/commands/uninstall_command.rb
@@ -73,6 +73,8 @@ class Gem::Commands::UninstallCommand < Gem::Command
end
def execute
+ original_path = Gem.path
+
get_all_gem_names.each do |gem_name|
begin
Gem::Uninstaller.new(gem_name, options).uninstall
@@ -80,6 +82,8 @@ class Gem::Commands::UninstallCommand < Gem::Command
spec = e.spec
alert("In order to remove #{spec.name}, please execute:\n" \
"\tgem uninstall #{spec.name} --install-dir=#{spec.installation_path}")
+ ensure
+ Gem.use_paths(*original_path)
end
end
end
diff --git a/test/rubygems/test_gem_commands_uninstall_command.rb b/test/rubygems/test_gem_commands_uninstall_command.rb
index 132c370f11..d76178e86d 100644
--- a/test/rubygems/test_gem_commands_uninstall_command.rb
+++ b/test/rubygems/test_gem_commands_uninstall_command.rb
@@ -17,6 +17,34 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
@executable = File.join(@gemhome, 'bin', 'executable')
end
+ def test_execute_mulitple
+ @other = quick_gem 'c'
+ util_make_exec @other
+ util_build_gem @other
+
+ @other_installer = util_installer @other, @gemhome
+
+ ui = Gem::MockGemUi.new
+ util_setup_gem ui
+
+ build_rake_in do
+ use_ui ui do
+ @other_installer.install
+ end
+ end
+
+ @cmd.options[:args] = [@spec.name, @other.name]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ output = @ui.output.split "\n"
+
+ assert_includes output, "Successfully uninstalled #{@spec.full_name}"
+ assert_includes output, "Successfully uninstalled #{@other.full_name}"
+ end
+
def test_execute_removes_executable
ui = Gem::MockGemUi.new
util_setup_gem ui
@@ -91,5 +119,6 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
output = @ui.output
assert_match(/Successfully uninstalled/, output)
end
+
end