Module: Debrew Private
- Extended by:
- Mutex_m, Predicable
- Defined in:
- Library/Homebrew/debrew.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Helper module for debugging formulae.
Defined Under Namespace
Modules: Formula, Raise Classes: Menu
Constant Summary collapse
- Ignorable =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Module.new.freeze
Class Attribute Summary collapse
- .debugged_exceptions ⇒ Object readonly private
Class Method Summary collapse
- .debrew ⇒ Object private
- .debug(e) ⇒ Object private
Methods included from Predicable
Class Attribute Details
.debugged_exceptions ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
93 94 95 |
# File 'Library/Homebrew/debrew.rb', line 93 def debugged_exceptions @debugged_exceptions end |
Class Method Details
.debrew ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'Library/Homebrew/debrew.rb', line 96 def self.debrew @active = true Object.include Raise begin yield rescue SystemExit original_raise rescue Exception => e # rubocop:disable Lint/RescueException debug(e) ensure @active = false end end |
.debug(e) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'Library/Homebrew/debrew.rb', line 111 def self.debug(e) original_raise(e) unless active? && debugged_exceptions.add?(e) && try_lock begin puts e.backtrace.first.to_s puts Formatter.error(e, label: e.class.name) loop do Menu.choose do || .prompt = "Choose an action: " .choice(:raise) { original_raise(e) } .choice(:ignore) { return :ignore } if e.is_a?(Ignorable) .choice(:backtrace) { puts e.backtrace } if e.is_a?(Ignorable) .choice(:irb) do puts "When you exit this IRB session, execution will continue." set_trace_func proc { |event, _, _, id, binding, klass| if klass == Raise && id == :raise && event == "return" set_trace_func(nil) synchronize { IRB.start_within(binding) } end } return :ignore end end .choice(:shell) do puts "When you exit this shell, you will return to the menu." interactive_shell end end end ensure unlock end end |