Module: Guard::Jasmine::Formatter

Defined in:
lib/guard/jasmine/formatter.rb

Overview

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

Class Method Summary collapse

Class Method Details

.color(text, color_code) ⇒ Object (private)

Print a info message to the console.

Parameters:

  • text (String)

    the text to colorize

  • color_code (String)

    the color code



95
96
97
# File 'lib/guard/jasmine/formatter.rb', line 95

def color(text, color_code)
  ::Guard::UI.send(:color_enabled?) ? "\e[0#{ color_code }m#{ text }\e[0m" : text
end

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

Print a debug message to the console.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: {})

    the output options

Options Hash (options):

  • :reset (Boolean)

    reset the UI



25
26
27
# File 'lib/guard/jasmine/formatter.rb', line 25

def debug(message, options = {})
  ::Guard::UI.debug(message, options)
end

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

Print a red error message to the console.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: {})

    the output options

Options Hash (options):

  • :reset (Boolean)

    reset the UI



35
36
37
# File 'lib/guard/jasmine/formatter.rb', line 35

def error(message, options = {})
  ::Guard::UI.error(color(message, ';31'), options)
end

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

Print an info message to the console.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: {})

    the output options

Options Hash (options):

  • :reset (Boolean)

    reset the UI



15
16
17
# File 'lib/guard/jasmine/formatter.rb', line 15

def info(message, options = {})
  ::Guard::UI.info(message, options)
end

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

Outputs a system notification.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: {})

    the output options

Options Hash (options):

  • :image (Symbol, String)

    the image to use, either :failed, :pending or :success, or an image path

  • :title (String)

    the title of the system notification



84
85
86
# File 'lib/guard/jasmine/formatter.rb', line 84

def notify(message, options = {})
  ::Guard::Notifier.notify(message, options)
end

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

Print a red spec failed message to the console.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: {})

    the output options



64
65
66
# File 'lib/guard/jasmine/formatter.rb', line 64

def spec_failed(message, options = {})
  ::Guard::UI.info(color(message, ';31'), options)
end

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

Print a yellow pending message to the console.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: {})

    the output options

Options Hash (options):

  • :reset (Boolean)

    reset the UI



55
56
57
# File 'lib/guard/jasmine/formatter.rb', line 55

def spec_pending(message, options = {})
  ::Guard::UI.info(color(message, ';33'), options)
end

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

Print a green success message to the console.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: {})

    the output options

Options Hash (options):

  • :reset (Boolean)

    reset the UI



45
46
47
# File 'lib/guard/jasmine/formatter.rb', line 45

def success(message, options = {})
  ::Guard::UI.info(color(message, ';32'), options)
end

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

Print a red spec failed message to the console.

Parameters:

  • message (String)

    the message to print

  • options (Hash) (defaults to: {})

    the output options



73
74
75
# File 'lib/guard/jasmine/formatter.rb', line 73

def suite_name(message, options = {})
  ::Guard::UI.info(color(message, ';33'), options)
end