Class: Dependabot::DockerCompose::FileUpdater
- Inherits:
-
Shared::SharedFileUpdater
- Object
- Shared::SharedFileUpdater
- Dependabot::DockerCompose::FileUpdater
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/dependabot/docker_compose/file_updater.rb
Constant Summary collapse
- YAML_REGEXP =
/(docker-)?compose(?>\.[\w-]+)?\.ya?ml/i- IMAGE_REGEX =
/(?:from|image:\s*)/i
Instance Method Summary collapse
- #build_old_declaration_regex(escaped_declaration) ⇒ Object
- #container_image_regex ⇒ Object
- #file_type ⇒ Object
- #updated_dependency_files ⇒ Object
- #yaml_file_pattern ⇒ Object
Instance Method Details
#build_old_declaration_regex(escaped_declaration) ⇒ Object
31 32 33 |
# File 'lib/dependabot/docker_compose/file_updater.rb', line 31 def build_old_declaration_regex(escaped_declaration) %r{#{IMAGE_REGEX}\s+["']?(?:\$\{[^\}:]+:-)?(docker\.io/)?#{escaped_declaration}(?:\})?["']?(?=\s|$)} end |
#container_image_regex ⇒ Object
26 27 28 |
# File 'lib/dependabot/docker_compose/file_updater.rb', line 26 def container_image_regex IMAGE_REGEX end |
#file_type ⇒ Object
16 17 18 |
# File 'lib/dependabot/docker_compose/file_updater.rb', line 16 def file_type "Docker compose" end |
#updated_dependency_files ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/dependabot/docker_compose/file_updater.rb', line 36 def updated_dependency_files updated_files = [] dependency_files.each do |file| next unless requirement_changed?(file, T.must(dependency)) updated_files << updated_file( file: file, content: T.must(updated_dockerfile_content(file)) ) end updated_files.reject! { |f| dependency_files.include?(f) } raise "No files changed!" if updated_files.none? updated_files end |
#yaml_file_pattern ⇒ Object
21 22 23 |
# File 'lib/dependabot/docker_compose/file_updater.rb', line 21 def yaml_file_pattern YAML_REGEXP end |