VERSION | = | '1.0.1' | The current gem version of Guard | |
GUARDFILE_TEMPLATE | = | File.expand_path('../guard/templates/Guardfile', __FILE__) | The Guardfile template for `guard init` | |
HOME_TEMPLATES | = | File.expand_path('~/.guard/templates') | The location of user defined templates |
interactor | [RW] | |
listener | [RW] | |
lock | [RW] | |
options | [RW] |
Add a Guard group.
@param [String] name the group name @option options [Boolean] halt_on_fail if a task execution
should be halted for all Guards in this group if one Guard throws `:task_has_failed`
@return [Guard::Group] the group added (or retrieved from the `@groups` variable if already present)
Detects the paths that have changed.
Deleted paths are prefixed by an exclamation point. @see Guard::Listener#modified_files
@param [Array<String>] paths the watched paths @return [Array<String>] the changed paths
Creates the initial Guardfile template when it does not already exist.
@see Guard::CLI.init
@param [Hash] options The options for creating a Guardfile @option options [Boolean] :abort_on_existence Whether to abort or not when a Guardfile already exists
Adds a command logger in debug mode. This wraps common command execution functions and logs the executed command before execution.
Detects the paths that have been deleted.
Deleted paths are prefixed by an exclamation point. @see Guard::Listener#modified_files
@param [Array<String>] paths the watched paths @return [Array<String>] the deleted paths
Tries to load the Guard main class. This transforms the supplied Guard name into a class name:
When no class is found with the strict case sensitive rules, another try is made to locate the class without matching case:
@param [String] name the name of the Guard @param [Boolean] fail_gracefully whether error messages should not be printed @return [Class, nil] the loaded class
Smart accessor for retrieving a specific group or several groups at once.
@see Guard.guards
@example Filter groups by String or Symbol
Guard.groups('backend') Guard.groups(:backend)
@example Filter groups by Regexp
Guard.groups(/(back|front)end/)
@param [String, Symbol, Regexp] filter the filter to apply to the Groups @return [Array<Group>] the filtered groups
Returns a list of guard Gem names installed locally.
@return [Array<String>] a list of guard gem names
Get the symbol we have to catch when running a supervised task. If we are within a Guard group that has the `:halt_on_fail` option set, we do NOT catch it here, it will be catched at the group level.
@see .run_on_guards
@param [Guard::Guard] guard the Guard to execute @return [Symbol] the symbol to catch
Smart accessor for retrieving a specific guard or several guards at once.
@see Guard.groups
@example Filter Guards by String or Symbol
Guard.guards('rspec') Guard.guards(:rspec)
@example Filter Guards by Regexp
Guard.guards(/rsp.+/)
@example Filter Guards by Hash
Guard.guards({ :name => 'rspec', :group => 'backend' })
@param [String, Symbol, Regexp, Hash] filter the filter to apply to the Guards @return [Array<Guard>] the filtered Guards
Adds the templates of all installed Guard implementations to an existing Guardfile.
@see Guard::CLI.init
Adds the Guardfile template of a Guard implementation to an existing Guardfile.
@see Guard::CLI.init
@param [String] guard_name the name of the Guard or template to initialize
Run a block where the listener and the interactor is blocked.
@yield the block to run
Trigger `run_all` on all Guards currently enabled.
@param [Hash] scopes an hash with a guard or a group scope
Run the `:run_on_change` task. When the option `:watch_all_modifications` is set, the task is split to run changed paths on {Guard::Guard#run_on_change}, whereas deleted paths run on {Guard::Guard#run_on_deletion}.
@param [Array<String>] files the list of files to pass to the task @param [Guard::Guard] guard the guard to run @raise [:task_has_failed] when task has failed
Run a Guard task, but remove the Guard when his work leads to a system failure.
When the Group has `:halt_on_fail` disabled, we‘ve to catch `:task_has_failed` here in order to avoid an uncaught throw error.
@param [Guard::Guard] guard the Guard to execute @param [Symbol] task the task to run @param [Array] args the arguments for the task @raise [:task_has_failed] when task has failed
Initialize the Guard singleton:
@option options [Boolean] clear if auto clear the UI should be done @option options [Boolean] notify if system notifications should be shown @option options [Boolean] verbose if verbose output should be shown @option options [Array<String>] group the list of groups to start @option options [String] watchdir the director to watch @option options [String] guardfile the path to the Guardfile @option options [Boolean] watch_all_modifications watches all file modifications if true
Start Guard by evaluate the `Guardfile`, initialize the declared Guards and start the available file change listener. Main method for Guard that is called from the CLI when guard starts.
@option options [Boolean] clear if auto clear the UI should be done @option options [Boolean] notify if system notifications should be shown @option options [Boolean] debug if debug output should be shown @option options [Array<String>] group the list of groups to start @option options [String] watchdir the director to watch @option options [String] guardfile the path to the Guardfile