Class: Dependabot::Maven::UpdateChecker::PropertyUpdater
- Inherits:
-
Object
- Object
- Dependabot::Maven::UpdateChecker::PropertyUpdater
- Defined in:
- lib/dependabot/maven/update_checker/property_updater.rb
Instance Method Summary collapse
-
#initialize(dependency:, dependency_files:, credentials:, target_version_details:, ignored_versions:) ⇒ PropertyUpdater
constructor
A new instance of PropertyUpdater.
- #update_possible? ⇒ Boolean
- #updated_dependencies ⇒ Object
Constructor Details
#initialize(dependency:, dependency_files:, credentials:, target_version_details:, ignored_versions:) ⇒ PropertyUpdater
Returns a new instance of PropertyUpdater.
15 16 17 18 19 20 21 22 23 |
# File 'lib/dependabot/maven/update_checker/property_updater.rb', line 15 def initialize(dependency:, dependency_files:, credentials:, target_version_details:, ignored_versions:) @dependency = dependency @dependency_files = dependency_files @credentials = credentials @ignored_versions = ignored_versions @target_version = target_version_details&.fetch(:version) @source_url = target_version_details&.fetch(:source_url) end |
Instance Method Details
#update_possible? ⇒ Boolean
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/dependabot/maven/update_checker/property_updater.rb', line 25 def update_possible? return false unless target_version return @update_possible if defined?(@update_possible) @update_possible = dependencies_using_property.all? do |dep| next false if includes_property_reference?(updated_version(dep)) versions = VersionFinder.new( dependency: dep, dependency_files: dependency_files, credentials: credentials, ignored_versions: ignored_versions, security_advisories: [] ).versions.map { |v| v.fetch(:version) } versions.include?(updated_version(dep)) || versions.none? end end |
#updated_dependencies ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/dependabot/maven/update_checker/property_updater.rb', line 45 def updated_dependencies raise "Update not possible!" unless update_possible? @updated_dependencies ||= dependencies_using_property.map do |dep| Dependency.new( name: dep.name, version: updated_version(dep), requirements: updated_requirements(dep), previous_version: dep.version, previous_requirements: dep.requirements, package_manager: dep.package_manager ) end end |