mirror of
https://github.com/Homebrew/brew.git
synced 2026-08-12 22:29:27 +04:00
Merge pull request #23322 from Homebrew/remove-info-which-formula-dead-code
Remove dead code from brew info and which-formula
This commit is contained in:
@@ -174,20 +174,6 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
sig { params(formula_or_cask: T.any(Formula, Cask::Cask)).returns(T::Array[String]) }
|
||||
def self.requirements_lines(formula_or_cask)
|
||||
return [] unless $stdout.tty?
|
||||
|
||||
case formula_or_cask
|
||||
when Formula
|
||||
[]
|
||||
when Cask::Cask
|
||||
cask_requirements_lines(formula_or_cask)
|
||||
else
|
||||
T.absurd(formula_or_cask)
|
||||
end
|
||||
end
|
||||
|
||||
sig { params(tab: T.any(Tab, Cask::Tab)).returns(String) }
|
||||
def self.installation_status(tab)
|
||||
# TODO: Deprecate reading `installed_as_dependency`; `installed_on_request`
|
||||
@@ -267,27 +253,6 @@ module Homebrew
|
||||
metadata
|
||||
end
|
||||
|
||||
sig { params(cask: Cask::Cask).returns(T::Array[String]) }
|
||||
def self.cask_requirements_lines(cask)
|
||||
macos_requirements = [cask.depends_on.macos, cask.depends_on.maximum_macos].compact
|
||||
requirement = if macos_requirements.present?
|
||||
requirement = macos_requirements.filter_map do |macos_requirement|
|
||||
macos_requirement.display_s.delete_suffix(" (or Linux)").delete_prefix("macOS").strip.presence
|
||||
end
|
||||
requirement = requirement.present? ? "macOS #{requirement.join(", ")}" : "macOS"
|
||||
requirement += " or Linux" if cask.supports_linux?
|
||||
requirement
|
||||
elsif cask.supports_macos? && cask.supports_linux?
|
||||
"macOS or Linux"
|
||||
elsif cask.supports_macos?
|
||||
"macOS"
|
||||
elsif cask.supports_linux?
|
||||
"Linux"
|
||||
end
|
||||
|
||||
requirement ? [requirement] : []
|
||||
end
|
||||
|
||||
sig { params(time: T.any(Integer, Time)).returns(String) }
|
||||
def self.formatted_time(time)
|
||||
time = Time.at(time) if time.is_a?(Integer)
|
||||
@@ -347,7 +312,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
private_class_method :formula_metadata_lines, :formatted_time, :pin_path_mtime,
|
||||
:formula_installs_from_source?, :cask_requirements_lines
|
||||
:formula_installs_from_source?
|
||||
|
||||
private
|
||||
|
||||
|
||||
@@ -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