Class: Dependabot::Python::PipenvRunner
- Inherits:
-
Object
- Object
- Dependabot::Python::PipenvRunner
- 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.
11 12 13 14 15 |
# File 'lib/dependabot/python/pipenv_runner.rb', line 11 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
33 34 35 36 37 38 39 40 |
# File 'lib/dependabot/python/pipenv_runner.rb', line 33 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
17 18 19 20 21 22 23 |
# File 'lib/dependabot/python/pipenv_runner.rb', line 17 def run_upgrade(constraint) constraint = "" if constraint == "*" command = "pyenv exec pipenv upgrade --verbose #{dependency_name}#{constraint}" command << " --dev" if lockfile_section == "develop" run(command, fingerprint: "pyenv exec pipenv upgrade --verbose <dependency_name><constraint>") end |
#run_upgrade_and_fetch_version(constraint) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/dependabot/python/pipenv_runner.rb', line 25 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 |