5257f0
From b95b9942361104dc5b7fd08eb4970f893d8c1a54 Mon Sep 17 00:00:00 2001
5257f0
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
5257f0
Date: Wed, 13 Feb 2013 13:12:30 +0100
5257f0
Subject: [PATCH 1/3] Remove duplicated check.
5257f0
5257f0
The loaded specifications are rejected already in #gather_dependencies,
5257f0
so this condition cannot trigger.
5257f0
---
5257f0
 lib/rubygems/dependency_installer.rb | 3 ---
5257f0
 1 file changed, 3 deletions(-)
5257f0
5257f0
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
5257f0
index d811f62..dffa8df 100644
5257f0
--- a/lib/rubygems/dependency_installer.rb
5257f0
+++ b/lib/rubygems/dependency_installer.rb
5257f0
@@ -330,9 +330,6 @@ class Gem::DependencyInstaller
5257f0
 
5257f0
     last = @gems_to_install.size - 1
5257f0
     @gems_to_install.each_with_index do |spec, index|
5257f0
-      # REFACTOR more current spec set hardcoding, should be abstracted?
5257f0
-      next if Gem::Specification.include?(spec) and index != last
5257f0
-
5257f0
       # TODO: make this sorta_verbose so other users can benefit from it
5257f0
       say "Installing gem #{spec.full_name}" if Gem.configuration.really_verbose
5257f0
 
5257f0
-- 
5257f0
1.8.1.2
5257f0
5257f0
5257f0
From 2fa9087b1986db6c7945c0f997fed2bfff5ce06a Mon Sep 17 00:00:00 2001
5257f0
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
5257f0
Date: Wed, 13 Feb 2013 15:47:47 +0100
5257f0
Subject: [PATCH 2/3] Do not modify global Specification.dirs during
5257f0
 installation.
5257f0
5257f0
While gems are installed into --install-dir just fine even without
5257f0
modifications of Specification.dirs, change in it makes inaccessible
5257f0
gems already present on the system.
5257f0
---
5257f0
 lib/rubygems/dependency_installer.rb | 15 ++++++---------
5257f0
 1 file changed, 6 insertions(+), 9 deletions(-)
5257f0
5257f0
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
5257f0
index dffa8df..841f26a 100644
5257f0
--- a/lib/rubygems/dependency_installer.rb
5257f0
+++ b/lib/rubygems/dependency_installer.rb
088549
@@ -57,16 +57,14 @@ class Gem::DependencyInstaller
5257f0
   # :build_args:: See Gem::Installer::new
5257f0
 
5257f0
   def initialize(options = {})
5257f0
-    @install_dir = options[:install_dir] || Gem.dir
5257f0
 
5257f0
     if options[:install_dir] then
5257f0
-      # HACK shouldn't change the global settings, needed for -i behavior
5257f0
-      # maybe move to the install command?  See also github #442
5257f0
-      Gem::Specification.dirs = @install_dir
5257f0
+      Gem.ensure_gem_subdirectories options[:install_dir]
5257f0
     end
5257f0
 
5257f0
     options = DEFAULT_OPTIONS.merge options
5257f0
 
5257f0
+    @install_dir         = options[:install_dir]
5257f0
     @bin_dir             = options[:bin_dir]
5257f0
     @dev_shallow         = options[:dev_shallow]
5257f0
     @development         = options[:development]
5257f0
@@ -92,7 +89,7 @@ class Gem::DependencyInstaller
5257f0
     @installed_gems = []
5257f0
     @toplevel_specs = nil
5257f0
 
5257f0
-    @cache_dir = options[:cache_dir] || @install_dir
5257f0
+    @cache_dir = options[:cache_dir] || @install_dir || Gem.dir
5257f0
 
5257f0
     # Set with any errors that SpecFetcher finds while search through
5257f0
     # gemspecs for a dep
5257f0
@@ -202,7 +199,7 @@ class Gem::DependencyInstaller
5257f0
     # that this isn't dependent only on the currently installed gems
5257f0
     dependency_list.specs.reject! { |spec|
5257f0
       not keep_names.include?(spec.full_name) and
5257f0
-      Gem::Specification.include?(spec)
5257f0
+      (!@install_dir && Gem::Specification.include?(spec))
5257f0
     }
5257f0
 
5257f0
     unless dependency_list.ok? or @ignore_dependencies or @force then
5257f0
@@ -254,7 +251,7 @@ class Gem::DependencyInstaller
5257f0
           to_do.push t.spec
5257f0
         end
5257f0
 
5257f0
-        results.remove_installed! dep
5257f0
+        results.remove_installed! dep unless @install_dir
5257f0
 
5257f0
         @available << results
5257f0
         results.inject_into_list dependency_list
5257f0
@@ -360,7 +357,7 @@ class Gem::DependencyInstaller
5257f0
                                 :force               => @force,
5257f0
                                 :format_executable   => @format_executable,
5257f0
                                 :ignore_dependencies => @ignore_dependencies,
5257f0
-                                :install_dir         => @install_dir,
5257f0
+                                :install_dir         => (@install_dir || Gem.dir),
5257f0
                                 :security_policy     => @security_policy,
5257f0
                                 :user_install        => @user_install,
5257f0
                                 :wrappers            => @wrappers,
5257f0
-- 
5257f0
1.8.1.2
5257f0
5257f0
5257f0
From d473204ce920702dd87257db49355929f31530d4 Mon Sep 17 00:00:00 2001
5257f0
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
5257f0
Date: Fri, 15 Feb 2013 17:02:44 +0100
5257f0
Subject: [PATCH 3/3] Default to Gem.dir as late as possible.
5257f0
5257f0
---
5257f0
 lib/rubygems/dependency_installer.rb | 2 +-
5257f0
 lib/rubygems/installer.rb            | 4 ++--
5257f0
 2 files changed, 3 insertions(+), 3 deletions(-)
5257f0
5257f0
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
5257f0
index 841f26a..abcfa0f 100644
5257f0
--- a/lib/rubygems/dependency_installer.rb
5257f0
+++ b/lib/rubygems/dependency_installer.rb
5257f0
@@ -357,7 +357,7 @@ class Gem::DependencyInstaller
5257f0
                                 :force               => @force,
5257f0
                                 :format_executable   => @format_executable,
5257f0
                                 :ignore_dependencies => @ignore_dependencies,
5257f0
-                                :install_dir         => (@install_dir || Gem.dir),
5257f0
+                                :install_dir         => @install_dir,
5257f0
                                 :security_policy     => @security_policy,
5257f0
                                 :user_install        => @user_install,
5257f0
                                 :wrappers            => @wrappers,
5257f0
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
5257f0
index 780a88b..6543130 100644
5257f0
--- a/lib/rubygems/installer.rb
5257f0
+++ b/lib/rubygems/installer.rb
5257f0
@@ -537,13 +537,13 @@ class Gem::Installer
5257f0
       :bin_dir      => nil,
5257f0
       :env_shebang  => false,
5257f0
       :force        => false,
5257f0
-      :install_dir  => Gem.dir,
5257f0
       :only_install_dir => false
5257f0
     }.merge options
5257f0
 
5257f0
     @env_shebang         = options[:env_shebang]
5257f0
     @force               = options[:force]
5257f0
-    @gem_home            = options[:install_dir]
5257f0
+    @install_dir         = options[:install_dir]
5257f0
+    @gem_home            = options[:install_dir] || Gem.dir
5257f0
     @ignore_dependencies = options[:ignore_dependencies]
5257f0
     @format_executable   = options[:format_executable]
5257f0
     @security_policy     = options[:security_policy]
5257f0
-- 
5257f0
1.8.1.2
5257f0