Class: Guard::Dsl
- Inherits:
-
Object
- Object
- Guard::Dsl
- Defined in:
- lib/guard/dsl.rb
Overview
The Dsl class provides the methods that are used in each Guardfile
to
describe the behaviour of Guard.
The main keywords of the DSL are #guard and #watch. These are necessary to define the used Guard plugins and the file changes they are watching.
You can optionally group the Guard plugins with the #group keyword and ignore and filter certain paths with the #ignore and #filter keywords.
You can set your preferred system notification library with #notification
and pass some optional configuration options for the library. If you don't
configure a library, Guard will automatically pick one with default options
(if you don't want notifications, specify :off
as library). Please see
Notifier for more information about the supported libraries.
A more advanced DSL use is the #callback keyword that allows you to execute arbitrary code before or after any of the Plugin#start, Plugin#stop, Plugin#reload, Plugin#run_all, Plugin#run_on_changes, Plugin#run_on_additions, Plugin#run_on_modifications and Plugin#run_on_removals Guard plugins method. You can even insert more hooks inside these methods. Please checkout the Wiki page for more details.
The DSL will also evaluate normal Ruby code.
There are two possible locations for the Guardfile
:
- The
Guardfile
orguardfile.rb
in the current directory where Guard has been started - The
.Guardfile
in your home directory.
In addition, if a user configuration .guard.rb
in your home directory is
found, it will be appended to the current project Guardfile
.