Port Homebrew::Cmd::Readall

This commit is contained in:
Douglas Eichelberger 2024-04-01 10:05:02 -07:00
parent 5ef070380c
commit 057f561d2c
3 changed files with 57 additions and 56 deletions

View File

@ -1,16 +1,14 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
require "abstract_command"
require "readall" require "readall"
require "cli/parser"
require "env_config" require "env_config"
module Homebrew module Homebrew
module_function module Cmd
class ReadallCmd < AbstractCommand
sig { returns(CLI::Parser) } cmd_args do
def readall_args
Homebrew::CLI::Parser.new do
description <<~EOS description <<~EOS
Import all items from the specified <tap>, or from all installed taps if none is provided. Import all items from the specified <tap>, or from all installed taps if none is provided.
This can be useful for debugging issues across all items when making This can be useful for debugging issues across all items when making
@ -33,11 +31,9 @@ module Homebrew
named_args :tap named_args :tap
end end
end
def readall
args = readall_args.parse
sig { override.void }
def run
Homebrew.with_no_api_env do Homebrew.with_no_api_env do
if args.syntax? && args.no_named? if args.syntax? && args.no_named?
scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb" scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb"
@ -67,4 +63,6 @@ module Homebrew
end end
end end
end end
end
end
end end

View File

@ -3,6 +3,8 @@
module Readall module Readall
class << self class << self
undef valid_casks?
def valid_casks?(tap, os_name: nil, arch: Hardware::CPU.type) def valid_casks?(tap, os_name: nil, arch: Hardware::CPU.type)
return true if os_name == :linux return true if os_name == :linux

View File

@ -1,8 +1,9 @@
# frozen_string_literal: true # frozen_string_literal: true
require "cmd/readall"
require "cmd/shared_examples/args_parse" require "cmd/shared_examples/args_parse"
RSpec.describe "brew readall" do RSpec.describe Homebrew::Cmd::ReadallCmd do
it_behaves_like "parseable arguments" it_behaves_like "parseable arguments"
it "imports all Formulae for a given Tap", :integration_test do it "imports all Formulae for a given Tap", :integration_test do