Class: Dependabot::Opentofu::FileFetcher
- Inherits:
-
FileFetchers::Base
- Object
- FileFetchers::Base
- Dependabot::Opentofu::FileFetcher
- Extended by:
- T::Helpers, T::Sig
- Includes:
- FileFilter
- Defined in:
- lib/dependabot/opentofu/file_fetcher.rb
Constant Summary collapse
- LOCAL_PATH_SOURCE =
%r{source\s*=\s*['"](?<path>..?\/[^'"]+)}
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.required_files_in?(filenames) ⇒ Boolean
23 24 25 |
# File 'lib/dependabot/opentofu/file_fetcher.rb', line 23 def self.required_files_in?(filenames) filenames.any? { |f| f.end_with?(".tf", ".tofu", ".hcl") } end |
.required_files_message ⇒ Object
28 29 30 |
# File 'lib/dependabot/opentofu/file_fetcher.rb', line 28 def self. "Repo must contain a OpenTofu configuration file." end |
Instance Method Details
#fetch_files ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/dependabot/opentofu/file_fetcher.rb', line 33 def fetch_files unless allow_beta_ecosystems? raise Dependabot::DependencyFileNotFound.new( nil, "OpenTofu support is currently in beta. Set ALLOW_BETA_ECOSYSTEMS=true to enable it." ) end fetched_files = [] fetched_files += opentofu_files fetched_files += terragrunt_files fetched_files += local_path_module_files(opentofu_files) fetched_files += [lockfile] if lockfile filtered_files = fetched_files.compact.reject do |file| Dependabot::FileFiltering.should_exclude_path?(file.name, "file from final collection", @exclude_paths) end filtered_files end |