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
|
self
|
||||||
end
|
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)
|
def select(&block)
|
||||||
self.class.new(@paths.select(&block))
|
self.class.new(@paths.select(&block))
|
||||||
end
|
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)
|
def reject(&block)
|
||||||
self.class.new(@paths.reject(&block))
|
self.class.new(@paths.reject(&block))
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# typed: false # rubocop:todo Sorbet/TrueSigil
|
# typed: true
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "English"
|
require "English"
|
||||||
@ -13,6 +13,16 @@ module Homebrew
|
|||||||
module Exec
|
module Exec
|
||||||
PATH_LIKE_ENV_REGEX = /.+#{File::PATH_SEPARATOR}/
|
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)
|
def self.run(*args, global: false, file: nil, subcommand: "", services: false, check: false)
|
||||||
if check
|
if check
|
||||||
require "bundle/commands/check"
|
require "bundle/commands/check"
|
||||||
@ -25,9 +35,9 @@ module Homebrew
|
|||||||
|
|
||||||
# Setup Homebrew's ENV extensions
|
# Setup Homebrew's ENV extensions
|
||||||
ENV.activate_extensions!
|
ENV.activate_extensions!
|
||||||
raise UsageError, "No command to execute was specified!" if args.blank?
|
|
||||||
|
|
||||||
command = args.first
|
command = args.first
|
||||||
|
raise UsageError, "No command to execute was specified!" if command.blank?
|
||||||
|
|
||||||
require "bundle/brewfile"
|
require "bundle/brewfile"
|
||||||
@dsl = Brewfile.read(global:, file:)
|
@dsl = Brewfile.read(global:, file:)
|
||||||
@ -181,7 +191,7 @@ module Homebrew
|
|||||||
if services
|
if services
|
||||||
require "bundle/brew_services"
|
require "bundle/brew_services"
|
||||||
|
|
||||||
exit_code = 0
|
exit_code = T.let(0, Integer)
|
||||||
run_services(@dsl.entries) do
|
run_services(@dsl.entries) do
|
||||||
Kernel.system(*args)
|
Kernel.system(*args)
|
||||||
if (system_exit_code = $CHILD_STATUS&.exitstatus)
|
if (system_exit_code = $CHILD_STATUS&.exitstatus)
|
||||||
@ -199,7 +209,7 @@ module Homebrew
|
|||||||
entries: T::Array[Homebrew::Bundle::Dsl::Entry],
|
entries: T::Array[Homebrew::Bundle::Dsl::Entry],
|
||||||
_block: T.proc.params(
|
_block: T.proc.params(
|
||||||
entry: Homebrew::Bundle::Dsl::Entry,
|
entry: Homebrew::Bundle::Dsl::Entry,
|
||||||
info: T::Hash[String, T.anything],
|
info: T::Hash[String, T.untyped],
|
||||||
service_file: Pathname,
|
service_file: Pathname,
|
||||||
conflicting_services: T::Array[T::Hash[String, T.anything]],
|
conflicting_services: T::Array[T::Hash[String, T.anything]],
|
||||||
).void,
|
).void,
|
||||||
@ -279,7 +289,7 @@ module Homebrew
|
|||||||
map_service_info(entries) do |entry, info, service_file, conflicting_services|
|
map_service_info(entries) do |entry, info, service_file, conflicting_services|
|
||||||
# Don't restart if already running this version
|
# Don't restart if already running this version
|
||||||
loaded_file = Pathname.new(info["loaded_file"].to_s)
|
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)
|
if info["running"] && !Bundle::BrewServices.stop(info["name"], keep: true)
|
||||||
opoo "Failed to stop #{info["name"]} service"
|
opoo "Failed to stop #{info["name"]} service"
|
||||||
|
@ -31,7 +31,7 @@ module Homebrew
|
|||||||
sig { override.void }
|
sig { override.void }
|
||||||
def run
|
def run
|
||||||
ENV.activate_extensions!
|
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
|
ENV.setup_build_environment
|
||||||
|
|
||||||
shell = if args.plain?
|
shell = if args.plain?
|
||||||
|
@ -13,8 +13,8 @@ class Dependencies < SimpleDelegator
|
|||||||
sig { returns(T::Enumerator[Dependency]) }
|
sig { returns(T::Enumerator[Dependency]) }
|
||||||
def each(&blk); end
|
def each(&blk); end
|
||||||
|
|
||||||
sig { params(blk: T.proc.params(arg0: Dependency).returns(T::Boolean)).returns(T::Array[Dependency]) }
|
sig { override.params(blk: T.proc.params(arg0: Dependency).returns(T.anything)).returns(T::Array[Dependency]) }
|
||||||
sig { returns(T::Enumerator[Dependency]) }
|
sig { override.returns(T::Enumerator[Dependency]) }
|
||||||
def select(&blk); end
|
def select(&blk); end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ class Requirements < SimpleDelegator
|
|||||||
sig { returns(T::Enumerator[Requirement]) }
|
sig { returns(T::Enumerator[Requirement]) }
|
||||||
def each(&blk); end
|
def each(&blk); end
|
||||||
|
|
||||||
sig { params(blk: T.proc.params(arg0: Requirement).returns(T::Boolean)).returns(T::Array[Requirement]) }
|
sig { override.params(blk: T.proc.params(arg0: Requirement).returns(T.anything)).returns(T::Array[Requirement]) }
|
||||||
sig { returns(T::Enumerator[Requirement]) }
|
sig { override.returns(T::Enumerator[Requirement]) }
|
||||||
def select(&blk); end
|
def select(&blk); end
|
||||||
end
|
end
|
||||||
|
@ -29,7 +29,9 @@ module Homebrew
|
|||||||
ENV.activate_extensions!(env: args.env)
|
ENV.activate_extensions!(env: args.env)
|
||||||
|
|
||||||
if superenv?(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
|
end
|
||||||
ENV.setup_build_environment
|
ENV.setup_build_environment
|
||||||
if superenv?(args.env)
|
if superenv?(args.env)
|
||||||
|
@ -10,6 +10,10 @@ class Sorbet
|
|||||||
module Static
|
module Static
|
||||||
class ENVClass
|
class ENVClass
|
||||||
include EnvActivation
|
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
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user