Class: Gem::PathSupport

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/path_support.rb

Overview

Gem::PathSupport facilitates the GEM_HOME and GEM_PATH environment settings to the rest of RubyGems.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ PathSupport

Constructor. Takes a single argument which is to be treated like a hashtable, or defaults to ENV, the system environment.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rubygems/path_support.rb', line 26

def initialize(env)
  @home = env["GEM_HOME"] || Gem.default_dir

  if File::ALT_SEPARATOR
    @home = @home.gsub(File::ALT_SEPARATOR, File::SEPARATOR)
  end

  @home = expand(@home)

  @path = split_gem_path env["GEM_PATH"], @home

  @spec_cache_dir = env["GEM_SPEC_CACHE"] || Gem.default_spec_cache_dir

  @spec_cache_dir = @spec_cache_dir.dup.tap(&Gem::UNTAINT)
end

Instance Attribute Details

#homeObject (readonly)

The default system path for managing Gems.



11
12
13
# File 'lib/rubygems/path_support.rb', line 11

def home
  @home
end

#pathObject (readonly)

Array of paths to search for Gems.



15
16
17
# File 'lib/rubygems/path_support.rb', line 15

def path
  @path
end

#spec_cache_dirObject (readonly)

Directory with spec cache



19
20
21
# File 'lib/rubygems/path_support.rb', line 19

def spec_cache_dir
  @spec_cache_dir
end