Class: Dependabot::Elm::UpdateChecker

Inherits:
UpdateCheckers::Base
  • Object
show all
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/elm_19_version_resolver.rb

Defined Under Namespace

Classes: CliParser, Elm19VersionResolver, RequirementsUpdater

Instance Method Summary collapse

Instance Method Details

#can_update?(requirements_to_unlock:) ⇒ Boolean

Overwrite the base class to allow multi-dependency update PRs for dependencies for which we don’t have a version.

Returns:

  • (Boolean)


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

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?
  end
end

#latest_resolvable_versionObject



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

def latest_resolvable_version
  @latest_resolvable_version ||=
    version_resolver
    .latest_resolvable_version(unlock_requirement: :own)
end

#latest_resolvable_version_with_no_unlockObject



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

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



16
17
18
# File 'lib/dependabot/elm/update_checker.rb', line 16

def latest_version
  @latest_version ||= candidate_versions.max
end

#updated_requirementsObject



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

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