Class: Dependabot::Opentofu::FileUpdater
- Inherits:
-
FileUpdaters::Base
- Object
- FileUpdaters::Base
- Dependabot::Opentofu::FileUpdater
- Extended by:
- T::Sig
- Includes:
- FileSelector
- Defined in:
- lib/dependabot/opentofu/file_updater.rb
Constant Summary collapse
- PRIVATE_MODULE_ERROR =
/Could not download module.*code from\n.*\"(?<repo>\S+)\":/- MODULE_NOT_INSTALLED_ERROR =
/Module not installed.*module\s*\"(?<mod>\S+)\"/m- GIT_HTTPS_PREFIX =
%r{^git::https://}
Constants included from FileSelector
Dependabot::Opentofu::FileSelector::OVERRIDE_TF_EXTENSION, Dependabot::Opentofu::FileSelector::OVERRIDE_TOFU_EXTENSION, Dependabot::Opentofu::FileSelector::TF_EXTENSION, Dependabot::Opentofu::FileSelector::TOFU_EXTENSION
Instance Method Summary collapse
Methods included from FileSelector
Instance Method Details
#updated_dependency_files ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/dependabot/opentofu/file_updater.rb', line 24 def updated_dependency_files updated_files = [] [*opentofu_files, *terragrunt_files].each do |file| next unless file_changed?(file) updated_content = updated_opentofu_file_content(file) raise "Content didn't change!" if updated_content == file.content updated_file = updated_file(file: file, content: updated_content) updated_files << updated_file unless updated_files.include?(updated_file) end updated_lockfile_content = update_lockfile_declaration(updated_files) if updated_lockfile_content && T.must(lockfile).content != updated_lockfile_content updated_files << updated_file(file: T.must(lockfile), content: updated_lockfile_content) end updated_files.compact! raise "No files changed!" if updated_files.none? updated_files end |