Class: Dependabot::Gradle::UpdateChecker::MultiDependencyUpdater
- Inherits:
-
Object
- Object
- Dependabot::Gradle::UpdateChecker::MultiDependencyUpdater
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/gradle/update_checker/multi_dependency_updater.rb
Instance Method Summary collapse
-
#initialize(dependency:, dependency_files:, credentials:, target_version_details:, ignored_versions:, raise_on_ignored: false) ⇒ MultiDependencyUpdater
constructor
A new instance of MultiDependencyUpdater.
- #update_possible? ⇒ Boolean
- #updated_dependencies ⇒ Object
Constructor Details
#initialize(dependency:, dependency_files:, credentials:, target_version_details:, ignored_versions:, raise_on_ignored: false) ⇒ MultiDependencyUpdater
Returns a new instance of MultiDependencyUpdater.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/dependabot/gradle/update_checker/multi_dependency_updater.rb', line 28 def initialize( dependency:, dependency_files:, credentials:, target_version_details:, ignored_versions:, raise_on_ignored: false ) @dependency = T.let(dependency, Dependabot::Dependency) @dependency_files = T.let(dependency_files, T::Array[Dependabot::DependencyFile]) @credentials = T.let(credentials, T::Array[Dependabot::Credential]) @target_version = T.let( target_version_details&.fetch(:version), T.nilable(Dependabot::Gradle::Version) ) @source_url = T.let( T.cast(target_version_details&.fetch(:source_url), T.nilable(String)), T.nilable(String) ) @ignored_versions = T.let(ignored_versions, T::Array[String]) @raise_on_ignored = T.let(raise_on_ignored, T::Boolean) @update_possible = T.let(nil, T.nilable(T::Boolean)) @updated_dependencies = T.let(nil, T.nilable(T::Array[Dependabot::Dependency])) @dependencies_to_update = T.let(nil, T.nilable(T::Array[Dependabot::Dependency])) @property_name = T.let(nil, T.nilable(String)) @dependency_set = T.let(nil, T.nilable(T::Hash[Symbol, String])) @updated_requirements = T.let({}, T::Hash[String, T::Array[T::Hash[Symbol, T.untyped]]]) end |
Instance Method Details
#update_possible? ⇒ Boolean
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/dependabot/gradle/update_checker/multi_dependency_updater.rb', line 59 def update_possible? return false unless target_version @update_possible ||= dependencies_to_update.all? do |dep| VersionFinder.new( dependency: dep, dependency_files: dependency_files, credentials: credentials, ignored_versions: ignored_versions, raise_on_ignored: @raise_on_ignored, security_advisories: [] ).versions .map { |v| v.fetch(:version) } .include?(target_version) end end |
#updated_dependencies ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/dependabot/gradle/update_checker/multi_dependency_updater.rb', line 78 def updated_dependencies raise "Update not possible!" unless update_possible? @updated_dependencies ||= dependencies_to_update.map do |dep| Dependency.new( name: dep.name, version: target_version.to_s, requirements: updated_requirements(dep), previous_version: dep.version, previous_requirements: dep.requirements, package_manager: dep.package_manager ) end end |