Class: KeepUp::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/keep_up/repository.rb

Overview

Picks updated versions for dependencies.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(remote_index: RemoteIndex.new) ⇒ Repository

Returns a new instance of Repository.



8
9
10
# File 'lib/keep_up/repository.rb', line 8

def initialize(remote_index: RemoteIndex.new)
  @remote_index = remote_index
end

Instance Attribute Details

#remote_indexObject (readonly)

Returns the value of attribute remote_index.



6
7
8
# File 'lib/keep_up/repository.rb', line 6

def remote_index
  @remote_index
end

Instance Method Details

#updated_dependency_for(dependency) ⇒ Object



12
13
14
15
16
# File 'lib/keep_up/repository.rb', line 12

def updated_dependency_for(dependency)
  candidates = remote_index.search(dependency)
  latest = candidates.sort_by(&:version).last
  latest unless latest.version <= dependency.locked_version
end