Class: Dependabot::FileUpdaters::Java::Gradle::DependencySetUpdater
- Inherits:
-
Object
- Object
- Dependabot::FileUpdaters::Java::Gradle::DependencySetUpdater
- Defined in:
- lib/dependabot/file_updaters/java/gradle/dependency_set_updater.rb
Instance Method Summary collapse
-
#initialize(dependency_files:) ⇒ DependencySetUpdater
constructor
A new instance of DependencySetUpdater.
- #update_files_for_dep_set_change(dependency_set:, buildfile:, previous_requirement:, updated_requirement:) ⇒ Object
Constructor Details
#initialize(dependency_files:) ⇒ DependencySetUpdater
Returns a new instance of DependencySetUpdater.
11 12 13 |
# File 'lib/dependabot/file_updaters/java/gradle/dependency_set_updater.rb', line 11 def initialize(dependency_files:) @dependency_files = dependency_files end |
Instance Method Details
#update_files_for_dep_set_change(dependency_set:, buildfile:, previous_requirement:, updated_requirement:) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/dependabot/file_updaters/java/gradle/dependency_set_updater.rb', line 15 def update_files_for_dep_set_change(dependency_set:, buildfile:, previous_requirement:, updated_requirement:) declaration_string = original_declaration_string(dependency_set, buildfile) return dependency_files unless declaration_string updated_content = buildfile.content.sub( declaration_string, declaration_string.sub( previous_requirement, updated_requirement ) ) updated_files = dependency_files.dup updated_files[updated_files.index(buildfile)] = update_file(file: buildfile, content: updated_content) updated_files end |