Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 5a5e3351b0
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (26 sloc) 0.835 kb
# encoding: utf-8
require "scripted/formatters/blank"
require 'thread'
module Scripted
module Formatters
class Announcer < Blank
def initialize(*)
super
@semaphore = Mutex.new
end
def start(commands, runner)
@length = [ 50, commands.max_by { |command| command.name.size }.name.size + 4 ].max
end
# wrapped in a synchronize block to prevent asynchronous output clogging the output
def execute(command)
@semaphore.synchronize do
puts ""
puts cyan("" + ("" * (@length - 2)).force_encoding('utf-8') + "")
puts "#{cyan("")} #{command.name.center(@length - 4)} #{cyan("")}"
puts cyan("" + ("" * (@length - 2)).force_encoding('utf-8') + "")
puts ""
end
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.