Merge pull request #7478 from GauthamGoli/argv-cleanup-23

ARGV: Deprecate ARGV.formulae, replace with Homebrew.args.formulae
This commit is contained in:
Gautham Goli 2020-05-02 11:05:09 +05:30 committed by GitHub
commit bffe4dde96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 26 deletions

View File

@ -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

View File

@ -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

View File

@ -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 []