Class: Dependabot::Bazel::FileFetcher::ModulePathExtractor

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/bazel/file_fetcher/module_path_extractor.rb

Overview

Extracts file and directory paths referenced in MODULE.bazel files. Handles attributes like lock_file, requirements_lock, patches, from_file, and local_path_override.

Instance Method Summary collapse

Constructor Details

#initialize(module_file:) ⇒ ModulePathExtractor

Returns a new instance of ModulePathExtractor.



17
18
19
# File 'lib/dependabot/bazel/file_fetcher/module_path_extractor.rb', line 17

def initialize(module_file:)
  @module_file = module_file
end

Instance Method Details

#extract_pathsObject



22
23
24
25
26
27
# File 'lib/dependabot/bazel/file_fetcher/module_path_extractor.rb', line 22

def extract_paths
  content = T.must(@module_file.content)
  file_paths = extract_file_attribute_paths(content)
  directory_paths = extract_directory_paths(content)
  [file_paths.uniq, directory_paths.uniq]
end