Class: Dependabot::PreCommit::UpdateChecker::LatestVersionFinder

Inherits:
Dependabot::Package::PackageLatestVersionFinder
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/pre_commit/update_checker/latest_version_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, dependency_files:, credentials:, ignored_versions:, raise_on_ignored:, options: {}, cooldown_options: nil) ⇒ LatestVersionFinder

Returns a new instance of LatestVersionFinder.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/dependabot/pre_commit/update_checker/latest_version_finder.rb', line 34

def initialize(
  dependency:,
  dependency_files:,
  credentials:,
  ignored_versions:,
  raise_on_ignored:,
  options: {},
  cooldown_options: nil
)
  @dependency          = dependency
  @dependency_files    = dependency_files
  @credentials         = credentials
  @ignored_versions    = ignored_versions
  @raise_on_ignored    = raise_on_ignored
  @options             = options
  @cooldown_options = cooldown_options
  @cooldown_selected_tag = T.let(nil, T.nilable(T::Hash[Symbol, T.untyped]))

  @git_helper = T.let(git_helper, Dependabot::PreCommit::Helpers::Githelper)
  super(
    dependency: dependency,
    dependency_files: dependency_files,
    credentials: credentials,
    ignored_versions: ignored_versions,
    security_advisories: [],
    cooldown_options: cooldown_options,
    raise_on_ignored: raise_on_ignored,
    options: options
  )
end

Instance Attribute Details

#cooldown_optionsObject (readonly)

Returns the value of attribute cooldown_options.



72
73
74
# File 'lib/dependabot/pre_commit/update_checker/latest_version_finder.rb', line 72

def cooldown_options
  @cooldown_options
end

#credentialsObject (readonly)

Returns the value of attribute credentials.



69
70
71
# File 'lib/dependabot/pre_commit/update_checker/latest_version_finder.rb', line 69

def credentials
  @credentials
end

#dependencyObject (readonly)

Returns the value of attribute dependency.



66
67
68
# File 'lib/dependabot/pre_commit/update_checker/latest_version_finder.rb', line 66

def dependency
  @dependency
end

#ignored_versionsObject (readonly)

Returns the value of attribute ignored_versions.



75
76
77
# File 'lib/dependabot/pre_commit/update_checker/latest_version_finder.rb', line 75

def ignored_versions
  @ignored_versions
end

#raise_on_ignoredObject (readonly)

Returns the value of attribute raise_on_ignored.



78
79
80
# File 'lib/dependabot/pre_commit/update_checker/latest_version_finder.rb', line 78

def raise_on_ignored
  @raise_on_ignored
end

Instance Method Details

#latest_release_versionObject



84
85
86
87
88
89
90
91
# File 'lib/dependabot/pre_commit/update_checker/latest_version_finder.rb', line 84

def latest_release_version
  release = available_release
  return nil unless release

  Dependabot.logger.info("Available release version/ref is #{release}")

  filter_release_with_cooldown(release)
end

#latest_version_tagObject



94
95
96
# File 'lib/dependabot/pre_commit/update_checker/latest_version_finder.rb', line 94

def latest_version_tag
  @cooldown_selected_tag || available_latest_version_tag
end

#package_detailsObject



81
# File 'lib/dependabot/pre_commit/update_checker/latest_version_finder.rb', line 81

def package_details; end