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



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

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

#changelog_urlObject



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

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

#commitsObject



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

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

#commits_urlObject



87
88
89
90
91
92
93
94
# File 'lib/dependabot/metadata_finders/base.rb', line 87

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



105
106
107
# File 'lib/dependabot/metadata_finders/base.rb', line 105

def maintainer_changes
  nil
end

#releases_textObject



78
79
80
81
82
83
84
85
# File 'lib/dependabot/metadata_finders/base.rb', line 78

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

#releases_urlObject



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

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



60
61
62
63
64
65
66
67
# File 'lib/dependabot/metadata_finders/base.rb', line 60

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

#upgrade_guide_urlObject



51
52
53
54
55
56
57
58
# File 'lib/dependabot/metadata_finders/base.rb', line 51

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