Class: Dependabot::Hex::UpdateChecker::FilePreparer

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/hex/update_checker/file_preparer.rb

Overview

This class takes a set of dependency files and sanitizes them for use in UpdateCheckers::Elixir::Hex.

Instance Method Summary collapse

Constructor Details

#initialize(dependency_files:, dependency:, unlock_requirement: true, replacement_git_pin: nil, latest_allowable_version: nil) ⇒ FilePreparer

Returns a new instance of FilePreparer.



21
22
23
24
25
26
27
28
29
30
# File 'lib/dependabot/hex/update_checker/file_preparer.rb', line 21

def initialize(dependency_files:, dependency:,
               unlock_requirement: true,
               replacement_git_pin: nil,
               latest_allowable_version: nil)
  @dependency_files = dependency_files
  @dependency = dependency
  @unlock_requirement = unlock_requirement
  @replacement_git_pin = replacement_git_pin
  @latest_allowable_version = latest_allowable_version
end

Instance Method Details

#prepared_dependency_filesObject



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/dependabot/hex/update_checker/file_preparer.rb', line 32

def prepared_dependency_files
  files = []
  files += mixfiles.map do |file|
    DependencyFile.new(
      name: file.name,
      content: mixfile_content_for_update_check(file),
      directory: file.directory
    )
  end
  files << lockfile if lockfile
  files += support_files
  files
end