Module: DtcRake::UI

Included in:
DtcRake, Product
Defined in:
lib/dtc_rake/ui.rb

Class Method Summary collapse

Class Method Details

.announce(msg) ⇒ Object



11
12
13
14
15
16
# File 'lib/dtc_rake/ui.rb', line 11

def announce(msg)
  if DtcRake::UI.colorize?
    msg = Rainbow(msg).aqua
  end
  puts msg
end

.colorize?Boolean



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/dtc_rake/ui.rb', line 43

def colorize?
  return @colorize if defined? @colorize

  colorize = Config.instance.colorize
  if colorize
    begin
      require "rainbow"
    rescue LoadError
      colorize = false
    end
  end
  @colorize = colorize
end

.error(msg) ⇒ Object



3
4
5
6
7
8
# File 'lib/dtc_rake/ui.rb', line 3

def error(msg)
  if DtcRake::UI.colorize?
    msg = Rainbow(msg).red
  end
  abort msg
end

.info(msg) ⇒ Object



35
36
37
38
39
40
# File 'lib/dtc_rake/ui.rb', line 35

def info(msg)
  if DtcRake::UI.colorize?
    msg = Rainbow(msg).white
  end
  puts msg
end

.success(msg) ⇒ Object



19
20
21
22
23
24
# File 'lib/dtc_rake/ui.rb', line 19

def success(msg)
  if DtcRake::UI.colorize?
    msg = Rainbow(msg).green
  end
  puts msg
end

.warning(msg) ⇒ Object



27
28
29
30
31
32
# File 'lib/dtc_rake/ui.rb', line 27

def warning(msg)
  if DtcRake::UI.colorize?
    msg = Rainbow(msg).yellow
  end
  puts msg
end