Skip to content

Fix RubyGems package metadata - #55

Open
andrew wants to merge 1 commit into
mainfrom
fix/rubygems-package-metadata
Open

Fix RubyGems package metadata#55
andrew wants to merge 1 commit into
mainfrom
fix/rubygems-package-metadata

Conversation

@andrew

@andrew andrew commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Use source_code_uri for RubyGems repository metadata and only fall back to homepage_uri when it points to a known forge. Populate LatestVersion from the API response.

Fixes #54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the RubyGems registry integration to pick a more accurate repository URL from RubyGems metadata (prioritizing source_code_uri, with a controlled fallback to forge homepages) and to populate LatestVersion directly from the gem API response, addressing issue #54 where Repository could incorrectly point at documentation pages.

Changes:

  • Prefer source_code_uri for Package.Repository, falling back to homepage_uri only when it canonicalizes to a known forge host.
  • Populate Package.LatestVersion from the RubyGems gem API response (version).
  • Add test coverage for LatestVersion and the forge-homepage fallback behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
internal/rubygems/rubygems.go Changes repository URL selection logic and fills LatestVersion from the gem API response.
internal/rubygems/rubygems_test.go Adds tests for LatestVersion, homepage fallback behavior, and extractRepoURL precedence.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

}

repoURL := extractRepoURL(resp.SourceCodeURI, resp.WikiURI, resp.DocumentURI, resp.BugTrackerURI, resp.ChangelogURI, resp.HomepageURI)
repoURL := extractRepoURL(resp.SourceCodeURI, resp.HomepageURI)
Comment on lines +57 to +68
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
resp := gemResponse{
Name: "octokit",
Version: "10.0.0",
HomepageURI: "https://github.com/octokit/octokit.rb",
DocumentURI: "https://www.rubydoc.info/gems/octokit/10.0.0",
SourceCodeURI: "",
}

w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(resp)
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gem: Package.Repository is documentation_uri, not the source repo

2 participants