mirror of
https://github.com/Homebrew/brew.git
synced 2026-08-12 22:29:27 +04:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user