Class: Dependabot::Sbt::FileParser::RepositoriesFinder
- Inherits:
-
Object
- Object
- Dependabot::Sbt::FileParser::RepositoriesFinder
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/sbt/file_parser/repositories_finder.rb
Constant Summary collapse
- CENTRAL_REPO_URL =
"https://repo.maven.apache.org/maven2"- RESOLVER_AT_REGEX =
Matches: resolvers += “Name” at “url”
T.let( /resolvers\s*\+?=\s*(?:Seq\s*\()?\s*"[^"]*"\s+at\s+"(?<url>[^"]+)"/, Regexp )
- RESOLVER_SEQ_AT_REGEX =
Matches: resolvers ++= Seq(“Name” at “url”, …)
T.let( /"[^"]*"\s+at\s+"(?<url>[^"]+)"/, Regexp )
- RESOLVER_URL_REGEX =
Matches: Resolver.url(“name”, url(“url”))
T.let( /Resolver\.url\(\s*"[^"]*"\s*,\s*url\(\s*"(?<url>[^"]+)"\s*\)/, Regexp )
- MAVEN_REPOSITORY_REGEX =
Matches: MavenRepository(“name”, “url”)
T.let( /MavenRepository\(\s*"[^"]*"\s*,\s*"(?<url>[^"]+)"\s*\)/, Regexp )
Instance Method Summary collapse
-
#initialize(dependency_files:, credentials: []) ⇒ RepositoriesFinder
constructor
A new instance of RepositoriesFinder.
- #repository_urls ⇒ Object
Constructor Details
#initialize(dependency_files:, credentials: []) ⇒ RepositoriesFinder
Returns a new instance of RepositoriesFinder.
46 47 48 49 |
# File 'lib/dependabot/sbt/file_parser/repositories_finder.rb', line 46 def initialize(dependency_files:, credentials: []) @dependency_files = T.let(dependency_files, T::Array[Dependabot::DependencyFile]) @credentials = T.let(credentials, T::Array[Dependabot::Credential]) end |
Instance Method Details
#repository_urls ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/dependabot/sbt/file_parser/repositories_finder.rb', line 52 def repository_urls urls = T.let([], T::Array[String]) sbt_files.each do |file| urls += repository_urls_from(file) end # SBT always includes Maven Central as a default resolver. # Custom resolvers supplement but don't replace it. urls << central_repo_url unless urls.include?(central_repo_url) urls.uniq end |