Gem::PathSupport facilitates the GEM_HOME and GEM_PATH environment settings to the rest of RubyGems.
Constructor. Takes a single argument which is to be treated like a hashtable, or defaults to ENV, the system environment.
# File lib/rubygems/path_support.rb, line 19
19: def initialize(env=ENV)
20: @env = env
21:
22: # note 'env' vs 'ENV'...
23: @home = env["GEM_HOME"] || ENV["GEM_HOME"] || Gem.default_dir
24:
25: if File::ALT_SEPARATOR then
26: @home = @home.gsub(File::ALT_SEPARATOR, File::SEPARATOR)
27: end
28:
29: self.path = env["GEM_PATH"] || ENV["GEM_PATH"]
30: end
Set the Gem home directory (as reported by Gem.dir).
# File lib/rubygems/path_support.rb, line 37
37: def home=(home)
38: @home = home.to_s
39: end
Set the Gem search path (as reported by Gem.path).
# File lib/rubygems/path_support.rb, line 44
44: def path=(gpaths)
45: gem_path = [@home]
46:
47: # FIX: I can't tell wtf this is doing.
48: gpaths ||= (ENV['GEM_PATH'] || "").empty? ? nil : ENV["GEM_PATH"]
49:
50: if gpaths then
51: if gpaths.kind_of?(Array) then
52: gem_path.push(*gpaths)
53: else
54: gem_path.push(*gpaths.split(File::PATH_SEPARATOR))
55: end
56:
57: if File::ALT_SEPARATOR then
58: gem_path.map! do |this_path|
59: this_path.gsub File::ALT_SEPARATOR, File::SEPARATOR
60: end
61: end
62: else
63: gem_path.push(*Gem.default_path)
64:
65: gem_path << APPLE_GEM_HOME if defined?(APPLE_GEM_HOME)
66: end
67:
68: @path = gem_path.uniq
69: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.