Class: Dependabot::Bazel::FileUpdater::WorkspaceFileUpdater

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

Instance Method Summary collapse

Constructor Details

#initialize(dependency_files:, dependencies:, credentials:) ⇒ WorkspaceFileUpdater

Returns a new instance of WorkspaceFileUpdater.



19
20
21
22
23
# File 'lib/dependabot/bazel/file_updater/workspace_file_updater.rb', line 19

def initialize(dependency_files:, dependencies:, credentials:)
  @dependency_files = dependency_files
  @dependencies = dependencies
  @credentials = credentials
end

Instance Method Details

#updated_workspace_filesObject



26
27
28
29
30
31
32
33
# File 'lib/dependabot/bazel/file_updater/workspace_file_updater.rb', line 26

def updated_workspace_files
  workspace_files.filter_map do |file|
    updated_content = update_file_content(file)
    next if updated_content == T.must(file.content)

    file.dup.tap { |f| f.content = updated_content }
  end
end