summaryrefslogtreecommitdiff
path: root/misc/rubygems/patches/patch-ah
blob: 6607f62facdc8dfdb1c818873868a9c25e563d36 (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
$NetBSD: patch-ah,v 1.4 2008/09/15 08:43:44 taca Exp $

--- lib/rubygems.rb.orig	2008-06-21 04:54:57.000000000 +0900
+++ lib/rubygems.rb
@@ -230,7 +230,13 @@ module Gem
   ##
   # The path where gem executables are to be installed.
 
-  def self.bindir(install_dir=Gem.dir)
+  def self.bindir(install_dir=Gem.dir, install_root=nil)
+    unless install_root.nil?
+      install_root_path = Pathname.new install_root
+      install_dir_path = Pathname.new install_dir
+      install_dir_path = install_dir_path.relative_path_from install_root_path
+      install_dir = install_dir_path.expand_path File::SEPARATOR
+    end
     return File.join(install_dir, 'bin') unless
       install_dir.to_s == Gem.default_dir
     Gem.default_bindir
@@ -435,12 +441,12 @@ module Gem
   ##
   # The index to insert activated gem paths into the $LOAD_PATH.
   #
-  # Defaults to the site lib directory unless gem_prelude.rb has loaded paths,
+  # Defaults to the vendor lib directory unless gem_prelude.rb has loaded paths,
   # then it inserts the activated gem's paths before the gem_prelude.rb paths
   # so you can override the gem_prelude.rb default $LOAD_PATH paths.
 
   def self.load_path_insert_index
-    index = $LOAD_PATH.index ConfigMap[:sitelibdir]
+    index = $LOAD_PATH.index ConfigMap[:vendorlibdir]
 
     $LOAD_PATH.each_with_index do |path, i|
       if path.instance_variables.include?(:@gem_prelude_index) or
@@ -529,7 +535,8 @@ module Gem
   def self.prefix
     prefix = File.dirname File.expand_path(__FILE__)
 
-    if File.dirname(prefix) == File.expand_path(ConfigMap[:sitelibdir]) or
+    if File.dirname(prefix) == File.expand_path(ConfigMap[:vendorlibdir]) or
+       File.dirname(prefix) == File.expand_path(ConfigMap[:sitelibdir]) or
        File.dirname(prefix) == File.expand_path(ConfigMap[:libdir]) or
        'lib' != File.basename(prefix) then
       nil