Class: Dependabot::Bundler::FileParser::FilePreparer

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/bundler/file_parser/file_preparer.rb

Instance Method Summary collapse

Constructor Details

#initialize(dependency_files:) ⇒ FilePreparer

Returns a new instance of FilePreparer.


11
12
13
# File 'lib/dependabot/bundler/file_parser/file_preparer.rb', line 11

def initialize(dependency_files:)
  @dependency_files = dependency_files
end

Instance Method Details

#prepared_dependency_filesObject


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/dependabot/bundler/file_parser/file_preparer.rb', line 15

def prepared_dependency_files
  files = []

  gemspecs.compact.each do |file|
    files << DependencyFile.new(
      name: file.name,
      content: sanitize_gemspec_content(file.content),
      directory: file.directory,
      support_file: file.support_file?
    )
  end

  files += [
    gemfile,
    *evaled_gemfiles,
    lockfile,
    ruby_version_file,
    *imported_ruby_files,
    *specification_files
  ].compact
end