Class: Dependabot::Cargo::FileUpdater::LockfileUpdater
- Inherits:
-
Object
- Object
- Dependabot::Cargo::FileUpdater::LockfileUpdater
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/cargo/file_updater/lockfile_updater.rb
Overview
rubocop:disable Metrics/ClassLength
Constant Summary collapse
- LOCKFILE_ENTRY_REGEX =
/ \[\[package\]\]\n (?:(?!^\[(?:\[package|metadata)).)+ /mx- LOCKFILE_CHECKSUM_REGEX =
/^"checksum .*$/
Instance Method Summary collapse
-
#initialize(dependencies:, dependency_files:, credentials:) ⇒ LockfileUpdater
constructor
A new instance of LockfileUpdater.
- #updated_lockfile_content ⇒ Object
Constructor Details
#initialize(dependencies:, dependency_files:, credentials:) ⇒ LockfileUpdater
Returns a new instance of LockfileUpdater.
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/dependabot/cargo/file_updater/lockfile_updater.rb', line 34 def initialize(dependencies:, dependency_files:, credentials:) @dependencies = T.let(dependencies, T::Array[Dependabot::Dependency]) @dependency_files = T.let(dependency_files, T::Array[Dependabot::DependencyFile]) @credentials = T.let(credentials, T::Array[Dependabot::Credential]) @custom_specifications = T.let({}, T::Hash[String, String]) @current_dependency = T.let(nil, T.nilable(Dependabot::Dependency)) @git_ssh_requirements_to_swap = T.let(nil, T.nilable(T::Hash[String, String])) @manifest_files = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile])) @path_dependency_files = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile])) @lockfile = T.let(nil, T.nilable(Dependabot::DependencyFile)) @toolchain = T.let(nil, T.nilable(Dependabot::DependencyFile)) @config_files = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile])) end |
Instance Method Details
#updated_lockfile_content ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/dependabot/cargo/file_updater/lockfile_updater.rb', line 49 def updated_lockfile_content base_directory = T.must(dependency_files.first).directory SharedHelpers.in_a_temporary_directory(base_directory) do write_temporary_dependency_files run_updates updated_lockfile = File.read("Cargo.lock") updated_lockfile = post_process_lockfile(updated_lockfile) validate_updates(updated_lockfile) end rescue Dependabot::SharedHelpers::HelperSubprocessFailed => e retry if better_specification_needed?(e) handle_cargo_error(e) end |