module Guard::Jasmine::Formatter

The Guard::Jasmine formatter collects console and system notification methods and enhances them with some color information.

Public Class Methods

debug(message, options = {}) click to toggle source

Print a debug message to the console.

@param [String] message the message to print @param [Hash] options the output options @option options [Boolean] :reset reset the UI

# File lib/guard/jasmine/formatter.rb, line 27
def debug(message, options = {})
  Compat::UI.debug(message, options)
end
error(message, options = {}) click to toggle source

Print a red error message to the console.

@param [String] message the message to print @param [Hash] options the output options @option options [Boolean] :reset reset the UI

# File lib/guard/jasmine/formatter.rb, line 37
def error(message, options = {})
  Compat::UI.error(color(message, ';31'), options)
end
info(message, options = {}) click to toggle source

Print an info message to the console.

@param [String] message the message to print @param [Hash] options the output options @option options [Boolean] :reset reset the UI

# File lib/guard/jasmine/formatter.rb, line 17
def info(message, options = {})
  Compat::UI.info(message, options)
end
notify(message, options = {}) click to toggle source

Outputs a system notification.

@param [String] message the message to print @param [Hash] options the output options @option options [Symbol, String] :image the image to use, either :failed, :pending or :success, or an image path @option options [String] :title the title of the system notification

# File lib/guard/jasmine/formatter.rb, line 86
def notify(message, options = {})
  Compat::UI.notify(message, options)
end
spec_failed(message, options = {}) click to toggle source

Print a red spec failed message to the console.

@param [String] message the message to print @param [Hash] options the output options

# File lib/guard/jasmine/formatter.rb, line 66
def spec_failed(message, options = {})
  Compat::UI.info(color(message, ';31'), options)
end
spec_pending(message, options = {}) click to toggle source

Print a yellow pending message to the console.

@param [String] message the message to print @param [Hash] options the output options @option options [Boolean] :reset reset the UI

# File lib/guard/jasmine/formatter.rb, line 57
def spec_pending(message, options = {})
  Compat::UI.info(color(message, ';33'), options)
end
success(message, options = {}) click to toggle source

Print a green success message to the console.

@param [String] message the message to print @param [Hash] options the output options @option options [Boolean] :reset reset the UI

# File lib/guard/jasmine/formatter.rb, line 47
def success(message, options = {})
  Compat::UI.info(color(message, ';32'), options)
end
suite_name(message, options = {}) click to toggle source

Print a red spec failed message to the console.

@param [String] message the message to print @param [Hash] options the output options

# File lib/guard/jasmine/formatter.rb, line 75
def suite_name(message, options = {})
  Compat::UI.info(color(message, ';33'), options)
end

Private Class Methods

color(text, color_code) click to toggle source

Print a info message to the console.

@param [String] text the text to colorize @param [String] color_code the color code

# File lib/guard/jasmine/formatter.rb, line 97
def color(text, color_code)
  Compat::UI.color_enabled? ? "\e[0#{color_code}m#{text}\e[0m" : text
end