Module: Gem

Defined in:
lib/rdi/Plugins/GemCommon.rb

Overview

-- Copyright (c) 2009 Muriel Salvan ([email protected]) Licensed under the terms specified in LICENSE file. No warranty is provided. ++

Defined Under Namespace

Classes: GemPathList

Class Method Summary collapse

Class Method Details

.clear_paths ⇒ Object

Clear the paths



117
118
119
# File 'lib/rdi/Plugins/GemCommon.rb', line 117

def self.clear_paths
  $RDI_GemPath_Cache.clear_paths
end

.clear_paths_ORG ⇒ Object



74
# File 'lib/rdi/Plugins/GemCommon.rb', line 74

alias :clear_paths_ORG :clear_paths

.clearCache_RDI ⇒ Object

Clear the library cache This is useful to ensure usecase tests isolation



123
124
125
# File 'lib/rdi/Plugins/GemCommon.rb', line 123

def self.clearCache_RDI
  $RDI_GemPath_Cache.clearCache
end

.find_files(iRequireName) ⇒ Object

Return the list of files matching a Ruby require

Parameters:

  • iRequireName (String): Name to require Return:
  • list: File names list


84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/rdi/Plugins/GemCommon.rb', line 84

def self.find_files(iRequireName)
  rFilesList = []

  lRequireGlob = iRequireName
  if (File.extname(iRequireName).empty?)
    # Look using globs of any extension
    lRequireGlob = "#{iRequireName}.{rb,so,o,sl,dll}"
  end
  # 1. Look through Ruby LOAD PATH and the cache
  ($LOAD_PATH + $RDI_GemPath_Cache.getLibDirs).each do |iLibDir|
    lList = Dir.glob("#{iLibDir}/#{lRequireGlob}")
    if (!lList.empty?)
      rFilesList = lList
      break
    end
  end
  # 3. Ask RubyGems for real
  if (rFilesList.empty?)
    rFilesList = Gem.find_files_ORG(iRequireName)
  end

  return rFilesList
end

.find_files_ORG ⇒ Object



70
# File 'lib/rdi/Plugins/GemCommon.rb', line 70

alias :find_files_ORG :find_files

.path ⇒ Object

Return the list of Gem paths

Return:

  • list: List of Gem paths


112
113
114
# File 'lib/rdi/Plugins/GemCommon.rb', line 112

def self.path
  return $RDI_GemPath_Cache
end

.path_ORG ⇒ Object



72
# File 'lib/rdi/Plugins/GemCommon.rb', line 72

alias :path_ORG :path