Class: Dependabot::Maven::FileUpdater

Inherits:
FileUpdaters::Base
  • Object
show all
Defined in:
lib/dependabot/maven/file_updater.rb,
lib/dependabot/maven/file_updater/declaration_finder.rb,
lib/dependabot/maven/file_updater/property_value_updater.rb

Defined Under Namespace

Classes: DeclarationFinder, PropertyValueUpdater

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.updated_files_regexObject



13
14
15
16
17
18
# File 'lib/dependabot/maven/file_updater.rb', line 13

def self.updated_files_regex
  [
    /^pom\.xml$/, %r{/pom\.xml$},
    /^extensions.\.xml$/, %r{/extensions\.xml$}
  ]
end

Instance Method Details

#updated_dependency_filesObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/dependabot/maven/file_updater.rb', line 20

def updated_dependency_files
  updated_files = dependency_files.dup

  # Loop through each of the changed requirements, applying changes to
  # all pom and extensions files for that change. Note that the logic
  # is different here to other package managers because Maven has property
  # inheritance across files
  dependencies.each do |dependency|
    updated_files = update_files_for_dependency(
      original_files: updated_files,
      dependency: dependency
    )
  end

  updated_files.select! { |f| f.name.end_with?("pom.xml", "extensions.xml") }
  updated_files.reject! { |f| dependency_files.include?(f) }

  raise "No files changed!" if updated_files.none?
  raise "Updated a supporting POM!" if updated_files.any? { |f| f.name.end_with?("pom_parent.xml") }

  updated_files
end