lib/autobuild/reporting.rb in autobuild-1.6.2.b5 vs lib/autobuild/reporting.rb in autobuild-1.6.2.b6
- old
+ new
@@ -16,14 +16,20 @@
require 'thread'
module Autobuild
class << self
attr_reader :display_lock
+ def silent?
+ @silent
+ end
+ attr_writer :silent
end
@display_lock = Mutex.new
+ @silent = false
def self.message(*args)
+ return if silent?
display_lock.synchronize do
if @last_progress_msg
puts
@last_progress_msg = nil
end
@@ -109,16 +115,19 @@
end
def self.display_progress
msg = "#{progress_messages.map(&:last).join(" | ")}"
if @last_progress_msg
- print "\r" + " " * @last_progress_msg.length
+ if !silent?
+ print "\r" + " " * @last_progress_msg.length
+ end
end
if msg.empty?
+ print "\r" if !silent?
@last_progress_msg = nil
else
- print "\r #{msg}"
+ print "\r #{msg}" if !silent?
@last_progress_msg = msg
end
end
# The exception type that is used to report multiple errors that occured