class Guard::Guard


the Guard::GuardName instance will be removed from the active guards.
If one of those methods raise an exception other than ‘:task_has_failed`,
you can set the `any_return` option to true.
Guard, but if your Guard want to allow any return value from a watcher,
By default all watchers for a Guard are returning strings of paths to the
at `lib/guard/guard-name/templates/Guardfile`.
Each Guard should provide a template Guardfile located within the Gem
end
end
throw :task_has_failed
if !runner.run()
def run_all
@example Throw :task_has_failed
@see Guard::Group
@see Guard::Hook
option.
and successive guard tasks will be aborted when the group has set the `:halt_on_fail`
throw `:task_has_failed` to indicate that your Guard method was not successful,
by Guard, but I’ll be passed to the “_end” hook for further evaluation. You can
support this kind of task. The return value of each Guard task method is not evaluated
In each of these Guard task methods you have to implement some work when you want to
`run_on_deletion` task methods depending on user interaction and file modification.
Guard will trigger the ‘start`, `stop`, `reload`, `run_all`, `run_on_change` and
Base class that every Guard implementation must inherit from.

def self.init(name)

Parameters:
  • name (String) -- the name of the Guard
def self.init(name)
  if ::Guard::Dsl.guardfile_include?(name)
    ::Guard::UI.info "Guardfile already includes #{ name } guard"
  else
    content = File.read('Guardfile')
    guard   = File.read("#{ ::Guard.locate_guard(name) }/lib/guard/#{ name }/templates/Guardfile")
    File.open('Guardfile', 'wb') do |f|
      f.puts(content)
      f.puts("")
      f.puts(guard)
    end
    ::Guard::UI.info "#{ name } guard added to Guardfile, feel free to edit it"
  end
end

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

Options Hash: (**options)
  • any_return (Boolean) -- allow any object to be returned from a watcher
  • group (Symbol) -- the group this Guard belongs to

Parameters:
  • options (Hash) -- the custom Guard options
  • watchers (Array) -- the Guard file watchers
def initialize(watchers = [], options = {})
  @group = options[:group] ? options.delete(:group).to_sym : :default
  @watchers, @options = watchers, options
end

def reload

Returns:
  • (Object) - the task result

Raises:
  • (:task_has_failed) - when reload has failed
def reload
end

def run_all

Returns:
  • (Object) - the task result

Raises:
  • (:task_has_failed) - when run_all has failed
def run_all
end

def run_on_change(paths)

Returns:
  • (Object) - the task result

Raises:
  • (:task_has_failed) - when run_on_change has failed

Parameters:
  • paths (Array) -- the changes files or paths
def run_on_change(paths)
end

def run_on_deletion(paths)

Returns:
  • (Object) - the task result

Raises:
  • (:task_has_failed) - when run_on_change has failed

Parameters:
  • paths (Array) -- the deleted files or paths
def run_on_deletion(paths)
end

def start

Returns:
  • (Object) - the task result

Raises:
  • (:task_has_failed) - when start has failed
def start
end

def stop

Returns:
  • (Object) - the task result

Raises:
  • (:task_has_failed) - when stop has failed
def stop
end