Class: Guard::Karma

Inherits:
Plugin
  • Object
show all
Defined in:
lib/guard/karma.rb,
lib/guard/karma/notifier.rb

Defined Under Namespace

Classes: Notifier

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Karma

Initializes a Guard plugin. Don’t do any work here, especially as Guard plugins get initialized even if they are not in an active group!

Parameters:

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

    the custom Guard plugin options

Options Hash (options):

  • watchers (Array<Guard::Watcher>)

    the Guard plugin file watchers

  • group (Symbol)

    the group this Guard plugin belongs to

  • any_return (Boolean)

    allow any object to be returned from a watcher

  • notification (Boolean)

    display notifications when tests run



15
16
17
18
# File 'lib/guard/karma.rb', line 15

def initialize(options = {})
  super
  @notifier = Notifier.new(options)
end

Instance Method Details

#reloadObject

Called when ‘reload|r|z + enter` is pressed. This method should be mainly used for “reload” (really!) actions like reloading passenger/spork/bundler/…

Returns:

  • (Object)

    the task result

Raises:

  • (:task_has_failed)

    when reload has failed



43
44
# File 'lib/guard/karma.rb', line 43

def reload
end

#run_allObject

Called when just ‘enter` is pressed This method should be principally used for long action like running all specs/tests/…

Returns:

  • (Object)

    the task result

Raises:

  • (:task_has_failed)

    when run_all has failed



52
53
54
# File 'lib/guard/karma.rb', line 52

def run_all
  run_cmd
end

#run_on_additions(paths) ⇒ Object

Called on file(s) additions that the Guard plugin watches.

Parameters:

  • paths (Array<String>)

    the changes files or paths

Returns:

  • (Object)

    the task result

Raises:

  • (:task_has_failed)

    when run_on_additions has failed



62
63
64
# File 'lib/guard/karma.rb', line 62

def run_on_additions(paths)
  run_cmd
end

#run_on_modifications(paths) ⇒ Object

Called on file(s) modifications that the Guard plugin watches.

Parameters:

  • paths (Array<String>)

    the changes files or paths

Returns:

  • (Object)

    the task result

Raises:

  • (:task_has_failed)

    when run_on_modifications has failed



72
73
74
# File 'lib/guard/karma.rb', line 72

def run_on_modifications(paths)
  run_cmd
end

#run_on_removals(paths) ⇒ Object

Called on file(s) removals that the Guard plugin watches.

Parameters:

  • paths (Array<String>)

    the changes files or paths

Returns:

  • (Object)

    the task result

Raises:

  • (:task_has_failed)

    when run_on_removals has failed



82
83
84
# File 'lib/guard/karma.rb', line 82

def run_on_removals(paths)
  run_cmd
end

#startObject

Called once when Guard starts. Please override initialize method to init stuff.

Returns:

  • (Object)

    the task result

Raises:

  • (:task_has_failed)

    when start has failed



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

def start
  run_cmd if options[:all_on_start]
end

#stopObject

Called when ‘stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).

Returns:

  • (Object)

    the task result

Raises:

  • (:task_has_failed)

    when stop has failed



34
35
# File 'lib/guard/karma.rb', line 34

def stop
end