mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Update debugger to fail without portable ruby
This commit is contained in:
parent
3b63a7eff4
commit
0b5130937f
@ -42,12 +42,8 @@ module Commands
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.valid_ruby_cmd?(cmd)
|
def self.valid_ruby_cmd?(cmd)
|
||||||
if (valid_internal_cmd?(cmd) || valid_internal_dev_cmd?(cmd) || external_ruby_v2_cmd_path(cmd)) &&
|
(valid_internal_cmd?(cmd) || valid_internal_dev_cmd?(cmd) || external_ruby_v2_cmd_path(cmd)) &&
|
||||||
(command = Homebrew::AbstractCommand.command(cmd))
|
Homebrew::AbstractCommand.command(cmd)&.ruby_cmd?
|
||||||
command.ruby_cmd?
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.method_name(cmd)
|
def self.method_name(cmd)
|
||||||
|
@ -11,8 +11,8 @@ module Homebrew
|
|||||||
To pass flags to the command, use `--` to separate them from the `brew` flags.
|
To pass flags to the command, use `--` to separate them from the `brew` flags.
|
||||||
For example: `brew debugger -- list --formula`.
|
For example: `brew debugger -- list --formula`.
|
||||||
EOS
|
EOS
|
||||||
switch "-n", "--nonstop",
|
switch "-s", "--stop",
|
||||||
description: "Do not stop at the beginning of the script."
|
description: "Stop at the beginning of the script."
|
||||||
switch "-O", "--open",
|
switch "-O", "--open",
|
||||||
description: "Start remote debugging over a Unix socket."
|
description: "Start remote debugging over a Unix socket."
|
||||||
|
|
||||||
@ -21,12 +21,14 @@ module Homebrew
|
|||||||
|
|
||||||
sig { override.void }
|
sig { override.void }
|
||||||
def run
|
def run
|
||||||
|
raise UsageError, "Debugger is only supported with portable Ruby!" unless HOMEBREW_USING_PORTABLE_RUBY
|
||||||
|
|
||||||
unless Commands.valid_ruby_cmd?(args.named.first)
|
unless Commands.valid_ruby_cmd?(args.named.first)
|
||||||
raise UsageError, "`#{args.named.first}` is not a valid Ruby command!"
|
raise UsageError, "`#{args.named.first}` is not a valid Ruby command!"
|
||||||
end
|
end
|
||||||
|
|
||||||
brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path
|
brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path
|
||||||
nonstop = "1" if args.nonstop?
|
nonstop = "1" unless args.stop?
|
||||||
debugger_method = if args.open?
|
debugger_method = if args.open?
|
||||||
"open"
|
"open"
|
||||||
else
|
else
|
||||||
|
@ -14,12 +14,12 @@ class Homebrew::DevCmd::Debugger::Args < Homebrew::CLI::Args
|
|||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def O?; end
|
def O?; end
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
|
||||||
def n?; end
|
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
|
||||||
def nonstop?; end
|
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def open?; end
|
def open?; end
|
||||||
|
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
|
def s?; end
|
||||||
|
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
|
def stop?; end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user