Class: WarningShot::GemResolver Private

Inherits:
Object
  • Object
show all
Includes:
Resolver
Defined in:
lib/resolvers/gem_resolver.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: GemResource

Constant Summary collapse

DEFAULT_VERSION =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Default version to install

">= 0.0.0".freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resolver

descendants

Constructor Details

#initialize(config, *params) ⇒ GemResolver

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of GemResolver.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/resolvers/gem_resolver.rb', line 100

def initialize(config,*params)
  super
  
  Gem.configuration.update_sources = !!(self.config[:update_sources])
  
  if self.config.key?(:gem_path) && !self.config[:gem_path].nil?
    gem_dirs = self.config[:gem_path].split(':')
    gem_dirs.reverse.each do |path|
      Gem.path.unshift File.expand_path(path)
    end
 
    WarningShot::GemResolver.update_source_index *gem_dirs
  end
end

Class Method Details

.update_source_index(*dirs) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



90
91
92
93
94
95
96
97
# File 'lib/resolvers/gem_resolver.rb', line 90

def update_source_index(*dirs)
  spec_dirs = dirs.inject([]){|memo,dir| 
    memo << File.join(File.expand_path(dir), 'specifications')
  }
        
  Gem.send :class_variable_set, "@@source_index", Gem::SourceIndex.from_gems_in(*spec_dirs)
  Gem::cache.refresh!
end