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 + + * 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 * 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