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).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, credentials:) ⇒ Base

Returns a new instance of Base.



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

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

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



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

def credentials
  @credentials
end

#dependencyObject (readonly)

Returns the value of attribute dependency.



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

def dependency
  @dependency
end

Instance Method Details

#changelog_textObject



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

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



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

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



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

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

#commits_urlObject



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

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

#homepage_urlObject



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

def homepage_url
  source_url
end

#maintainer_changesObject



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

def maintainer_changes
  nil
end

#releases_textObject



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

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

#releases_urlObject



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

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

#source_urlObject



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

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

#upgrade_guide_textObject



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

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



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

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