Deprecate invoking commands in the old style
This commit is contained in:
parent
102dec893b
commit
4fd659797f
@ -167,6 +167,14 @@ module Homebrew
|
||||
@command_name = T.let(T.must(cmd_location.label).chomp("_args").tr("_", "-"), String)
|
||||
@is_dev_cmd = T.let(T.must(cmd_location.absolute_path).start_with?(Commands::HOMEBREW_DEV_CMD_PATH),
|
||||
T::Boolean)
|
||||
# We allow this path only from `brew.rb`:
|
||||
if @command_name != "<main>"
|
||||
odeprecated(
|
||||
"`brew #{@command_name}', which does not inherit from from Homebrew::AbstractCommand. This command " \
|
||||
"needs to be refactored, as it is written in a style that",
|
||||
disable_for_developers: false,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@constraints = T.let([], T::Array[[String, String]])
|
||||
|
||||
@ -172,11 +172,13 @@ module Kernel
|
||||
|
||||
disable = true if disable_for_developers && Homebrew::EnvConfig.developer?
|
||||
if disable || Homebrew.raise_deprecation_exceptions?
|
||||
require "utils/github/actions"
|
||||
GitHub::Actions.puts_annotation_if_env_set(:error, message, file:, line:)
|
||||
exception = MethodDeprecatedError.new(message)
|
||||
exception.set_backtrace(backtrace)
|
||||
raise exception
|
||||
elsif !Homebrew.auditing?
|
||||
require "utils/github/actions"
|
||||
GitHub::Actions.puts_annotation_if_env_set(:warning, message, file:, line:)
|
||||
opoo message
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user