Class: Dependabot::Dep::FileUpdater::ManifestUpdater
- Inherits:
-
Object
- Object
- Dependabot::Dep::FileUpdater::ManifestUpdater
- Defined in:
- lib/dependabot/dep/file_updater/manifest_updater.rb
Instance Method Summary collapse
-
#initialize(dependencies:, manifest:) ⇒ ManifestUpdater
constructor
A new instance of ManifestUpdater.
- #updated_manifest_content ⇒ Object
Constructor Details
#initialize(dependencies:, manifest:) ⇒ ManifestUpdater
Returns a new instance of ManifestUpdater.
9 10 11 12 |
# File 'lib/dependabot/dep/file_updater/manifest_updater.rb', line 9 def initialize(dependencies:, manifest:) @dependencies = dependencies @manifest = manifest end |
Instance Method Details
#updated_manifest_content ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dependabot/dep/file_updater/manifest_updater.rb', line 14 def updated_manifest_content dependencies. select { |dep| requirement_changed?(manifest, dep) }. reduce(manifest.content.dup) do |content, dep| updated_content = content updated_content = update_requirements( content: updated_content, filename: manifest.name, dependency: dep ) updated_content = update_git_pin( content: updated_content, filename: manifest.name, dependency: dep ) raise "Expected content to change!" if content == updated_content updated_content end end |