Remove unused WhichFormula ENDPOINT and DATABASE_FILE constants

`brew which-formula` is a `ShellCommand` implemented in Bash
(utils/executables.sh), so these Ruby constants were never read at runtime;
only the spec referenced `DATABASE_FILE`. Remove both and have the spec write
the database to the same path `Homebrew::API.write_executables_file!` uses.

Claude-Session: https://claude.ai/code/session_011BgWRBydtdkvt8ocqH4nj9
This commit is contained in:
Douglas Eichelberger
2026-07-26 14:25:15 -07:00
parent c791ca532e
commit 678b955aff
2 changed files with 3 additions and 8 deletions
-3
View File
@@ -11,9 +11,6 @@ require "shell_command"
module Homebrew
module Cmd
class WhichFormula < AbstractCommand
ENDPOINT = "internal/executables.txt"
DATABASE_FILE = T.let((Homebrew::API::HOMEBREW_CACHE_API/ENDPOINT).freeze, Pathname)
include ShellCommand
cmd_args do
@@ -19,11 +19,9 @@ RSpec.describe Homebrew::Cmd::WhichFormula do
end
before do
# Override DATABASE_FILE to use test environment's HOMEBREW_CACHE
test_db_file = HOMEBREW_CACHE/"api"/Homebrew::Cmd::WhichFormula::ENDPOINT
stub_const("#{described_class}::DATABASE_FILE", test_db_file)
db = Homebrew::Cmd::WhichFormula::DATABASE_FILE
# Write the database where `brew which-formula` (a Bash command) reads it:
# the same path `Homebrew::API.write_executables_file!` writes to.
db = Homebrew::API::HOMEBREW_CACHE_API/"internal/executables.txt"
db.dirname.mkpath
db.write(<<~EOS)
foo(1.0.0):foo2 foo3