def guard(name, options = {})
      @plugin_options = options.merge(watchers: [], callbacks: [])

      yield if block_given?

      @current_groups ||= []
      groups = @current_groups && @current_groups.last || [:default]
      groups.each do |group|
        opts = @plugin_options.merge(group: group)
        # TODO: let plugins be added *after* evaluation
        Guard.state.session.plugins.add(name, opts)
      end

      @plugin_options = nil
    end
def guard(name, options = {})
      @plugin_options = options.merge(watchers: [], callbacks: [])

      yield if block_given?

      @current_groups ||= []
      groups = @current_groups && @current_groups.last || [:default]
      groups.each do |group|
        opts = @plugin_options.merge(group: group)
        # TODO: let plugins be added *after* evaluation
        Guard.state.session.plugins.add(name, opts)
      end

      @plugin_options = nil
    end
Declares a Guard plugin to be used when running `guard start`.

 The name parameter is usually the name of the gem without
 the 'guard-' prefix.

 The available options are different for each Guard implementation.

 @example Declare a Guard without `watch` patterns
   guard :rspec

 @example Declare a Guard with a `watch` pattern
   guard :rspec do
     watch %r{.*_spec.rb}
   end

 @param [String] name the Guard plugin name
 @param [Hash] options the options accepted by the Guard plugin
 @yield a block where you can declare several watch patterns and actions

 @see Plugin
 @see Guard.add_plugin
 @see #watch
 @see #group