Class: Dependabot::Python::UpdateChecker::PipCompileVersionResolver
- Inherits:
-
Object
- Object
- Dependabot::Python::UpdateChecker::PipCompileVersionResolver
- Defined in:
- lib/dependabot/python/update_checker/pip_compile_version_resolver.rb
Overview
This class does version resolution for pip-compile. Its approach is:
-
Unlock the dependency we’re checking in the requirements.in file
-
Run ‘pip-compile` and see what the result is
rubocop:disable Metrics/ClassLength
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.
Instance Method Summary collapse
-
#initialize(dependency:, dependency_files:, credentials:) ⇒ PipCompileVersionResolver
constructor
A new instance of PipCompileVersionResolver.
- #latest_resolvable_version(requirement: nil) ⇒ Object
- #resolvable?(version:) ⇒ Boolean
Constructor Details
#initialize(dependency:, dependency_files:, credentials:) ⇒ PipCompileVersionResolver
Returns a new instance of PipCompileVersionResolver.
25 26 27 28 29 |
# File 'lib/dependabot/python/update_checker/pip_compile_version_resolver.rb', line 25 def initialize(dependency:, dependency_files:, credentials:) @dependency = dependency @dependency_files = dependency_files @credentials = credentials end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
23 24 25 |
# File 'lib/dependabot/python/update_checker/pip_compile_version_resolver.rb', line 23 def credentials @credentials end |
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
23 24 25 |
# File 'lib/dependabot/python/update_checker/pip_compile_version_resolver.rb', line 23 def dependency @dependency end |
#dependency_files ⇒ Object (readonly)
Returns the value of attribute dependency_files.
23 24 25 |
# File 'lib/dependabot/python/update_checker/pip_compile_version_resolver.rb', line 23 def dependency_files @dependency_files end |
Instance Method Details
#latest_resolvable_version(requirement: nil) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/dependabot/python/update_checker/pip_compile_version_resolver.rb', line 31 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
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/dependabot/python/update_checker/pip_compile_version_resolver.rb', line 38 def resolvable?(version:) @resolvable ||= {} return @resolvable[version] if @resolvable.key?(version) if fetch_latest_resolvable_version_string(requirement: "==#{version}") @resolvable[version] = true else @resolvable[version] = false end end |