2011-10-14 13:40:41 +00:00
|
|
|
module Color
|
2012-07-02 18:51:48 +00:00
|
|
|
extend self
|
|
|
|
|
2011-10-14 13:40:41 +00:00
|
|
|
def colorize(text, color_code)
|
|
|
|
"\033[#{color_code}#{text}\033[0m"
|
|
|
|
end
|
|
|
|
|
|
|
|
def red(text)
|
|
|
|
colorize(text, "31m")
|
|
|
|
end
|
|
|
|
|
|
|
|
def green(text)
|
|
|
|
colorize(text, "32m")
|
|
|
|
end
|
|
|
|
|
2011-10-17 15:45:31 +00:00
|
|
|
def yellow(text)
|
|
|
|
colorize(text, "93m")
|
|
|
|
end
|
|
|
|
|
2011-10-14 13:40:41 +00:00
|
|
|
def command(string)
|
|
|
|
`#{string}`
|
2011-10-26 13:46:25 +00:00
|
|
|
if $?.to_i > 0
|
2011-10-14 13:40:41 +00:00
|
|
|
puts red " == #{string} - FAIL"
|
|
|
|
puts red " == Error during configure"
|
|
|
|
exit
|
|
|
|
else
|
|
|
|
puts green " == #{string} - OK"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|