From 243d6889d54a41eef8fa218467e423ccc3ae1c42 Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Wed, 11 Jun 2014 23:48:39 -0700 Subject: [PATCH] Monkeypatch a fix into YARD::Logger#show_progress This method has an inverted conditional which means the progress bar still animates when `--debug` is passed. Not having an easy way to switch the animation off is a real bummer as it completely hoses the Pry REPL. Ref. lsegal/yard#783 --- lib/puppetx/yardoc/yard/monkey_patches.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/puppetx/yardoc/yard/monkey_patches.rb b/lib/puppetx/yardoc/yard/monkey_patches.rb index 9b8f75c..83163e3 100644 --- a/lib/puppetx/yardoc/yard/monkey_patches.rb +++ b/lib/puppetx/yardoc/yard/monkey_patches.rb @@ -19,3 +19,16 @@ class YARD::CLI::Stats output 'Puppet Types', *type_statistics(:definedtype) end end + +class YARD::Logger + def show_progress + return false if YARD.ruby18? # threading is too ineffective for progress support + return false if YARD.windows? # windows has poor ANSI support + return false unless io.tty? # no TTY support on IO + # Here is the actual monkey patch. A simple fix to an inverted conditional. + # Without this Pry is unusable for debugging as the progress bar goes + # craaaaaaaazy. + return false unless level > INFO # no progress in verbose/debug modes + @show_progress + end +end