Skip to content
Snippets Groups Projects
Commit 75a692d0 authored by Markus Reiter's avatar Markus Reiter
Browse files

Make `ohai`, `oh1` and `odebug` use `#debug?` and `verbose?` of the current object when possible.

parent add10377
No related branches found
No related tags found
No related merge requests found
......@@ -939,7 +939,7 @@ class FormulaInstaller
log.mkpath if formula.plist.include? log.to_s
rescue Exception => e # rubocop:disable Lint/RescueException
onoe "Failed to install plist file"
ohai e, e.backtrace if debug?
odebug e, e.backtrace
Homebrew.failed = true
end
......@@ -949,7 +949,7 @@ class FormulaInstaller
onoe "Failed to fix install linkage"
puts "The formula built, but you may encounter issues using it or linking other"
puts "formulae against it."
ohai e, e.backtrace if debug?
odebug e, e.backtrace
Homebrew.failed = true
@show_summary_heading = true
end
......@@ -960,7 +960,7 @@ class FormulaInstaller
rescue Exception => e # rubocop:disable Lint/RescueException
opoo "The cleaning step did not complete successfully"
puts "Still, the installation was successful, so we will link it into your prefix"
ohai e, e.backtrace if debug?
odebug e, e.backtrace
Homebrew.failed = true
@show_summary_heading = true
end
......@@ -996,7 +996,7 @@ class FormulaInstaller
rescue Exception => e # rubocop:disable Lint/RescueException
opoo "The post-install step did not complete successfully"
puts "You can try again using `brew postinstall #{formula.full_name}`"
ohai e, e.backtrace if debug? || Homebrew::EnvConfig.developer?
odebug e, e.backtrace, always_display: Homebrew::EnvConfig.developer?
Homebrew.failed = true
@show_summary_heading = true
end
......
......@@ -86,7 +86,13 @@ module Kernel
end
def ohai_title(title)
title = Tty.truncate(title) if $stdout.tty? && !Homebrew.args.verbose?
verbose = if respond_to?(:verbose?)
verbose?
else
Homebrew.args.verbose?
end
title = Tty.truncate(title) if $stdout.tty? && !verbose
Formatter.headline(title, color: :blue)
end
......@@ -95,15 +101,27 @@ module Kernel
puts sput
end
def odebug(title, *sput)
return unless Homebrew.args.debug?
def odebug(title, *sput, always_display: false)
debug = if respond_to?(:debug?)
debug?
else
Homebrew.args.debug?
end
return unless debug || always_display
puts Formatter.headline(title, color: :magenta)
puts sput unless sput.empty?
end
def oh1(title, options = {})
title = Tty.truncate(title) if $stdout.tty? && !Homebrew.args.verbose? && options.fetch(:truncate, :auto) == :auto
def oh1(title, truncate: :auto)
verbose = if respond_to?(:verbose?)
verbose?
else
Homebrew.args.verbose?
end
title = Tty.truncate(title) if $stdout.tty? && !verbose && truncate == :auto
puts Formatter.headline(title, color: :green)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment