Class: Dependabot::Gradle::UpdateChecker::VersionFinder
- Inherits:
-
Object
- Object
- Dependabot::Gradle::UpdateChecker::VersionFinder
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/gradle/update_checker/version_finder.rb
Constant Summary collapse
- KOTLIN_PLUGIN_REPO_PREFIX =
"org.jetbrains.kotlin"
- TYPE_SUFFICES =
%w(jre android java native_mt agp).freeze
Instance Method Summary collapse
-
#initialize(dependency:, dependency_files:, credentials:, ignored_versions:, raise_on_ignored: false, security_advisories:) ⇒ VersionFinder
constructor
A new instance of VersionFinder.
- #latest_version_details ⇒ Object
- #lowest_security_fix_version_details ⇒ Object
- #versions ⇒ Object
Constructor Details
#initialize(dependency:, dependency_files:, credentials:, ignored_versions:, raise_on_ignored: false, security_advisories:) ⇒ VersionFinder
Returns a new instance of VersionFinder.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dependabot/gradle/update_checker/version_finder.rb', line 23 def initialize(dependency:, dependency_files:, credentials:, ignored_versions:, raise_on_ignored: false, security_advisories:) @dependency = dependency @dependency_files = dependency_files @credentials = credentials @ignored_versions = ignored_versions @raise_on_ignored = raise_on_ignored @security_advisories = security_advisories @forbidden_urls = [] end |
Instance Method Details
#latest_version_details ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/dependabot/gradle/update_checker/version_finder.rb', line 35 def latest_version_details possible_versions = versions possible_versions = filter_prereleases(possible_versions) possible_versions = filter_date_based_versions(possible_versions) possible_versions = filter_version_types(possible_versions) possible_versions = filter_ignored_versions(possible_versions) possible_versions.last end |
#lowest_security_fix_version_details ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/dependabot/gradle/update_checker/version_finder.rb', line 46 def lowest_security_fix_version_details possible_versions = versions possible_versions = filter_prereleases(possible_versions) possible_versions = filter_date_based_versions(possible_versions) possible_versions = filter_version_types(possible_versions) possible_versions = Dependabot::UpdateCheckers::VersionFilters.filter_vulnerable_versions(possible_versions, security_advisories) possible_versions = filter_ignored_versions(possible_versions) possible_versions = filter_lower_versions(possible_versions) possible_versions.first end |
#versions ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/dependabot/gradle/update_checker/version_finder.rb', line 60 def versions version_details = repositories.map do |repository_details| url = repository_details.fetch("url") next google_version_details if url == Gradle::FileParser::RepositoriesFinder::GOOGLE_MAVEN_REPO (repository_details).css("versions > version") .select { |node| version_class.correct?(node.content) } .map { |node| version_class.new(node.content) } .map { |version| { version: version, source_url: url } } end.flatten.compact raise PrivateSourceAuthenticationFailure, forbidden_urls.first if version_details.none? && forbidden_urls.any? version_details.sort_by { |details| details.fetch(:version) } end |