Class: Dependabot::Bundler::UpdateChecker::ConflictingDependencyResolver

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
SharedBundlerHelpers
Defined in:
lib/dependabot/bundler/update_checker/conflicting_dependency_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, #gemfile, #handle_bundler_errors, #in_a_native_bundler_context, #inaccessible_git_dependencies, #jfrog_source, #lockfile, #private_registry_credentials, #retryable_error?, #write_temporary_dependency_files

Constructor Details

#initialize(dependency_files:, repo_contents_path:, credentials:, options:) ⇒ ConflictingDependencyResolver

Returns a new instance of ConflictingDependencyResolver.



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

def initialize(dependency_files:, repo_contents_path:, credentials:, options:)
  @dependency_files = dependency_files
  @repo_contents_path = repo_contents_path
  @credentials = credentials
  @options = options
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



23
24
25
# File 'lib/dependabot/bundler/update_checker/conflicting_dependency_resolver.rb', line 23

def credentials
  @credentials
end

#dependency_filesObject (readonly)

Returns the value of attribute dependency_files.



26
27
28
# File 'lib/dependabot/bundler/update_checker/conflicting_dependency_resolver.rb', line 26

def dependency_files
  @dependency_files
end

#optionsObject (readonly)

Returns the value of attribute options.



20
21
22
# File 'lib/dependabot/bundler/update_checker/conflicting_dependency_resolver.rb', line 20

def options
  @options
end

#repo_contents_pathObject (readonly)

Returns the value of attribute repo_contents_path.



29
30
31
# File 'lib/dependabot/bundler/update_checker/conflicting_dependency_resolver.rb', line 29

def repo_contents_path
  @repo_contents_path
end

Instance Method Details

#conflicting_dependencies(dependency:, target_version:) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/dependabot/bundler/update_checker/conflicting_dependency_resolver.rb', line 63

def conflicting_dependencies(dependency:, target_version:)
  return [] if lockfile.nil?

  in_a_native_bundler_context(error_handling: false) do |tmp_dir|
    NativeHelpers.run_bundler_subprocess(
      bundler_version: bundler_version,
      function: "conflicting_dependencies",
      options: options,
      args: {
        dir: tmp_dir,
        dependency_name: dependency.name,
        target_version: target_version,
        credentials: credentials,
        lockfile_name: T.must(lockfile).name
      }
    )
  end
end