Class: Dependabot::Elm::UpdateChecker

Inherits:
UpdateCheckers::Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/elm/update_checker.rb,
lib/dependabot/elm/update_checker/cli_parser.rb,
lib/dependabot/elm/update_checker/requirements_updater.rb,
lib/dependabot/elm/update_checker/latest_version_finder.rb

Defined Under Namespace

Classes: CliParser, Elm19LatestVersionFinder, LatestVersionFinder, RequirementsUpdater

Instance Method Summary collapse

Instance Method Details

#can_update?(requirements_to_unlock:) ⇒ Boolean



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/dependabot/elm/update_checker.rb', line 51

def can_update?(requirements_to_unlock:)
  if dependency.appears_in_lockfile?
    version_can_update?(requirements_to_unlock: requirements_to_unlock)
  elsif requirements_to_unlock == :none
    false
  elsif requirements_to_unlock == :own
    requirements_can_update?
  elsif requirements_to_unlock == :all
    updated_dependencies_after_full_unlock.any?
  else
    false
  end
end

#latest_resolvable_versionObject



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

def latest_resolvable_version
  @latest_resolvable_version ||= T.let(
    latest_version_finder_elm19
    .latest_resolvable_version(unlock_requirement: :own),
    T.nilable(Dependabot::Version)
  )
end

#latest_resolvable_version_with_no_unlockObject



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

def latest_resolvable_version_with_no_unlock
  # Irrelevant, since Elm has a single dependency file (well, there's
  # also `exact-dependencies.json`, but it's not recommended that that
  # is committed).
  nil
end

#latest_versionObject



19
20
21
# File 'lib/dependabot/elm/update_checker.rb', line 19

def latest_version
  @latest_version ||= T.let(T.must(latest_version_finder).release_version, T.nilable(Dependabot::Version))
end

#updated_requirementsObject



41
42
43
44
45
46
# File 'lib/dependabot/elm/update_checker.rb', line 41

def updated_requirements
  RequirementsUpdater.new(
    requirements: dependency.requirements,
    latest_resolvable_version: latest_resolvable_version
  ).updated_requirements
end