Class: Dependabot::Python::FileUpdater::PipfileManifestUpdater

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/python/file_updater/pipfile_manifest_updater.rb

Instance Method Summary collapse

Constructor Details

#initialize(dependencies:, manifest:) ⇒ PipfileManifestUpdater

Returns a new instance of PipfileManifestUpdater.



13
14
15
16
# File 'lib/dependabot/python/file_updater/pipfile_manifest_updater.rb', line 13

def initialize(dependencies:, manifest:)
  @dependencies = dependencies
  @manifest = manifest
end

Instance Method Details

#updated_manifest_contentObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dependabot/python/file_updater/pipfile_manifest_updater.rb', line 19

def updated_manifest_content
  dependencies
    .select { |dep| requirement_changed?(dep) }
    .reduce(manifest.content.dup) do |content, dep|
      updated_content = content

      updated_content = update_requirements(
        content: T.must(updated_content),
        dependency: dep
      )

      raise "Content did not change!" if content == updated_content

      updated_content
    end
end