Class: Dependabot::Bundler::UpdateChecker::LatestVersionFinder::DependencySource
- Inherits:
-
Object
- Object
- Dependabot::Bundler::UpdateChecker::LatestVersionFinder::DependencySource
- Extended by:
- T::Sig
- Includes:
- SharedBundlerHelpers
- Defined in:
- lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb
Constant Summary collapse
- RUBYGEMS =
"rubygems"
- PRIVATE_REGISTRY =
"private"
- GIT =
"git"
- OTHER =
"other"
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
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#dependency ⇒ Object
readonly
Returns the value of attribute dependency.
-
#dependency_files ⇒ Object
readonly
Returns the value of attribute dependency_files.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#repo_contents_path ⇒ Object
readonly
Returns the value of attribute repo_contents_path.
Instance Method Summary collapse
- #git? ⇒ Boolean
-
#initialize(dependency:, dependency_files:, credentials:, options:) ⇒ DependencySource
constructor
A new instance of DependencySource.
-
#latest_git_version_details ⇒ Hash{Symbol => String}?
The latest version details for the dependency from a git repo.
- #versions ⇒ Object
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:, dependency_files:, credentials:, options:) ⇒ DependencySource
Returns a new instance of DependencySource.
30 31 32 33 34 35 36 37 38 |
# File 'lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb', line 30 def initialize(dependency:, dependency_files:, credentials:, options:) @dependency = dependency @dependency_files = dependency_files @credentials = credentials @options = end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
27 28 29 |
# File 'lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb', line 27 def credentials @credentials end |
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
24 25 26 |
# File 'lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb', line 24 def dependency @dependency end |
#dependency_files ⇒ Object (readonly)
Returns the value of attribute dependency_files.
25 26 27 |
# File 'lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb', line 25 def dependency_files @dependency_files end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
28 29 30 |
# File 'lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb', line 28 def @options end |
#repo_contents_path ⇒ Object (readonly)
Returns the value of attribute repo_contents_path.
26 27 28 |
# File 'lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb', line 26 def repo_contents_path @repo_contents_path end |
Instance Method Details
#git? ⇒ Boolean
86 87 88 |
# File 'lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb', line 86 def git? source_type == GIT end |
#latest_git_version_details ⇒ Hash{Symbol => String}?
The latest version details for the dependency from a git repo
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb', line 60 def latest_git_version_details return unless git? source_details = dependency.requirements.map { |r| r.fetch(:source) } .uniq.compact.first SharedHelpers.with_git_configured(credentials: credentials) do in_a_native_bundler_context do |tmp_dir| NativeHelpers.run_bundler_subprocess( bundler_version: bundler_version, function: "dependency_source_latest_git_version", options: , args: { dir: tmp_dir, gemfile_name: gemfile.name, dependency_name: dependency.name, credentials: credentials, dependency_source_url: source_details[:url], dependency_source_branch: source_details[:branch] } ) end end.transform_keys(&:to_sym) end |
#versions ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb', line 43 def versions return rubygems_versions if dependency.name == "bundler" return rubygems_versions unless gemfile case source_type when OTHER, GIT [] when PRIVATE_REGISTRY private_registry_versions else rubygems_versions end end |