class Dependabot::Cargo::FileUpdater
Public Class Methods
updated_files_regex()
click to toggle source
# File lib/dependabot/cargo/file_updater.rb, line 15 def self.updated_files_regex [ /^Cargo\.toml$/, /^Cargo\.lock$/ ] end
Public Instance Methods
updated_dependency_files()
click to toggle source
# File lib/dependabot/cargo/file_updater.rb, line 22 def updated_dependency_files # Returns an array of updated files. Only files that have been updated # should be returned. updated_files = [] manifest_files.each do |file| next unless file_changed?(file) updated_files << updated_file( file: file, content: updated_manifest_content(file) ) end if lockfile && updated_lockfile_content != lockfile.content updated_files << updated_file(file: lockfile, content: updated_lockfile_content) end raise "No files changed!" if updated_files.empty? updated_files end
Private Instance Methods
check_required_files()
click to toggle source
# File lib/dependabot/cargo/file_updater.rb, line 49 def check_required_files raise "No Cargo.toml!" unless get_original_file("Cargo.toml") end
lockfile()
click to toggle source
# File lib/dependabot/cargo/file_updater.rb, line 76 def lockfile @lockfile ||= get_original_file("Cargo.lock") end
manifest_files()
click to toggle source
# File lib/dependabot/cargo/file_updater.rb, line 69 def manifest_files @manifest_files ||= dependency_files. select { |f| f.name.end_with?("Cargo.toml") }. reject(&:support_file?) end
updated_lockfile_content()
click to toggle source
# File lib/dependabot/cargo/file_updater.rb, line 60 def updated_lockfile_content @updated_lockfile_content ||= LockfileUpdater.new( dependencies: dependencies, dependency_files: dependency_files, credentials: credentials ).updated_lockfile_content end
updated_manifest_content(file)
click to toggle source
# File lib/dependabot/cargo/file_updater.rb, line 53 def updated_manifest_content(file) ManifestUpdater.new( dependencies: dependencies, manifest: file ).updated_manifest_content end