Class: Dependabot::Bun::UpdateChecker::SubdependencyVersionResolver
- Inherits:
-
Object
- Object
- Dependabot::Bun::UpdateChecker::SubdependencyVersionResolver
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/bun/update_checker/subdependency_version_resolver.rb
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.
-
#ignored_versions ⇒ Object
readonly
Returns the value of attribute ignored_versions.
-
#latest_allowable_version ⇒ Object
readonly
Returns the value of attribute latest_allowable_version.
-
#repo_contents_path ⇒ Object
readonly
Returns the value of attribute repo_contents_path.
Instance Method Summary collapse
-
#initialize(dependency:, credentials:, dependency_files:, ignored_versions:, latest_allowable_version:, repo_contents_path:) ⇒ SubdependencyVersionResolver
constructor
A new instance of SubdependencyVersionResolver.
- #latest_resolvable_version ⇒ Object
Constructor Details
#initialize(dependency:, credentials:, dependency_files:, ignored_versions:, latest_allowable_version:, repo_contents_path:) ⇒ SubdependencyVersionResolver
Returns a new instance of SubdependencyVersionResolver.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/dependabot/bun/update_checker/subdependency_version_resolver.rb', line 52 def initialize( dependency:, credentials:, dependency_files:, ignored_versions:, latest_allowable_version:, repo_contents_path: ) @dependency = dependency @credentials = credentials @dependency_files = dependency_files @ignored_versions = ignored_versions @latest_allowable_version = latest_allowable_version @repo_contents_path = repo_contents_path end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
28 29 30 |
# File 'lib/dependabot/bun/update_checker/subdependency_version_resolver.rb', line 28 def credentials @credentials end |
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
25 26 27 |
# File 'lib/dependabot/bun/update_checker/subdependency_version_resolver.rb', line 25 def dependency @dependency end |
#dependency_files ⇒ Object (readonly)
Returns the value of attribute dependency_files.
31 32 33 |
# File 'lib/dependabot/bun/update_checker/subdependency_version_resolver.rb', line 31 def dependency_files @dependency_files end |
#ignored_versions ⇒ Object (readonly)
Returns the value of attribute ignored_versions.
34 35 36 |
# File 'lib/dependabot/bun/update_checker/subdependency_version_resolver.rb', line 34 def ignored_versions @ignored_versions end |
#latest_allowable_version ⇒ Object (readonly)
Returns the value of attribute latest_allowable_version.
37 38 39 |
# File 'lib/dependabot/bun/update_checker/subdependency_version_resolver.rb', line 37 def latest_allowable_version @latest_allowable_version end |
#repo_contents_path ⇒ Object (readonly)
Returns the value of attribute repo_contents_path.
40 41 42 |
# File 'lib/dependabot/bun/update_checker/subdependency_version_resolver.rb', line 40 def repo_contents_path @repo_contents_path end |
Instance Method Details
#latest_resolvable_version ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/dependabot/bun/update_checker/subdependency_version_resolver.rb', line 69 def latest_resolvable_version raise "Not a subdependency!" if dependency.requirements.any? return if bundled_dependency? base_dir = T.must(dependency_files.first).directory SharedHelpers.in_a_temporary_repo_directory(base_dir, repo_contents_path) do dependency_files_builder.write_temporary_dependency_files updated_lockfiles = filtered_lockfiles.map do |lockfile| updated_content = update_subdependency_in_lockfile(lockfile) updated_lockfile = lockfile.dup updated_lockfile.content = updated_content updated_lockfile end version_from_updated_lockfiles(updated_lockfiles) end rescue SharedHelpers::HelperSubprocessFailed # TODO: Move error handling logic from the FileUpdater to this class # Return nil (no update possible) if an unknown error occurred nil end |