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 =
T.let(
  %w(git provider registry oci).freeze,
  T::Array[String]
)

Instance Method Summary collapse

Instance Method Details

#latest_resolvable_versionObject



37
38
39
40
41
# File 'lib/dependabot/opentofu/update_checker.rb', line 37

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



44
45
46
47
# File 'lib/dependabot/opentofu/update_checker.rb', line 44

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

#latest_versionObject



27
28
29
30
31
32
33
34
# File 'lib/dependabot/opentofu/update_checker.rb', line 27

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)


59
60
61
62
63
# File 'lib/dependabot/opentofu/update_checker.rb', line 59

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



50
51
52
53
54
55
56
# File 'lib/dependabot/opentofu/update_checker.rb', line 50

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