Class: Dependabot::MetadataFinders::Base

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

Defined Under Namespace

Classes: ChangelogFinder, ChangelogPruner, CommitsFinder, ReleaseFinder

Constant Summary collapse

PACKAGE_MANAGERS_WITH_RELIABLE_DIRECTORIES =
%w(npm_and_yarn pub).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, credentials:) ⇒ Base

Returns a new instance of Base.



17
18
19
20
# File 'lib/dependabot/metadata_finders/base.rb', line 17

def initialize(dependency:, credentials:)
  @dependency = dependency
  @credentials = credentials
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



15
16
17
# File 'lib/dependabot/metadata_finders/base.rb', line 15

def credentials
  @credentials
end

#dependencyObject (readonly)

Returns the value of attribute dependency.



15
16
17
# File 'lib/dependabot/metadata_finders/base.rb', line 15

def dependency
  @dependency
end

Instance Method Details

#changelog_textObject



44
45
46
47
48
49
50
51
52
# File 'lib/dependabot/metadata_finders/base.rb', line 44

def changelog_text
  @changelog_finder ||= ChangelogFinder.new(
    dependency: dependency,
    source: source,
    credentials: credentials,
    suggested_changelog_url: suggested_changelog_url
  )
  @changelog_finder.changelog_text
end

#changelog_urlObject



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

def changelog_url
  @changelog_finder ||= ChangelogFinder.new(
    dependency: dependency,
    source: source,
    credentials: credentials,
    suggested_changelog_url: suggested_changelog_url
  )
  @changelog_finder.changelog_url
end

#commitsObject



101
102
103
104
105
106
107
108
# File 'lib/dependabot/metadata_finders/base.rb', line 101

def commits
  @commits_finder ||= CommitsFinder.new(
    dependency: dependency,
    source: source,
    credentials: credentials
  )
  @commits_finder.commits
end

#commits_urlObject



92
93
94
95
96
97
98
99
# File 'lib/dependabot/metadata_finders/base.rb', line 92

def commits_url
  @commits_finder ||= CommitsFinder.new(
    dependency: dependency,
    source: source,
    credentials: credentials
  )
  @commits_finder.commits_url
end

#homepage_urlObject



30
31
32
# File 'lib/dependabot/metadata_finders/base.rb', line 30

def homepage_url
  source_url
end

#maintainer_changesObject



110
111
112
# File 'lib/dependabot/metadata_finders/base.rb', line 110

def maintainer_changes
  nil
end

#releases_textObject



83
84
85
86
87
88
89
90
# File 'lib/dependabot/metadata_finders/base.rb', line 83

def releases_text
  @release_finder ||= ReleaseFinder.new(
    dependency: dependency,
    source: source,
    credentials: credentials
  )
  @release_finder.releases_text
end

#releases_urlObject



74
75
76
77
78
79
80
81
# File 'lib/dependabot/metadata_finders/base.rb', line 74

def releases_url
  @release_finder ||= ReleaseFinder.new(
    dependency: dependency,
    source: source,
    credentials: credentials
  )
  @release_finder.releases_url
end

#source_urlObject



22
23
24
25
26
27
28
# File 'lib/dependabot/metadata_finders/base.rb', line 22

def source_url
  if reliable_source_directory?
    source&.url_with_directory
  else
    source&.url
  end
end

#upgrade_guide_textObject



64
65
66
67
68
69
70
71
72
# File 'lib/dependabot/metadata_finders/base.rb', line 64

def upgrade_guide_text
  @changelog_finder ||= ChangelogFinder.new(
    dependency: dependency,
    source: source,
    credentials: credentials,
    suggested_changelog_url: suggested_changelog_url
  )
  @changelog_finder.upgrade_guide_text
end

#upgrade_guide_urlObject



54
55
56
57
58
59
60
61
62
# File 'lib/dependabot/metadata_finders/base.rb', line 54

def upgrade_guide_url
  @changelog_finder ||= ChangelogFinder.new(
    dependency: dependency,
    source: source,
    credentials: credentials,
    suggested_changelog_url: suggested_changelog_url
  )
  @changelog_finder.upgrade_guide_url
end