Class: Dependabot::Bundler::FileFetcher::ChildGemfileFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/bundler/file_fetcher/child_gemfile_finder.rb

Overview

Finds the paths of any Gemfiles declared using `eval_gemfile` in the passed Gemfile.

Instance Method Summary collapse

Constructor Details

#initialize(gemfile:) ⇒ ChildGemfileFinder

Returns a new instance of ChildGemfileFinder.


14
15
16
# File 'lib/dependabot/bundler/file_fetcher/child_gemfile_finder.rb', line 14

def initialize(gemfile:)
  @gemfile = gemfile
end

Instance Method Details

#child_gemfile_pathsObject


18
19
20
21
22
23
# File 'lib/dependabot/bundler/file_fetcher/child_gemfile_finder.rb', line 18

def child_gemfile_paths
  ast = Parser::CurrentRuby.parse(gemfile.content)
  find_child_gemfile_paths(ast)
rescue Parser::SyntaxError
  raise Dependabot::DependencyFileNotParseable, gemfile.path
end