Class: Dependabot::Shared::SharedFileUpdater

Inherits:
FileUpdaters::Base
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/dependabot/shared/shared_file_updater.rb

Constant Summary collapse

FROM_REGEX =
/FROM(\s+--platform\=\S+)?/i
ImageSource =
T.type_alias do
  T::Hash[Symbol, T.nilable(String)]
end

Instance Method Summary collapse

Instance Method Details

#container_image_regexObject



53
# File 'lib/dependabot/shared/shared_file_updater.rb', line 53

def container_image_regex; end

#updated_dependency_filesObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/dependabot/shared/shared_file_updater.rb', line 25

def updated_dependency_files
  updated_files = T.let([], T::Array[Dependabot::DependencyFile])
  dependency_files.each do |file|
    next unless requirement_changed?(file, T.must(dependency))

    updated_files << if file.name.match?(T.must(yaml_file_pattern))
                       updated_file(
                         file: file,
                         content: T.must(updated_yaml_content(file))
                       )
                     else
                       updated_file(
                         file: file,
                         content: T.must(updated_dockerfile_content(file))
                       )
                     end
  end

  updated_files.reject! { |f| dependency_files.include?(f) }
  raise "No files changed!" if updated_files.none?

  updated_files
end

#yaml_file_patternObject



50
# File 'lib/dependabot/shared/shared_file_updater.rb', line 50

def yaml_file_pattern; end