Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions internal/homebrew/homebrew.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ type formulaResponse struct {
BuildDependencies []string `json:"build_dependencies"`
TestDependencies []string `json:"test_dependencies"`
OptionalDependencies []string `json:"optional_dependencies"`
VersionedFormulae []string `json:"versioned_formulae"`
Deprecated bool `json:"deprecated"`
DeprecationDate string `json:"deprecation_date"`
DeprecationReason string `json:"deprecation_reason"`
Expand Down Expand Up @@ -160,20 +159,6 @@ func (r *Registry) FetchVersions(ctx context.Context, name string) ([]core.Versi
})
}

// Add versioned formulae (e.g., python@3.11, node@18)
for _, vf := range resp.VersionedFormulae {
// Extract version from formula name like "python@3.11"
parts := strings.SplitN(vf, "@", 2) //nolint:mnd // name@version split
if len(parts) == 2 { //nolint:mnd
versions = append(versions, core.Version{
Number: parts[1],
Metadata: map[string]any{
"formula": vf,
},
})
}
}

return versions, nil
}

Expand Down
30 changes: 18 additions & 12 deletions internal/homebrew/homebrew_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,22 @@ func TestFetchPackageWithGitHubRepo(t *testing.T) {

func TestFetchVersions(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
resp := formulaResponse{
Name: "python",
License: "Python-2.0",
Versions: versionsInfo{
Stable: "3.12.1",
Bottle: true,
},
URLs: urlsInfo{
Stable: urlInfo{
Checksum: "abc123def456",
// versioned_formulae names other formulae, not versions of this one.
resp := struct {
formulaResponse
VersionedFormulae []string `json:"versioned_formulae"`
}{
formulaResponse: formulaResponse{
Name: "python",
License: "Python-2.0",
Versions: versionsInfo{
Stable: "3.12.1",
Bottle: true,
},
URLs: urlsInfo{
Stable: urlInfo{
Checksum: "abc123def456",
},
},
},
VersionedFormulae: []string{"python@3.11", "python@3.10", "python@3.9"},
Expand All @@ -100,8 +106,8 @@ func TestFetchVersions(t *testing.T) {
t.Fatalf("FetchVersions failed: %v", err)
}

if len(versions) != 4 {
t.Fatalf("expected 4 versions (stable + 3 versioned), got %d", len(versions))
if len(versions) != 1 {
t.Fatalf("expected only the stable version, got %v", versions)
}

if versions[0].Number != "3.12.1" {
Expand Down
Loading