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

Inherits:
Object
  • Object
show all
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

Attributes included from SharedBundlerHelpers

#credentials, #dependency_files, #repo_contents_path

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?, #sanitized_lockfile_body, #using_bundler2?, #write_temporary_dependency_files

Constructor Details

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

Returns a new instance of ConflictingDependencyResolver.


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

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

#optionsObject (readonly)

Returns the value of attribute options


15
16
17
# File 'lib/dependabot/bundler/update_checker/conflicting_dependency_resolver.rb', line 15

def options
  @options
end

Instance Method Details

#conflicting_dependencies(dependency:, target_version:) ⇒ Array<Hash{String => String}] * name [String] the blocking dependencies name * version [String] the version of the blocking dependency * requirement [String] the requirement on the target_dependency

Finds any dependencies in the lockfile that have a subdependency on the given dependency that does not satisfly the target_version.

Parameters:

  • dependency (Dependabot::Dependency)

    the dependency to check

  • target_version (String)

    the version to check

Returns:

  • (Array<Hash{String => String}] * name [String] the blocking dependencies name * version [String] the version of the blocking dependency * requirement [String] the requirement on the target_dependency)

    Array<Hash=> String]

    • name [String] the blocking dependencies name

    • version [String] the version of the blocking dependency

    • requirement [String] the requirement on the target_dependency


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/dependabot/bundler/update_checker/conflicting_dependency_resolver.rb', line 33

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