Class: GemChangelogDiff::UriResolver
- Inherits:
-
Object
- Object
- GemChangelogDiff::UriResolver
- Defined in:
- lib/gem_changelog_diff/uri_resolver.rb
Constant Summary collapse
- GITHUB_REGEX =
%r{github\.com/([^/]+)/([^/]+)}- NON_GITHUB_HOSTS =
{ "gitlab.com" => "GitLab", "codeberg.org" => "Codeberg", "bitbucket.org" => "Bitbucket", "sr.ht" => "SourceHut" }.freeze
- URI_FIELDS =
%w[source_code_uri homepage_uri bug_tracker_uri].freeze
- MAX_REDIRECTS =
3
Instance Method Summary collapse
Instance Method Details
#resolve(gem_data) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gem_changelog_diff/uri_resolver.rb', line 18 def resolve(gem_data) uris = extract_uris(gem_data) return nil if uris.empty? non_github = detect_non_github(uris) raise RepoNotFoundError, "hosted on #{non_github} (not supported)" if non_github slug = extract_github_slug(uris) return nil unless slug follow_redirects(slug) end |