Class: Librarian::Action::Update

Inherits:
Base
  • Object
show all
Includes:
PersistResolutionMixin
Defined in:
lib/librarian/action/update.rb

Instance Attribute Summary

Attributes inherited from Base

#environment, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Librarian::Action::Base

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/librarian/action/update.rb', line 12

def run
  unless lockfile_path.exist?
    raise Error, "Lockfile missing!"
  end
  previous_resolution = lockfile.load(lockfile_path.read)
  spec = specfile.read(previous_resolution.sources)
  changes = spec_change_set(spec, previous_resolution)
  manifests = changes.same? ? previous_resolution.manifests : changes.analyze
  partial_manifests = ManifestSet.deep_strip(manifests, dependency_names)
  unpinnable_sources = previous_resolution.sources - partial_manifests.map(&:source)
  unpinnable_sources.each(&:unpin!)

  resolution = resolver.resolve(spec, partial_manifests)
  persist_resolution(resolution)
end