Class: Dependabot::Bundler::UpdateChecker::VersionResolver

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
SharedBundlerHelpers
Defined in:
lib/dependabot/bundler/update_checker/version_resolver.rb

Constant Summary

Constants included from SharedBundlerHelpers

SharedBundlerHelpers::GIT_REF_REGEX, SharedBundlerHelpers::GIT_REGEX, SharedBundlerHelpers::PATH_REGEX, SharedBundlerHelpers::RETRYABLE_ERRORS, SharedBundlerHelpers::RETRYABLE_PRIVATE_REGISTRY_ERRORS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SharedBundlerHelpers

#base_directory, #handle_bundler_errors, #in_a_native_bundler_context, #inaccessible_git_dependencies, #jfrog_source, #private_registry_credentials, #retryable_error?, #write_temporary_dependency_files

Constructor Details

#initialize(dependency:, unprepared_dependency_files:, credentials:, ignored_versions:, options:, repo_contents_path: nil, raise_on_ignored: false, replacement_git_pin: nil, remove_git_source: false, unlock_requirement: true, latest_allowable_version: nil, cooldown_options: nil) ⇒ VersionResolver

Returns a new instance of VersionResolver.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/dependabot/bundler/update_checker/version_resolver.rb', line 42

def initialize(
  dependency:,
  unprepared_dependency_files:,
  credentials:,
  ignored_versions:,
  options:,
  repo_contents_path: nil,
  raise_on_ignored: false,
  replacement_git_pin: nil,
  remove_git_source: false,
  unlock_requirement: true,
  latest_allowable_version: nil,
  cooldown_options: nil
)
  @dependency                  = dependency
  @unprepared_dependency_files = unprepared_dependency_files
  @credentials                 = credentials
  @repo_contents_path          = repo_contents_path
  @ignored_versions            = ignored_versions
  @raise_on_ignored            = raise_on_ignored
  @replacement_git_pin         = replacement_git_pin
  @remove_git_source           = remove_git_source
  @unlock_requirement          = unlock_requirement
  @latest_allowable_version    = latest_allowable_version
  @cooldown_options            = cooldown_options
  @options                     = options

  @latest_allowable_version_incompatible_with_ruby = T.let(false, T::Boolean)
  @latest_resolvable_version_details = T.let(nil, T.nilable(T::Hash[Symbol, T.untyped]))
  @dependency_files = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile]))
  @latest_version_details = T.let(nil, T.nilable(T::Hash[Symbol, T.untyped]))
  @gemspec_ruby_unlocked = T.let(false, T::Boolean)
  @bundler_version = T.let(nil, T.nilable(String))
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



109
110
111
# File 'lib/dependabot/bundler/update_checker/version_resolver.rb', line 109

def credentials
  @credentials
end

#optionsObject (readonly)

Returns the value of attribute options.



90
91
92
# File 'lib/dependabot/bundler/update_checker/version_resolver.rb', line 90

def options
  @options
end

#repo_contents_pathObject (readonly)

Returns the value of attribute repo_contents_path.



106
107
108
# File 'lib/dependabot/bundler/update_checker/version_resolver.rb', line 106

def repo_contents_path
  @repo_contents_path
end

Instance Method Details

#dependency_filesObject



93
94
95
96
97
98
99
100
101
102
103
# File 'lib/dependabot/bundler/update_checker/version_resolver.rb', line 93

def dependency_files
  @dependency_files ||=
    FilePreparer.new(
      dependency: dependency,
      dependency_files: unprepared_dependency_files,
      replacement_git_pin: replacement_git_pin,
      remove_git_source: remove_git_source?,
      unlock_requirement: unlock_requirement?,
      latest_allowable_version: latest_allowable_version
    ).prepared_dependency_files
end

#latest_allowable_version_incompatible_with_ruby?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/dependabot/bundler/update_checker/version_resolver.rb', line 84

def latest_allowable_version_incompatible_with_ruby?
  @latest_allowable_version_incompatible_with_ruby
end

#latest_resolvable_version_detailsObject



78
79
80
81
# File 'lib/dependabot/bundler/update_checker/version_resolver.rb', line 78

def latest_resolvable_version_details
  @latest_resolvable_version_details ||=
    fetch_latest_resolvable_version_details
end