Class: Dependabot::Nuget::RepositoryFinder
- Inherits:
-
Object
- Object
- Dependabot::Nuget::RepositoryFinder
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/nuget/update_checker/repository_finder.rb
Constant Summary collapse
- DEFAULT_REPOSITORY_URL =
"https://api.nuget.org/v3/index.json"
- DEFAULT_REPOSITORY_API_KEY =
"nuget.org"
Class Method Summary collapse
Instance Method Summary collapse
- #dependency_urls ⇒ Object
-
#initialize(dependency:, credentials:, config_files: []) ⇒ RepositoryFinder
constructor
A new instance of RepositoryFinder.
- #known_repositories ⇒ Object
Constructor Details
#initialize(dependency:, credentials:, config_files: []) ⇒ RepositoryFinder
Returns a new instance of RepositoryFinder.
29 30 31 32 33 |
# File 'lib/dependabot/nuget/update_checker/repository_finder.rb', line 29 def initialize(dependency:, credentials:, config_files: []) @dependency = dependency @credentials = credentials @config_files = config_files end |
Class Method Details
.get_default_repository_details(dependency_name) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/dependabot/nuget/update_checker/repository_finder.rb', line 57 def self.get_default_repository_details(dependency_name) { base_url: "https://api.nuget.org/v3-flatcontainer/", registration_url: "https://api.nuget.org/v3/registration5-gz-semver2/#{dependency_name.downcase}/index.json", repository_url: DEFAULT_REPOSITORY_URL, versions_url: "https://api.nuget.org/v3-flatcontainer/" \ "#{dependency_name.downcase}/index.json", search_url: "https://azuresearch-usnc.nuget.org/query" \ "?q=#{dependency_name.downcase}&prerelease=true&semVerLevel=2.0.0", auth_header: {}, repository_type: "v3" } end |
Instance Method Details
#dependency_urls ⇒ Object
36 37 38 |
# File 'lib/dependabot/nuget/update_checker/repository_finder.rb', line 36 def dependency_urls find_dependency_urls end |
#known_repositories ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/dependabot/nuget/update_checker/repository_finder.rb', line 41 def known_repositories return @known_repositories if @known_repositories @known_repositories ||= T.let([], T.nilable(T::Array[T::Hash[Symbol, String]])) @known_repositories += credential_repositories @known_repositories += config_file_repositories @known_repositories << { url: DEFAULT_REPOSITORY_URL, token: nil } if @known_repositories.empty? @known_repositories = @known_repositories.map do |repo| { url: URI::DEFAULT_PARSER.escape(repo[:url]), token: repo[:token] } end @known_repositories.uniq end |