Class: Dependabot::Opentofu::UpdateChecker

Inherits:
UpdateCheckers::Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/opentofu/update_checker.rb,
lib/dependabot/opentofu/update_checker/latest_version_resolver.rb

Defined Under Namespace

Classes: LatestVersionResolver

Constant Summary collapse

ELIGIBLE_SOURCE_TYPES =
%w(git provider registry oci).freeze

Instance Method Summary collapse

Instance Method Details

#latest_resolvable_versionObject



34
35
36
37
38
# File 'lib/dependabot/opentofu/update_checker.rb', line 34

def latest_resolvable_version
  # No concept of resolvability for terraform modules (that we're aware
  # of - there may be in future).
  latest_version
end

#latest_resolvable_version_with_no_unlockObject



41
42
43
44
# File 'lib/dependabot/opentofu/update_checker.rb', line 41

def latest_resolvable_version_with_no_unlock
  # TODO: Update later to use lock files
  nil
end

#latest_versionObject



24
25
26
27
28
29
30
31
# File 'lib/dependabot/opentofu/update_checker.rb', line 24

def latest_version
  return latest_version_for_git_dependency if git_dependency?
  return latest_version_for_registry_dependency if registry_dependency?
  return latest_version_for_oci_dependency if oci_dependency?

  latest_version_for_provider_dependency if provider_dependency?
  # Other sources (mercurial, path dependencies) just return `nil`
end

#requirements_unlocked_or_can_be?Boolean

Returns:

  • (Boolean)


56
57
58
59
60
# File 'lib/dependabot/opentofu/update_checker.rb', line 56

def requirements_unlocked_or_can_be?
  # If the requirement comes from a proxy URL then there's no way for
  # us to update it
  !proxy_requirement?
end

#updated_requirementsObject



47
48
49
50
51
52
53
# File 'lib/dependabot/opentofu/update_checker.rb', line 47

def updated_requirements
  RequirementsUpdater.new(
    requirements: dependency.requirements,
    latest_version: latest_version&.to_s,
    tag_for_latest_version: tag_for_latest_version
  ).updated_requirements
end