Suppressing progress bar output and getting hints to work

This commit is contained in:
Andy Meneely
2014-07-31 16:57:49 -04:00
parent 8bfdf4b777
commit 202b4c4235
7 changed files with 39 additions and 15 deletions
+2 -2
View File
@@ -86,8 +86,8 @@ module Squib
if File.exists?(file) && config = YAML.load_file(file)
config = Squib::CONFIG_DEFAULTS.merge(config)
@dpi = config['dpi'].to_i
@hint = config['hint']
@progress_bar.enabled = config['progress_bar']
@text_hint = config['text_hint']
@progress_bar.enabled = config['progress_bars']
end
end
+12 -2
View File
@@ -1,6 +1,13 @@
require 'ruby-progressbar'
module Squib
class DoNothing
def increment
#do nothing!
end
end
# A facade that handles (or doesn't) the progress bar on the console
#
# :nodoc:
@@ -13,12 +20,15 @@ module Squib
end
def start(title="", total=100, &block)
if @enabled
if @enabled && !(ENV['IN_TEST'].eql? "true")
@bar = ProgressBar.create(title: title, total: total, format: '%t <%B> %p%% %a')
yield(@bar)
@bar.finish
else
yield(Squib::DoNothing.new)
end
end
end
end
+10 -1
View File
@@ -1,2 +1,11 @@
# Settings in the config.yml are overriding Squib's defaults. Anything in the main script will override this.
#dpi: 72
# DPI is used in making PDFs and in unit conversions
#dpi: 72
# Text hints are used to show the boundaries of text boxes.
# Can be enabled/disabled at the command-level, or set globally with `set`
#text_hint: '#F00'
# Show progress bars on the command line for potentially long-running operations
#progress_bars: true