class Dependabot::Dep::MetadataFinder

Private Instance Methods

declared_source_details() click to toggle source
# File lib/dependabot/dep/metadata_finder.rb, line 44
def declared_source_details
  sources = dependency.requirements.
            map { |r| r.fetch(:source) }.
            uniq.compact

  raise "Multiple sources! #{sources.join(', ')}" if sources.count > 1

  sources.first
end
git_dependency?() click to toggle source
# File lib/dependabot/dep/metadata_finder.rb, line 21
def git_dependency?
  return false unless declared_source_details

  dependency_type =
    declared_source_details.fetch(:type, nil) ||
    declared_source_details.fetch("type")

  dependency_type == "git"
end
look_up_git_dependency_source() click to toggle source
# File lib/dependabot/dep/metadata_finder.rb, line 31
def look_up_git_dependency_source
  specified_url =
    declared_source_details.fetch(:url, nil) ||
    declared_source_details.fetch("url")

  Source.from_url(specified_url)
end
look_up_source() click to toggle source
# File lib/dependabot/dep/metadata_finder.rb, line 12
def look_up_source
  return look_up_git_dependency_source if git_dependency?

  path_str = (specified_source_string || dependency.name)
  url = Dependabot::Dep::PathConverter.
        git_url_for_path_without_go_helper(path_str)
  Source.from_url(url) if url
end
specified_source_string() click to toggle source
# File lib/dependabot/dep/metadata_finder.rb, line 39
def specified_source_string
  declared_source_details&.fetch(:source, nil) ||
    declared_source_details&.fetch("source", nil)
end