Class: Dependabot::PreCommit::Package::PackageDetailsFetcher
- Inherits:
-
Object
- Object
- Dependabot::PreCommit::Package::PackageDetailsFetcher
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/pre_commit/package/package_details_fetcher.rb
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#dependency ⇒ Object
readonly
Returns the value of attribute dependency.
-
#ignored_versions ⇒ Object
readonly
Returns the value of attribute ignored_versions.
-
#raise_on_ignored ⇒ Object
readonly
Returns the value of attribute raise_on_ignored.
Instance Method Summary collapse
- #commit_sha_release ⇒ Object
-
#initialize(dependency:, credentials:, ignored_versions: [], raise_on_ignored: false) ⇒ PackageDetailsFetcher
constructor
A new instance of PackageDetailsFetcher.
- #latest_version_tag ⇒ Object
- #release_list_for_git_dependency ⇒ Object
- #version_tag_release ⇒ Object
Constructor Details
#initialize(dependency:, credentials:, ignored_versions: [], raise_on_ignored: false) ⇒ PackageDetailsFetcher
Returns a new instance of PackageDetailsFetcher.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/dependabot/pre_commit/package/package_details_fetcher.rb', line 27 def initialize( dependency:, credentials:, ignored_versions: [], raise_on_ignored: false ) @dependency = dependency @credentials = credentials @raise_on_ignored = raise_on_ignored @ignored_versions = ignored_versions @git_helper = T.let(git_helper, Dependabot::PreCommit::Helpers::Githelper) end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
45 46 47 |
# File 'lib/dependabot/pre_commit/package/package_details_fetcher.rb', line 45 def credentials @credentials end |
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
42 43 44 |
# File 'lib/dependabot/pre_commit/package/package_details_fetcher.rb', line 42 def dependency @dependency end |
#ignored_versions ⇒ Object (readonly)
Returns the value of attribute ignored_versions.
48 49 50 |
# File 'lib/dependabot/pre_commit/package/package_details_fetcher.rb', line 48 def ignored_versions @ignored_versions end |
#raise_on_ignored ⇒ Object (readonly)
Returns the value of attribute raise_on_ignored.
51 52 53 |
# File 'lib/dependabot/pre_commit/package/package_details_fetcher.rb', line 51 def raise_on_ignored @raise_on_ignored end |
Instance Method Details
#commit_sha_release ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/dependabot/pre_commit/package/package_details_fetcher.rb', line 72 def commit_sha_release return unless git_commit_checker.pinned_ref_looks_like_commit_sha? if latest_version_tag if git_commit_checker.local_tag_for_pinned_sha || version_comment? return T.must(latest_version_tag).fetch(:version) end return latest_commit_for_pinned_ref end latest_commit_for_pinned_ref end |
#latest_version_tag ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/dependabot/pre_commit/package/package_details_fetcher.rb', line 87 def latest_version_tag @latest_version_tag ||= T.let( begin if dependency.version.nil? || !Dependabot::PreCommit::Version.correct?(dependency.version) return constrained_latest_version_tag || git_commit_checker.local_tag_for_latest_version end ref = git_commit_checker.local_ref_for_latest_version_matching_existing_precision return ref if ref && current_version && ref.fetch(:version) > current_version git_commit_checker.local_ref_for_latest_version_lower_precision end, T.nilable(T::Hash[Symbol, T.untyped]) ) end |
#release_list_for_git_dependency ⇒ Object
54 55 56 57 58 59 |
# File 'lib/dependabot/pre_commit/package/package_details_fetcher.rb', line 54 def release_list_for_git_dependency return unless git_dependency? return current_commit unless git_commit_checker.pinned? version_tag_release || commit_sha_release end |
#version_tag_release ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/dependabot/pre_commit/package/package_details_fetcher.rb', line 62 def version_tag_release return unless git_commit_checker.pinned_ref_looks_like_version? && latest_version_tag latest_version = latest_version_tag&.fetch(:version) return current_version if shortened_semver_eq?(dependency.version, latest_version.to_s) latest_version end |