Class: Guard::Lilypond

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/lilypond.rb

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ Lilypond

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:

  • watchers (Array<Guard::Watcher>) (defaults to: [])

    the Guard plugin file watchers

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

    the custom Guard plugin options

Options Hash (options):

  • group (Symbol)

    the group this Guard plugin belongs to

  • any_return (Boolean)

    allow any object to be returned from a watcher



18
19
20
# File 'lib/guard/lilypond.rb', line 18

def initialize(watchers = [], options = {})
  super
end

Instance Method Details

#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



37
38
39
# File 'lib/guard/lilypond.rb', line 37

def run_on_additions(paths)
  compile_files(paths)
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



47
48
49
# File 'lib/guard/lilypond.rb', line 47

def run_on_modifications(paths)
  compile_files(paths)
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



57
58
59
60
61
# File 'lib/guard/lilypond.rb', line 57

def run_on_removals(paths)
  paths.each do |path|
    ::Guard::UI.info "GuardLilypond: removed #{path}", :reset => true
  end
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



27
28
29
# File 'lib/guard/lilypond.rb', line 27

def start
  ::Guard::UI.info 'GuardLilypond: started', :reset => true
end