Class: Dependabot::Dep::UpdateChecker

Inherits:
UpdateCheckers::Base
  • Object
show all
Defined in:
lib/dependabot/dep/update_checker.rb,
lib/dependabot/dep/update_checker/file_preparer.rb,
lib/dependabot/dep/update_checker/version_resolver.rb,
lib/dependabot/dep/update_checker/requirements_updater.rb,
lib/dependabot/dep/update_checker/latest_version_finder.rb

Defined Under Namespace

Classes: FilePreparer, LatestVersionFinder, RequirementsUpdater, VersionResolver

Instance Method Summary collapse

Instance Method Details

#latest_resolvable_versionObject



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/dependabot/dep/update_checker.rb', line 25

def latest_resolvable_version
  # We don't yet support updating indirect dependencies for dep
  return dependency.version unless dependency.top_level?

  @latest_resolvable_version ||=
    if modules_dependency?
      latest_version
    elsif git_dependency?
      latest_resolvable_version_for_git_dependency
    else
      latest_resolvable_released_version(unlock_requirement: true)
    end
end

#latest_resolvable_version_with_no_unlockObject



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/dependabot/dep/update_checker.rb', line 39

def latest_resolvable_version_with_no_unlock
  # We don't yet support updating indirect dependencies for dep
  return dependency.version unless dependency.top_level?

  @latest_resolvable_version_with_no_unlock ||=
    if git_dependency?
      latest_resolvable_commit_with_unchanged_git_source
    else
      latest_resolvable_released_version(unlock_requirement: false)
    end
end

#latest_versionObject



15
16
17
18
19
20
21
22
23
# File 'lib/dependabot/dep/update_checker.rb', line 15

def latest_version
  @latest_version ||=
    LatestVersionFinder.new(
      dependency: dependency,
      dependency_files: dependency_files,
      credentials: credentials,
      ignored_versions: ignored_versions
    ).latest_version
end

#requirements_update_strategyObject



62
63
64
65
66
67
68
69
70
# File 'lib/dependabot/dep/update_checker.rb', line 62

def requirements_update_strategy
  # If passed in as an option (in the base class) honour that option
  if @requirements_update_strategy
    return @requirements_update_strategy.to_sym
  end

  # Otherwise, widen ranges for libraries and bump versions for apps
  library? ? :widen_ranges : :bump_versions
end

#updated_requirementsObject



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

def updated_requirements
  @updated_requirements ||=
    RequirementsUpdater.new(
      requirements: dependency.requirements,
      updated_source: updated_source,
      update_strategy: requirements_update_strategy,
      latest_version: latest_version&.to_s,
      latest_resolvable_version: latest_resolvable_version&.to_s
    ).updated_requirements
end