summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-01 09:52:39 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-01 09:52:39 +0000
commit4090ec1017d3b41a6589858f2f2be484a1d6d041 (patch)
tree03580876c8fab59c1eacab84bfee1fdec77cabb7
parent018d8261ce66724c16a9b91c70d71ce60ca6c6cf (diff)
* lib/rubygems/commands/cleanup_command.rb: Fix cleanup command for
multiple gems. [ruby-trunk - #7481] by Kouhei Sutou * test/rubygems/test_gem_commands_cleanup_command.rb: Test for above. * lib/rubygems.rb: Autoload Gem::Source to prevent test failures git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--lib/rubygems.rb23
-rw-r--r--lib/rubygems/commands/cleanup_command.rb3
-rw-r--r--test/rubygems/test_gem_commands_cleanup_command.rb9
4 files changed, 30 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index e1443b5502..cd3505f090 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Dec 1 18:52:22 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/cleanup_command.rb: Fix cleanup command for
+ multiple gems. [ruby-trunk - #7481] by Kouhei Sutou
+ * test/rubygems/test_gem_commands_cleanup_command.rb: Test for above.
+ * lib/rubygems.rb: Autoload Gem::Source to prevent test failures
+
Sat Dec 1 18:17:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* complex.c (Init_Complex), time.c (Init_Time): make marshal methods
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 914204858c..a7bc959965 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1042,18 +1042,19 @@ module Gem
MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/"
- autoload :Version, 'rubygems/version'
- autoload :Requirement, 'rubygems/requirement'
- autoload :Dependency, 'rubygems/dependency'
- autoload :DependencyList, 'rubygems/dependency_list'
- autoload :SourceList, 'rubygems/source_list'
- autoload :SpecFetcher, 'rubygems/spec_fetcher'
- autoload :Specification, 'rubygems/specification'
- autoload :PathSupport, 'rubygems/path_support'
- autoload :Platform, 'rubygems/platform'
- autoload :ConfigFile, 'rubygems/config_file'
+ autoload :ConfigFile, 'rubygems/config_file'
+ autoload :Dependency, 'rubygems/dependency'
+ autoload :DependencyList, 'rubygems/dependency_list'
autoload :DependencyResolver, 'rubygems/dependency_resolver'
- autoload :RequestSet, 'rubygems/request_set'
+ autoload :PathSupport, 'rubygems/path_support'
+ autoload :Platform, 'rubygems/platform'
+ autoload :RequestSet, 'rubygems/request_set'
+ autoload :Requirement, 'rubygems/requirement'
+ autoload :SourceList, 'rubygems/source_list'
+ autoload :SpecFetcher, 'rubygems/spec_fetcher'
+ autoload :Specification, 'rubygems/specification'
+ autoload :Version, 'rubygems/version'
+ autoload :Source, 'rubygems/source'
require "rubygems/specification"
end
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index dc919e5570..f18a94d7a2 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -66,6 +66,7 @@ are not removed.
deps = deplist.strongly_connected_components.flatten.reverse
+ original_home = Gem.dir
original_path = Gem.path
deps.each do |spec|
@@ -97,7 +98,7 @@ are not removed.
end
# Restore path Gem::Uninstaller may have change
- Gem.use_paths(*original_path)
+ Gem.use_paths(original_home, *original_path)
end
say "Clean Up Complete"
diff --git a/test/rubygems/test_gem_commands_cleanup_command.rb b/test/rubygems/test_gem_commands_cleanup_command.rb
index 2357999253..0cf2bd6291 100644
--- a/test/rubygems/test_gem_commands_cleanup_command.rb
+++ b/test/rubygems/test_gem_commands_cleanup_command.rb
@@ -24,6 +24,12 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
end
def test_execute_all
+ gemhome2 = File.join @tempdir, 'gemhome2'
+
+ Gem.ensure_gem_subdirectories gemhome2
+
+ Gem.use_paths @gemhome, gemhome2
+
@b_1 = quick_spec 'b', 1
@b_2 = quick_spec 'b', 2
@@ -34,6 +40,9 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd.execute
+ assert_equal @gemhome, Gem.dir, 'GEM_HOME'
+ assert_equal [@gemhome, gemhome2], Gem.path.sort, 'GEM_PATH'
+
refute_path_exists @a_1.gem_dir
refute_path_exists @b_1.gem_dir
end