Class: Dependabot::Maven::FileUpdater::DeclarationFinder

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

Constant Summary collapse

DECLARATION_REGEX =
%r{
  <parent>.*?</parent>|
  <dependency>.*?</dependency>|
  <plugin>.*?(?:<plugin>.*?</plugin>.*)?</plugin>|
  <extension>.*?</extension>|
  <path>.*?</path>|
  <artifactItem>.*?</artifactItem>
}mx

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, dependency_files:, declaring_requirement:) ⇒ DeclarationFinder

Returns a new instance of DeclarationFinder.



40
41
42
43
44
45
46
# File 'lib/dependabot/maven/file_updater/declaration_finder.rb', line 40

def initialize(dependency:, dependency_files:, declaring_requirement:)
  @dependency = dependency
  @dependency_files = dependency_files
  @declaring_requirement = declaring_requirement
  @declaration_strings = T.let(nil, T.nilable(T::Array[String]))
  @property_value_finder = T.let(nil, T.nilable(Maven::FileParser::PropertyValueFinder))
end

Instance Attribute Details

#declaring_requirementObject (readonly)

Returns the value of attribute declaring_requirement.



28
29
30
# File 'lib/dependabot/maven/file_updater/declaration_finder.rb', line 28

def declaring_requirement
  @declaring_requirement
end

#dependencyObject (readonly)

Returns the value of attribute dependency.



25
26
27
# File 'lib/dependabot/maven/file_updater/declaration_finder.rb', line 25

def dependency
  @dependency
end

#dependency_filesObject (readonly)

Returns the value of attribute dependency_files.



31
32
33
# File 'lib/dependabot/maven/file_updater/declaration_finder.rb', line 31

def dependency_files
  @dependency_files
end

Instance Method Details

#declaration_nodesObject



54
55
56
57
58
# File 'lib/dependabot/maven/file_updater/declaration_finder.rb', line 54

def declaration_nodes
  declaration_strings.map do |declaration_string|
    Nokogiri::XML(declaration_string)
  end
end

#declaration_stringsObject



49
50
51
# File 'lib/dependabot/maven/file_updater/declaration_finder.rb', line 49

def declaration_strings
  @declaration_strings ||= fetch_pom_declaration_strings
end