Class: Dependabot::Docker::FileUpdater
- Inherits:
-
FileUpdaters::Base
- Object
- FileUpdaters::Base
- Dependabot::Docker::FileUpdater
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/docker/file_updater.rb
Constant Summary collapse
- FROM_REGEX =
/FROM(\s+--platform\=\S+)?/i
- YAML_REGEXP =
/^[^\.].*\.ya?ml$/i
- DOCKER_REGEXP =
/dockerfile/i
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.updated_files_regex ⇒ Object
21 22 23 24 25 26 |
# File 'lib/dependabot/docker/file_updater.rb', line 21 def self.updated_files_regex [ DOCKER_REGEXP, YAML_REGEXP ] end |
Instance Method Details
#updated_dependency_files ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/dependabot/docker/file_updater.rb', line 29 def updated_dependency_files updated_files = [] dependency_files.each do |file| next unless requirement_changed?(file, T.must(dependency)) updated_files << if file.name.match?(YAML_REGEXP) updated_file( file: file, content: T.must(updated_yaml_content(file)) ) else updated_file( file: file, content: 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 |