From f6abc6fe196362efe9dbf25fed5738fbecd8af0f Mon Sep 17 00:00:00 2001 From: Gautham G Date: Fri, 1 May 2020 22:45:49 +0530 Subject: [PATCH] ARGV: Deprecate ARGV.formulae, replace with Homebrew.args.formulae --- Library/Homebrew/extend/ARGV.rb | 11 ----------- Library/Homebrew/formula_installer.rb | 2 +- Library/Homebrew/test/ARGV_spec.rb | 14 -------------- 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index ddaa63f319..7155889126 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -5,17 +5,6 @@ module HomebrewArgvExtension select { |arg| arg.start_with?("--") } 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 # TODO: use @instance variable to ||= cache when moving to CLI::Parser downcased_unique_named.grep HOMEBREW_CASK_TAP_CASK_REGEX diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index e8c9bb372d..b90d94314e 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -82,7 +82,7 @@ class FormulaInstaller build_flags = Homebrew.args.collect_build_args 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) end diff --git a/Library/Homebrew/test/ARGV_spec.rb b/Library/Homebrew/test/ARGV_spec.rb index d0c00a993b..640de294ba 100644 --- a/Library/Homebrew/test/ARGV_spec.rb +++ b/Library/Homebrew/test/ARGV_spec.rb @@ -7,20 +7,6 @@ describe HomebrewArgvExtension do 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 it "returns an empty array if there is no match" do expect(subject.casks).to eq []