Remove unused 'which_all' Kernel ext
This commit is contained in:
parent
884a3ae468
commit
793da6e0be
@ -355,19 +355,6 @@ module Kernel
|
||||
nil
|
||||
end
|
||||
|
||||
def which_all(cmd, path = ENV.fetch("PATH"))
|
||||
PATH.new(path).filter_map do |p|
|
||||
begin
|
||||
pcmd = File.expand_path(cmd, p)
|
||||
rescue ArgumentError
|
||||
# File.expand_path will raise an ArgumentError if the path is malformed.
|
||||
# See https://github.com/Homebrew/legacy-homebrew/issues/32789
|
||||
next
|
||||
end
|
||||
Pathname.new(pcmd) if File.file?(pcmd) && File.executable?(pcmd)
|
||||
end.uniq
|
||||
end
|
||||
|
||||
def which_editor(silent: false)
|
||||
editor = Homebrew::EnvConfig.editor
|
||||
return editor if editor
|
||||
|
||||
@ -172,10 +172,6 @@ class Requirement
|
||||
super(cmd, PATH.new(ORIGINAL_PATHS))
|
||||
end
|
||||
|
||||
def which_all(cmd)
|
||||
super(cmd, PATH.new(ORIGINAL_PATHS))
|
||||
end
|
||||
|
||||
class << self
|
||||
include BuildEnvironment::DSL
|
||||
|
||||
|
||||
@ -144,32 +144,6 @@ RSpec.describe Kernel do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#which_all" do
|
||||
let(:cmd_foo) { dir/"foo" }
|
||||
let(:cmd_foo_bar) { dir/"bar/foo" }
|
||||
let(:cmd_bar_baz_foo) { dir/"bar/baz/foo" }
|
||||
|
||||
before do
|
||||
(dir/"bar/baz").mkpath
|
||||
|
||||
FileUtils.touch cmd_foo_bar
|
||||
|
||||
[cmd_foo, cmd_bar_baz_foo].each do |cmd|
|
||||
FileUtils.touch cmd
|
||||
cmd.chmod 0744
|
||||
end
|
||||
end
|
||||
|
||||
it "returns an array of all executables that are found" do
|
||||
path = [
|
||||
"#{dir}/bar/baz",
|
||||
"#{dir}/baz:#{dir}",
|
||||
"~baduserpath",
|
||||
].join(File::PATH_SEPARATOR)
|
||||
expect(which_all("foo", path)).to eq([cmd_bar_baz_foo, cmd_foo])
|
||||
end
|
||||
end
|
||||
|
||||
specify "#which_editor" do
|
||||
ENV["HOMEBREW_EDITOR"] = "vemate -w"
|
||||
ENV["HOMEBREW_PATH"] = dir
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user