Class: Dependabot::Bundler::FileFetcher::PathGemspecFinder

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

Overview

Finds the paths of any gemspecs declared using ‘path: ` in the passed Gemfile.

Instance Method Summary collapse

Constructor Details

#initialize(gemfile:) ⇒ PathGemspecFinder

Returns a new instance of PathGemspecFinder.



19
20
21
# File 'lib/dependabot/bundler/file_fetcher/path_gemspec_finder.rb', line 19

def initialize(gemfile:)
  @gemfile = gemfile
end

Instance Method Details

#path_gemspec_pathsObject



24
25
26
27
28
29
# File 'lib/dependabot/bundler/file_fetcher/path_gemspec_finder.rb', line 24

def path_gemspec_paths
  ast = Parser::CurrentRuby.parse(gemfile&.content)
  find_path_gemspec_paths(ast)
rescue Parser::SyntaxError
  raise Dependabot::DependencyFileNotParseable, T.must(gemfile).path
end