Class: Dependabot::Composer::UpdateChecker

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

Defined Under Namespace

Classes: LatestVersionFinder, RequirementsUpdater, VersionResolver

Instance Method Summary collapse

Instance Method Details

#latest_resolvable_versionObject


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

def latest_resolvable_version
  return nil if path_dependency?

  @latest_resolvable_version ||=
    VersionResolver.new(
      credentials: credentials,
      dependency: dependency,
      dependency_files: dependency_files,
      latest_allowable_version: latest_version_from_registry,
      requirements_to_unlock: :own
    ).latest_resolvable_version
end

#latest_resolvable_version_with_no_unlockObject


47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/dependabot/composer/update_checker.rb', line 47

def latest_resolvable_version_with_no_unlock
  return nil if path_dependency?

  @latest_resolvable_version_with_no_unlock ||=
    VersionResolver.new(
      credentials: credentials,
      dependency: dependency,
      dependency_files: dependency_files,
      latest_allowable_version: latest_version_from_registry,
      requirements_to_unlock: :none
    ).latest_resolvable_version
end

#latest_versionObject


16
17
18
19
20
21
# File 'lib/dependabot/composer/update_checker.rb', line 16

def latest_version
  return nil if path_dependency?

  # Fall back to latest_resolvable_version if no listings found
  latest_version_from_registry || latest_resolvable_version
end

#lowest_resolvable_security_fix_versionObject


36
37
38
39
40
41
42
43
44
45
# File 'lib/dependabot/composer/update_checker.rb', line 36

def lowest_resolvable_security_fix_version
  raise "Dependency not vulnerable!" unless vulnerable?

  if defined?(@lowest_resolvable_security_fix_version)
    return @lowest_resolvable_security_fix_version
  end

  @lowest_resolvable_security_fix_version =
    fetch_lowest_resolvable_security_fix_version
end

#requirements_update_strategyObject


68
69
70
71
72
73
74
75
76
# File 'lib/dependabot/composer/update_checker.rb', line 68

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

#updated_requirementsObject


60
61
62
63
64
65
66
# File 'lib/dependabot/composer/update_checker.rb', line 60

def updated_requirements
  RequirementsUpdater.new(
    requirements: dependency.requirements,
    latest_resolvable_version: preferred_resolvable_version&.to_s,
    update_strategy: requirements_update_strategy
  ).updated_requirements
end