Module: Gem

Defined in:
lib/fastri/util.rb

Class Method Summary collapse

Class Method Details

.default_dirObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fastri/util.rb', line 12

def self.default_dir
  if defined? RUBY_FRAMEWORK_VERSION
    paths = []
    paths << APPLE_GEM_HOME if defined? APPLE_GEM_HOME
    path = File.join(File.dirname(Config::CONFIG["sitedir"]), "Gems")
    newpath = File.join(path, Config::CONFIG['ruby_version'])
    # RubyGems post r1498 appends the ruby version to the path. This
    # modification was included in the RubyGems shipped with 10.5.0.
    if File.directory?(newpath)
      # try new path first, user might have upgraded RubyGems and left old
      # installation behind
      paths + [ newpath ]
    else
      # pre-10.5.0 or older RubyGems
      paths + [ path ]
    end
  else
    [ File.join(Config::CONFIG['libdir'], 'ruby', 'gems',
               Config::CONFIG['ruby_version']) ]
  end
end

.pathObject



9
10
11
# File 'lib/fastri/util.rb', line 9

def self.path
  [ENV['GEM_HOME'], ENV['GEM_PATH'], default_dir].compact.flatten
end