summaryrefslogtreecommitdiff
path: root/lib/color.rb
blob: 4eabe249c180bf879661976cf3e2bd4373432713 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Color
  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

  def yellow(text)
    colorize(text, "93m")
  end

  def command(string)
    `#{string}`
    if $?.to_i > 0
      puts red " == #{string} - FAIL"
      puts red " == Error during configure"
      exit
    else
      puts green " == #{string} - OK"
    end
  end
end