master/lib/guard/ui.rb

38 lines
732 B
Ruby
Raw Normal View History

2010-10-03 21:00:33 +00:00
module Guard
module UI
class << self
def info(message, options = {})
unless ENV["GUARD_ENV"] == "test"
reset_line if options[:reset]
clear if options.key?(:clear) ? options[:clear] : ::Guard.options[:clear]
puts reset_color(message) if message != ''
end
end
def error(message)
puts "ERROR: #{message}"
end
def reset_line
print "\r\e "
end
private
def clear
system("clear;")
end
def reset_color(text)
color(text, "\e[0m")
end
def color(text, color_code)
"#{color_code}#{text}\e[0m"
end
end
end
end