ARGV: Deprecate ARGV.formulae, replace with Homebrew.args.formulae

This commit is contained in:
Gautham G 2020-05-01 22:45:49 +05:30
parent 7f69550e00
commit f6abc6fe19
3 changed files with 1 additions and 26 deletions

View File

@ -5,17 +5,6 @@ module HomebrewArgvExtension
select { |arg| arg.start_with?("--") } select { |arg| arg.start_with?("--") }
end end
def formulae
require "formula"
(downcased_unique_named - casks).map do |name|
if name.include?("/") || File.exist?(name)
Formulary.factory(name, spec)
else
Formulary.find_with_priority(name, spec)
end
end.uniq(&:name)
end
def casks def casks
# TODO: use @instance variable to ||= cache when moving to CLI::Parser # TODO: use @instance variable to ||= cache when moving to CLI::Parser
downcased_unique_named.grep HOMEBREW_CASK_TAP_CASK_REGEX downcased_unique_named.grep HOMEBREW_CASK_TAP_CASK_REGEX

View File

@ -82,7 +82,7 @@ class FormulaInstaller
build_flags = Homebrew.args.collect_build_args build_flags = Homebrew.args.collect_build_args
return if build_flags.empty? return if build_flags.empty?
all_bottled = ARGV.formulae.all?(&:bottled?) all_bottled = Homebrew.args.formulae.all?(&:bottled?)
raise BuildFlagsError.new(build_flags, bottled: all_bottled) raise BuildFlagsError.new(build_flags, bottled: all_bottled)
end end

View File

@ -7,20 +7,6 @@ describe HomebrewArgvExtension do
let(:argv) { ["mxcl"] } let(:argv) { ["mxcl"] }
describe "#formulae" do
it "raises an error when a Formula is unavailable" do
expect { subject.formulae }.to raise_error FormulaUnavailableError
end
context "when there are no Formulae" do
let(:argv) { [] }
it "returns an empty array" do
expect(subject.formulae).to be_empty
end
end
end
describe "#casks" do describe "#casks" do
it "returns an empty array if there is no match" do it "returns an empty array if there is no match" do
expect(subject.casks).to eq [] expect(subject.casks).to eq []