Module: Guard::Compat::UI

Defined in:
lib/guard/compat/plugin.rb

Class Method Summary collapse

Class Method Details

.color(text, *colors) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/guard/compat/plugin.rb', line 55

def self.color(text, *colors)
  if Guard.const_defined?(:UI)
    Guard::UI.send(:color, text, *colors)
  else
    text
  end
end

.color_enabled?Boolean

Returns:

  • (Boolean)


63
64
65
66
67
68
69
# File 'lib/guard/compat/plugin.rb', line 63

def self.color_enabled?
  if Guard.const_defined?(:UI)
    Guard::UI.send(:color_enabled?)
  else
    false
  end
end

.debug(message, options = {}) ⇒ Object



95
96
97
98
99
100
101
# File 'lib/guard/compat/plugin.rb', line 95

def self.debug(message, options = {})
  if Guard.const_defined?(:UI)
    Guard::UI.debug(message, options)
  else
    $stdout.puts(message)
  end
end

.deprecation(message, options = {}) ⇒ Object



103
104
105
106
107
108
109
# File 'lib/guard/compat/plugin.rb', line 103

def self.deprecation(message, options = {})
  if Guard.const_defined?(:UI)
    Guard::UI.deprecation(message, options)
  else
    $stdout.puts(message)
  end
end

.error(message, options = {}) ⇒ Object



87
88
89
90
91
92
93
# File 'lib/guard/compat/plugin.rb', line 87

def self.error(message, options = {})
  if Guard.const_defined?(:UI)
    Guard::UI.error(message, options)
  else
    $stderr.puts(message)
  end
end

.info(message, options = {}) ⇒ Object



71
72
73
74
75
76
77
# File 'lib/guard/compat/plugin.rb', line 71

def self.info(message, options = {})
  if Guard.const_defined?(:UI)
    Guard::UI.info(message, options)
  else
    $stdout.puts(message)
  end
end

.notify(msg, options = {}) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
# File 'lib/guard/compat/plugin.rb', line 111

def self.notify(msg, options = {})
  return $stdout.puts(msg) unless Guard.const_defined?(:UI)
  return Notifier.notify(msg, options) if Notifier.respond_to?(:notify)

  # test helper was included
  note = 'NOTE: Notification is disabled when testing Guard plugins'\
    ' (it makes no sense)'

  $stderr.puts(note)
  $stdout.puts(msg)
end

.warning(message, options = {}) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/guard/compat/plugin.rb', line 79

def self.warning(message, options = {})
  if Guard.const_defined?(:UI)
    Guard::UI.warning(message, options)
  else
    $stdout.puts(message)
  end
end