Class: PlugemsDeploy::GemService

Inherits:
Object
  • Object
show all
Defined in:
lib/plugems_deploy/gem_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(sources = [ cache ]) ⇒ GemService

Returns a new instance of GemService.



8
9
10
11
# File 'lib/plugems_deploy/gem_service.rb', line 8

def initialize(sources = [ cache ])
  @sources = sources
  @indexes = { cache => Gem.cache }
end

Instance Method Details

#find_gem(name, version) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/plugems_deploy/gem_service.rb', line 13

def find_gem(name, version)

  @sources.each do |source|
    specs = index(source).search(/^#{ name }$/, version)
    return spec_with_source(specs.last, source) unless specs.empty?
  end
  
  nil

end