Class: Dependabot::Python::UpdateChecker::PoetryVersionResolver
- Inherits:
-
Object
- Object
- Dependabot::Python::UpdateChecker::PoetryVersionResolver
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/dependabot/python/update_checker/poetry_version_resolver.rb
Overview
This class does version resolution for pyproject.toml files.
Constant Summary collapse
- GIT_REFERENCE_NOT_FOUND_REGEX =
/ (Failed to checkout (?<tag>.+?) (?<url>.+?).git at '(?<tag>.+?)' | ...Failedtoclone (?<url>.+?).gitat'(?<tag>.+?)', verifyrefexistsonremote) /x
- GIT_DEPENDENCY_UNREACHABLE_REGEX =
/ \s+Failed\sto\sclone \s+(?<url>.+?), \s+check\syour\sgit\sconfiguration /mx
- INCOMPATIBLE_CONSTRAINTS =
/Incompatible constraints in requirements of (?<dep>.+?) ((?<ver>.+?)):/
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.
-
#error_handler ⇒ Object
readonly
Returns the value of attribute error_handler.
-
#repo_contents_path ⇒ Object
readonly
Returns the value of attribute repo_contents_path.
Instance Method Summary collapse
-
#initialize(dependency:, dependency_files:, credentials:, repo_contents_path:) ⇒ PoetryVersionResolver
constructor
A new instance of PoetryVersionResolver.
- #latest_resolvable_version(requirement: nil) ⇒ Object
- #resolvable?(version:) ⇒ Boolean
Constructor Details
#initialize(dependency:, dependency_files:, credentials:, repo_contents_path:) ⇒ PoetryVersionResolver
Returns a new instance of PoetryVersionResolver.
54 55 56 57 58 59 60 61 |
# File 'lib/dependabot/python/update_checker/poetry_version_resolver.rb', line 54 def initialize(dependency:, dependency_files:, credentials:, repo_contents_path:) @dependency = dependency @dependency_files = dependency_files @credentials = credentials @repo_contents_path = repo_contents_path @error_handler = PoetryErrorHandler.new(dependencies: dependency, dependency_files: dependency_files) end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
48 49 50 |
# File 'lib/dependabot/python/update_checker/poetry_version_resolver.rb', line 48 def credentials @credentials end |
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
46 47 48 |
# File 'lib/dependabot/python/update_checker/poetry_version_resolver.rb', line 46 def dependency @dependency end |
#dependency_files ⇒ Object (readonly)
Returns the value of attribute dependency_files.
47 48 49 |
# File 'lib/dependabot/python/update_checker/poetry_version_resolver.rb', line 47 def dependency_files @dependency_files end |
#error_handler ⇒ Object (readonly)
Returns the value of attribute error_handler.
52 53 54 |
# File 'lib/dependabot/python/update_checker/poetry_version_resolver.rb', line 52 def error_handler @error_handler end |
#repo_contents_path ⇒ Object (readonly)
Returns the value of attribute repo_contents_path.
49 50 51 |
# File 'lib/dependabot/python/update_checker/poetry_version_resolver.rb', line 49 def repo_contents_path @repo_contents_path end |
Instance Method Details
#latest_resolvable_version(requirement: nil) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/dependabot/python/update_checker/poetry_version_resolver.rb', line 63 def latest_resolvable_version(requirement: nil) version_string = fetch_latest_resolvable_version_string(requirement: requirement) version_string.nil? ? nil : Python::Version.new(version_string) end |
#resolvable?(version:) ⇒ Boolean
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/dependabot/python/update_checker/poetry_version_resolver.rb', line 70 def resolvable?(version:) @resolvable ||= {} return @resolvable[version] if @resolvable.key?(version) @resolvable[version] = if fetch_latest_resolvable_version_string(requirement: "==#{version}") true else false end rescue SharedHelpers::HelperSubprocessFailed => e raise unless e..include?("version solving failed.") @resolvable[version] = false end |