Class: Dependabot::MetadataFinders::Base::ChangelogFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/metadata_finders/base/changelog_finder.rb

Constant Summary collapse

CHANGELOG_NAMES =

Earlier entries are preferred

%w(
  changelog news changes history release whatsnew releases
).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source:, dependency:, credentials:, suggested_changelog_url: nil) ⇒ ChangelogFinder

Returns a new instance of ChangelogFinder.



24
25
26
27
28
29
30
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 24

def initialize(source:, dependency:, credentials:,
               suggested_changelog_url: nil)
  @source = source
  @dependency = dependency
  @credentials = credentials
  @suggested_changelog_url = suggested_changelog_url
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



22
23
24
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 22

def credentials
  @credentials
end

#dependencyObject (readonly)

Returns the value of attribute dependency.



22
23
24
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 22

def dependency
  @dependency
end

#sourceObject (readonly)

Returns the value of attribute source.



22
23
24
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 22

def source
  @source
end

#suggested_changelog_urlObject (readonly)

Returns the value of attribute suggested_changelog_url.



22
23
24
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 22

def suggested_changelog_url
  @suggested_changelog_url
end

Instance Method Details

#changelog_textObject



36
37
38
39
40
41
42
43
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 36

def changelog_text
  return unless full_changelog_text

  ChangelogPruner.new(
    dependency: dependency,
    changelog_text: full_changelog_text
  ).pruned_text
end

#changelog_urlObject



32
33
34
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 32

def changelog_url
  changelog&.html_url
end

#upgrade_guide_textObject



49
50
51
52
53
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 49

def upgrade_guide_text
  return unless upgrade_guide

  @upgrade_guide_text ||= fetch_file_text(upgrade_guide)
end

#upgrade_guide_urlObject



45
46
47
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 45

def upgrade_guide_url
  upgrade_guide&.html_url
end