Class: Dependabot::Cargo::UpdateChecker::VersionResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/cargo/update_checker/version_resolver.rb

Constant Summary collapse

UNABLE_TO_UPDATE =
/Unable to update (?<url>.*?)$/
BRANCH_NOT_FOUND_REGEX =
/#{UNABLE_TO_UPDATE}.*to find branch `(?<branch>[^`]+)`/m
REVSPEC_PATTERN =
/revspec '.*' not found/
OBJECT_PATTERN =
/object not found - no match for id \(.*\)/
REF_NOT_FOUND_REGEX =
/#{UNABLE_TO_UPDATE}.*(#{REVSPEC_PATTERN}|#{OBJECT_PATTERN})/m
GIT_REF_NOT_FOUND_REGEX =
/Updating git repository `(?<url>[^`]*)`.*fatal: couldn't find remote ref/m

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, credentials:, original_dependency_files:, prepared_dependency_files:) ⇒ VersionResolver

Returns a new instance of VersionResolver.



23
24
25
26
27
28
29
# File 'lib/dependabot/cargo/update_checker/version_resolver.rb', line 23

def initialize(dependency:, credentials:,
               original_dependency_files:, prepared_dependency_files:)
  @dependency = dependency
  @prepared_dependency_files = prepared_dependency_files
  @original_dependency_files = original_dependency_files
  @credentials = credentials
end

Instance Method Details

#latest_resolvable_versionObject



31
32
33
34
35
36
37
# File 'lib/dependabot/cargo/update_checker/version_resolver.rb', line 31

def latest_resolvable_version
  return @latest_resolvable_version if defined?(@latest_resolvable_version)

  @latest_resolvable_version = fetch_latest_resolvable_version
  rescue Dependabot::SharedHelpers::HelperSubprocessFailed => e
    raise Dependabot::DependencyFileNotResolvable, e.message
end