Class: Dependabot::MetadataFinders::Base::ReleaseFinder
- Inherits:
-
Object
- Object
- Dependabot::MetadataFinders::Base::ReleaseFinder
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/metadata_finders/base/release_finder.rb
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#dependency ⇒ Object
readonly
Returns the value of attribute dependency.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(source:, dependency:, credentials:) ⇒ ReleaseFinder
constructor
A new instance of ReleaseFinder.
- #releases_text ⇒ Object
- #releases_url ⇒ Object
Constructor Details
#initialize(source:, dependency:, credentials:) ⇒ ReleaseFinder
Returns a new instance of ReleaseFinder.
35 36 37 38 39 |
# File 'lib/dependabot/metadata_finders/base/release_finder.rb', line 35 def initialize(source:, dependency:, credentials:) @source = source @dependency = dependency @credentials = credentials end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
22 23 24 |
# File 'lib/dependabot/metadata_finders/base/release_finder.rb', line 22 def credentials @credentials end |
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
19 20 21 |
# File 'lib/dependabot/metadata_finders/base/release_finder.rb', line 19 def dependency @dependency end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
25 26 27 |
# File 'lib/dependabot/metadata_finders/base/release_finder.rb', line 25 def source @source end |
Instance Method Details
#releases_text ⇒ Object
61 62 63 64 65 66 |
# File 'lib/dependabot/metadata_finders/base/release_finder.rb', line 61 def releases_text return unless relevant_releases&.any? return if relevant_releases&.all? { |r| r.body.nil? || r.body == "" } relevant_releases&.map { |r| serialize_release(r) }&.join("\n\n") end |
#releases_url ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/dependabot/metadata_finders/base/release_finder.rb', line 42 def releases_url return unless source # Azure does not provide tags via API, so we can't check whether # there are any releases. So, optimistically return the tags location return "#{T.must(source).url}/tags" if T.must(source).provider == "azure" # If there are no releases, we won't be linking to the releases page return unless all_releases.any? case T.must(source).provider when "github" then "#{T.must(source).url}/releases" when "gitlab" then "#{T.must(source).url}/tags" when "bitbucket", "codecommit" then nil else raise "Unexpected repo provider '#{T.must(source).provider}'" end end |