Class: Dependabot::Docker::FileUpdater

Inherits:
FileUpdaters::Base
  • Object
show all
Defined in:
lib/dependabot/docker/file_updater.rb

Constant Summary collapse

FROM_REGEX =
/[Ff][Rr][Oo][Mm]/.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.updated_files_regexObject



12
13
14
# File 'lib/dependabot/docker/file_updater.rb', line 12

def self.updated_files_regex
  [/dockerfile/i]
end

Instance Method Details

#updated_dependency_filesObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/dependabot/docker/file_updater.rb', line 16

def updated_dependency_files
  updated_files = []

  dependency_files.each do |file|
    next unless requirement_changed?(file, dependency)

    updated_files <<
      updated_file(
        file: file,
        content: updated_dockerfile_content(file)
      )
  end

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

  updated_files
end