Class: Dependabot::Python::PipenvRunner
- Inherits:
-
Object
- Object
- Dependabot::Python::PipenvRunner
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/python/pipenv_runner.rb
Instance Method Summary collapse
-
#initialize(dependency:, lockfile:, language_version_manager:) ⇒ PipenvRunner
constructor
A new instance of PipenvRunner.
- #run(command, fingerprint: nil) ⇒ Object
- #run_upgrade(constraint) ⇒ Object
- #run_upgrade_and_fetch_version(constraint) ⇒ Object
Constructor Details
#initialize(dependency:, lockfile:, language_version_manager:) ⇒ PipenvRunner
Returns a new instance of PipenvRunner.
22 23 24 25 26 |
# File 'lib/dependabot/python/pipenv_runner.rb', line 22 def initialize(dependency:, lockfile:, language_version_manager:) @dependency = dependency @lockfile = lockfile @language_version_manager = language_version_manager end |
Instance Method Details
#run(command, fingerprint: nil) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/dependabot/python/pipenv_runner.rb', line 52 def run(command, fingerprint: nil) run_command( "pyenv local #{language_version_manager.python_major_minor}", fingerprint: "pyenv local <python_major_minor>" ) run_command(command, fingerprint: fingerprint) end |
#run_upgrade(constraint) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/dependabot/python/pipenv_runner.rb', line 29 def run_upgrade(constraint) constraint = "" if constraint == "*" # Build the full package specification with extras extras_spec = extras_specification package_spec = "#{dependency_name}#{extras_spec}#{constraint}" command = "pyenv exec pipenv upgrade --verbose #{package_spec}" command << " --dev" if lockfile_section == "develop" run(command, fingerprint: "pyenv exec pipenv upgrade --verbose <dependency_name><extras><constraint>") end |
#run_upgrade_and_fetch_version(constraint) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/dependabot/python/pipenv_runner.rb', line 43 def run_upgrade_and_fetch_version(constraint) run_upgrade(constraint) updated_lockfile = JSON.parse(File.read("Pipfile.lock")) fetch_version_from_parsed_lockfile(updated_lockfile) end |