File tree Expand file tree Collapse file tree 1 file changed +19
-11
lines changed
src/main/ruby/truffleruby/core/truffle Expand file tree Collapse file tree 1 file changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,6 @@ module Truffle::GemUtil
59
59
'zlib' => true
60
60
}
61
61
62
-
63
62
MARKER_NAME = 'truffleruby_gem_dir_marker.txt'
64
63
65
64
def self . upgraded_default_gem? ( feature )
@@ -115,19 +114,28 @@ def self.bad_gem_dirs(dirs)
115
114
116
115
# Gem.path, without needing to load RubyGems
117
116
def self . gem_paths
118
- @gem_paths ||= begin
119
- if gem_path = ENV [ 'GEM_PATH' ]
120
- paths = gem_path . split ( File ::PATH_SEPARATOR )
117
+ @gem_paths ||= compute_gem_path
118
+ end
119
+
120
+ def self . compute_gem_path
121
+ user_dir = "#{ Dir . home } /.gem/truffleruby/#{ abi_version } "
122
+ default_dir = "#{ Truffle ::Boot . ruby_home } /lib/gems"
123
+ home = ENV [ 'GEM_HOME' ] || default_dir
124
+ # There is also vendor_dir, but it does not exist on TruffleRuby
125
+ default_path = [ user_dir , default_dir , home ]
126
+
127
+ if gem_path = ENV [ 'GEM_PATH' ]
128
+ paths = gem_path . split ( File ::PATH_SEPARATOR )
129
+ if gem_path . end_with? ( File ::PATH_SEPARATOR )
130
+ paths += default_path
121
131
else
122
- user_dir = "#{ Dir . home } /.gem/truffleruby/#{ abi_version } "
123
- paths = [ user_dir ]
132
+ paths << home
124
133
end
125
-
126
- home = ENV [ 'GEM_HOME' ] || "#{ Truffle ::Boot . ruby_home } /lib/gems"
127
- paths << home
128
-
129
- paths . map { |path | expand ( path ) } . uniq
134
+ else
135
+ paths = default_path
130
136
end
137
+
138
+ paths . map { |path | expand ( path ) } . uniq
131
139
end
132
140
133
141
def self . abi_version
You can’t perform that action at this time.
0 commit comments