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