Class: Dependabot::MetadataFinders::Base

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
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 =
T.let(%w(npm_and_yarn pub).freeze, T::Array[String])

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, credentials:) ⇒ Base

Returns a new instance of Base.



33
34
35
36
# File 'lib/dependabot/metadata_finders/base.rb', line 33

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

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



24
25
26
# File 'lib/dependabot/metadata_finders/base.rb', line 24

def credentials
  @credentials
end

#dependencyObject (readonly)

Returns the value of attribute dependency.



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

def dependency
  @dependency
end

Instance Method Details

#changelog_textObject



67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/dependabot/metadata_finders/base.rb', line 67

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

#changelog_urlObject



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

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

#commitsObject



148
149
150
151
152
153
154
155
156
157
158
# File 'lib/dependabot/metadata_finders/base.rb', line 148

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

#commits_urlObject



135
136
137
138
139
140
141
142
143
144
145
# File 'lib/dependabot/metadata_finders/base.rb', line 135

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

#homepage_urlObject



48
49
50
# File 'lib/dependabot/metadata_finders/base.rb', line 48

def homepage_url
  source_url
end

#maintainer_changesObject



161
162
163
# File 'lib/dependabot/metadata_finders/base.rb', line 161

def maintainer_changes
  nil
end

#releases_textObject



122
123
124
125
126
127
128
129
130
131
132
# File 'lib/dependabot/metadata_finders/base.rb', line 122

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

#releases_urlObject



109
110
111
112
113
114
115
116
117
118
119
# File 'lib/dependabot/metadata_finders/base.rb', line 109

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

#source_urlObject



39
40
41
42
43
44
45
# File 'lib/dependabot/metadata_finders/base.rb', line 39

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

#upgrade_guide_textObject



95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/dependabot/metadata_finders/base.rb', line 95

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

#upgrade_guide_urlObject



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

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