mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #20128 from Homebrew/some-bundle-files-werent-typed-at-all
Make the remaining `bundle` files `typed: true`
This commit is contained in:
commit
019a799fae
@ -39,12 +39,12 @@ class PATH
|
||||
self
|
||||
end
|
||||
|
||||
sig { params(block: T.proc.params(arg0: String).returns(T::Boolean)).returns(T.self_type) }
|
||||
sig { params(block: T.proc.params(arg0: String).returns(BasicObject)).returns(T.self_type) }
|
||||
def select(&block)
|
||||
self.class.new(@paths.select(&block))
|
||||
end
|
||||
|
||||
sig { params(block: T.proc.params(arg0: String).returns(T::Boolean)).returns(T.self_type) }
|
||||
sig { params(block: T.proc.params(arg0: String).returns(BasicObject)).returns(T.self_type) }
|
||||
def reject(&block)
|
||||
self.class.new(@paths.reject(&block))
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
# typed: false # rubocop:todo Sorbet/TrueSigil
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "English"
|
||||
@ -13,6 +13,16 @@ module Homebrew
|
||||
module Exec
|
||||
PATH_LIKE_ENV_REGEX = /.+#{File::PATH_SEPARATOR}/
|
||||
|
||||
sig {
|
||||
params(
|
||||
args: String,
|
||||
global: T::Boolean,
|
||||
file: T.nilable(String),
|
||||
subcommand: String,
|
||||
services: T::Boolean,
|
||||
check: T::Boolean,
|
||||
).void
|
||||
}
|
||||
def self.run(*args, global: false, file: nil, subcommand: "", services: false, check: false)
|
||||
if check
|
||||
require "bundle/commands/check"
|
||||
@ -25,9 +35,9 @@ module Homebrew
|
||||
|
||||
# Setup Homebrew's ENV extensions
|
||||
ENV.activate_extensions!
|
||||
raise UsageError, "No command to execute was specified!" if args.blank?
|
||||
|
||||
command = args.first
|
||||
raise UsageError, "No command to execute was specified!" if command.blank?
|
||||
|
||||
require "bundle/brewfile"
|
||||
@dsl = Brewfile.read(global:, file:)
|
||||
@ -181,7 +191,7 @@ module Homebrew
|
||||
if services
|
||||
require "bundle/brew_services"
|
||||
|
||||
exit_code = 0
|
||||
exit_code = T.let(0, Integer)
|
||||
run_services(@dsl.entries) do
|
||||
Kernel.system(*args)
|
||||
if (system_exit_code = $CHILD_STATUS&.exitstatus)
|
||||
@ -199,7 +209,7 @@ module Homebrew
|
||||
entries: T::Array[Homebrew::Bundle::Dsl::Entry],
|
||||
_block: T.proc.params(
|
||||
entry: Homebrew::Bundle::Dsl::Entry,
|
||||
info: T::Hash[String, T.anything],
|
||||
info: T::Hash[String, T.untyped],
|
||||
service_file: Pathname,
|
||||
conflicting_services: T::Array[T::Hash[String, T.anything]],
|
||||
).void,
|
||||
@ -279,7 +289,7 @@ module Homebrew
|
||||
map_service_info(entries) do |entry, info, service_file, conflicting_services|
|
||||
# Don't restart if already running this version
|
||||
loaded_file = Pathname.new(info["loaded_file"].to_s)
|
||||
next if info["running"] && loaded_file&.file? && loaded_file&.realpath == service_file.realpath
|
||||
next if info["running"] && loaded_file.file? && loaded_file.realpath == service_file.realpath
|
||||
|
||||
if info["running"] && !Bundle::BrewServices.stop(info["name"], keep: true)
|
||||
opoo "Failed to stop #{info["name"]} service"
|
||||
|
@ -31,7 +31,7 @@ module Homebrew
|
||||
sig { override.void }
|
||||
def run
|
||||
ENV.activate_extensions!
|
||||
T.cast(ENV, Superenv).deps = args.named.to_formulae if superenv?(nil)
|
||||
ENV.deps = args.named.to_formulae if superenv?(nil)
|
||||
ENV.setup_build_environment
|
||||
|
||||
shell = if args.plain?
|
||||
|
@ -13,8 +13,8 @@ class Dependencies < SimpleDelegator
|
||||
sig { returns(T::Enumerator[Dependency]) }
|
||||
def each(&blk); end
|
||||
|
||||
sig { params(blk: T.proc.params(arg0: Dependency).returns(T::Boolean)).returns(T::Array[Dependency]) }
|
||||
sig { returns(T::Enumerator[Dependency]) }
|
||||
sig { override.params(blk: T.proc.params(arg0: Dependency).returns(T.anything)).returns(T::Array[Dependency]) }
|
||||
sig { override.returns(T::Enumerator[Dependency]) }
|
||||
def select(&blk); end
|
||||
end
|
||||
|
||||
@ -26,7 +26,7 @@ class Requirements < SimpleDelegator
|
||||
sig { returns(T::Enumerator[Requirement]) }
|
||||
def each(&blk); end
|
||||
|
||||
sig { params(blk: T.proc.params(arg0: Requirement).returns(T::Boolean)).returns(T::Array[Requirement]) }
|
||||
sig { returns(T::Enumerator[Requirement]) }
|
||||
sig { override.params(blk: T.proc.params(arg0: Requirement).returns(T.anything)).returns(T::Array[Requirement]) }
|
||||
sig { override.returns(T::Enumerator[Requirement]) }
|
||||
def select(&blk); end
|
||||
end
|
||||
|
@ -16,10 +16,10 @@ module Homebrew
|
||||
in an Xcode-only configuration since it adds tools like `make` to your `$PATH`
|
||||
which build systems would not find otherwise.
|
||||
EOS
|
||||
flag "--env=",
|
||||
description: "Use the standard `$PATH` instead of superenv's when `std` is passed."
|
||||
flag "-c=", "--cmd=",
|
||||
description: "Execute commands in a non-interactive shell."
|
||||
flag "--env=",
|
||||
description: "Use the standard `$PATH` instead of superenv's when `std` is passed."
|
||||
flag "-c=", "--cmd=",
|
||||
description: "Execute commands in a non-interactive shell."
|
||||
|
||||
named_args :file, max: 1
|
||||
end
|
||||
@ -29,7 +29,9 @@ module Homebrew
|
||||
ENV.activate_extensions!(env: args.env)
|
||||
|
||||
if superenv?(args.env)
|
||||
T.cast(ENV, Superenv).deps = Formula.installed.select { |f| f.keg_only? && f.opt_prefix.directory? }
|
||||
ENV.deps = Formula.installed.select do |f|
|
||||
f.keg_only? && f.opt_prefix.directory?
|
||||
end
|
||||
end
|
||||
ENV.setup_build_environment
|
||||
if superenv?(args.env)
|
||||
|
@ -10,6 +10,10 @@ class Sorbet
|
||||
module Static
|
||||
class ENVClass
|
||||
include EnvActivation
|
||||
# NOTE: This is a bit misleading, as at most only one of these can be true
|
||||
# See: EnvActivation#activate_extensions!
|
||||
include Stdenv
|
||||
include Superenv
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user