Class: Dependabot::Maven::FileUpdater::DependencyRequirementScopes
- Inherits:
-
Object
- Object
- Dependabot::Maven::FileUpdater::DependencyRequirementScopes
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/maven/file_updater/dependency_requirement_scopes.rb
Overview
Splits merged dependency requirements into wrapper-file and POM scopes. DependencySet may combine requirements from multiple wrapper files or from a wrapper and a regular POM entry.
Constant Summary collapse
- RequirementPair =
T.type_alias do [Dependabot::DependencyRequirement, T.nilable(Dependabot::DependencyRequirement)] end
Instance Method Summary collapse
-
#initialize(dependencies:) ⇒ DependencyRequirementScopes
constructor
A new instance of DependencyRequirementScopes.
- #pom_dependency(dependency) ⇒ Object
- #wrapper_groups ⇒ Object
Constructor Details
#initialize(dependencies:) ⇒ DependencyRequirementScopes
Returns a new instance of DependencyRequirementScopes.
22 23 24 |
# File 'lib/dependabot/maven/file_updater/dependency_requirement_scopes.rb', line 22 def initialize(dependencies:) @dependencies = dependencies end |
Instance Method Details
#pom_dependency(dependency) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/dependabot/maven/file_updater/dependency_requirement_scopes.rb', line 44 def pom_dependency(dependency) pom_pairs = requirement_pairs(dependency).reject do |requirement, _| distribution_requirement?(requirement) end return if pom_pairs.empty? dependency_with_requirement_pairs(dependency, pom_pairs) end |
#wrapper_groups ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dependabot/maven/file_updater/dependency_requirement_scopes.rb', line 27 def wrapper_groups groups = T.let({}, T::Hash[String, T::Array[Dependabot::Dependency]]) dependencies.each do |dependency| requirement_pairs(dependency) .select { |requirement, _| distribution_requirement?(requirement) } .group_by { |requirement, _| requirement.file } .each do |properties_name, pairs| next unless properties_name group = groups.fetch(properties_name) { groups[properties_name] = [] } group << dependency_with_requirement_pairs(dependency, pairs) end end groups end |