Class: Dependabot::Bundler::FileFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/linguist/file_fetchers/bundler.rb

Instance Method Summary collapse

Instance Method Details

#path_gemspec_pathsObject

Raises:

  • (Dependabot::DependencyFileNotFound)


41
42
43
44
45
46
47
48
49
# File 'lib/dependabot/linguist/file_fetchers/bundler.rb', line 41

def path_gemspec_paths
  swap_bundle_gemfile = ENV.fetch("BUNDLE_GEMFILE", nil)
  repo_dir_gemfile = "#{@repo_contents_path}#{source.directory}/Gemfile"
  ENV["BUNDLE_GEMFILE"] = repo_dir_gemfile
  raise(Dependabot::DependencyFileNotFound, Pathname.new(File.join(directory, "Gemfile")).cleanpath.to_path) unless File.exist?(repo_dir_gemfile)
  result = fetch_path_gemspec_paths.map { |path| Pathname.new(path) }
  ENV["BUNDLE_GEMFILE"] = swap_bundle_gemfile
  result
end