Merge pull request #18027 from Homebrew/make-brew-typecheck-work-with-taps

This commit is contained in:
Mike McQuaid 2024-08-19 12:56:12 +01:00 committed by GitHub
commit a2a92fa46d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,11 +39,17 @@ module Homebrew
conflicts "--lsp", "--update-all"
conflicts "--lsp", "--fix"
named_args :none
named_args :tap
end
sig { override.void }
def run
if (args.dir.present? || args.file.present?) && args.named.present?
raise UsageError, "Cannot use `--dir` or `--file` when specifying a tap."
elsif args.fix? && args.named.present?
raise UsageError, "Cannot use `--fix` when specifying a tap."
end
update = args.update? || args.update_all?
groups = update ? Homebrew.valid_gem_groups : ["typecheck"]
Homebrew.install_bundler_gems!(groups:)
@ -95,10 +101,11 @@ module Homebrew
end
srb_exec += ["--ignore", args.ignore] if args.ignore.present?
if args.file.present? || args.dir.present?
if args.file.present? || args.dir.present? || (tap_dir = args.named.to_paths(only: :tap).first).present?
cd("sorbet") do
srb_exec += ["--file", "../#{args.file}"] if args.file
srb_exec += ["--dir", "../#{args.dir}"] if args.dir
srb_exec += ["--dir", tap_dir.to_s] if tap_dir
end
end
success = system(*srb_exec)