summaryrefslogtreecommitdiff
path: root/misc/rubygems/patches/patch-ab
blob: 2fbe4eafc08c55826d9c1a87837fe086eeea8f3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$NetBSD: patch-ab,v 1.11 2010/09/10 03:48:40 taca Exp $

Add install_root option for pkgsrc's rubygems support.

--- lib/rubygems/dependency_installer.rb.orig	2009-03-04 17:07:04.000000000 -0800
+++ lib/rubygems/dependency_installer.rb
@@ -38,6 +38,7 @@ class Gem::DependencyInstaller
   # :format_executable:: See Gem::Installer#initialize.
   # :ignore_dependencies:: Don't install any dependencies.
   # :install_dir:: See Gem::Installer#install.
+  # :install_root: See Gem::Installer#install.
   # :prerelease:: Allow prerelease versions
   # :security_policy:: See Gem::Installer::new and Gem::Security.
   # :user_install:: See Gem::Installer.new
@@ -45,7 +46,11 @@ class Gem::DependencyInstaller
 
   def initialize(options = {})
     if options[:install_dir] then
-      spec_dir = options[:install_dir], 'specifications'
+      if options[:install_root].nil? or options[:install_root] == "" then
+        spec_dir = options[:install_dir], 'specifications'
+      else
+        spec_dir = options[:install_root], options[:install_dir], 'specifications'
+      end
       @source_index = Gem::SourceIndex.from_gems_in spec_dir
     else
       @source_index = Gem.source_index
@@ -68,7 +73,12 @@ class Gem::DependencyInstaller
     @installed_gems = []
 
     @install_dir = options[:install_dir] || Gem.dir
-    @cache_dir = options[:cache_dir] || @install_dir
+    @install_root = options[:install_root]
+    install_dir = @install_dir
+    unless @install_root.nil? or @install_root == ""
+      install_dir = File.join(@install_root, @install_dir)
+    end
+    @cache_dir = options[:cache_dir] || install_dir
   end
 
   ##
@@ -244,6 +254,7 @@ class Gem::DependencyInstaller
                                 :format_executable   => @format_executable,
                                 :ignore_dependencies => @ignore_dependencies,
                                 :install_dir         => @install_dir,
+                                :install_root        => @install_root,
                                 :security_policy     => @security_policy,
                                 :source_index        => @source_index,
                                 :user_install        => @user_install,