Class: Guard::Group

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

Overview

A group of Guards. There are two reasons why you want to group your guards:

  • You can start only certain Groups from the command line by passing the ‘–group` option.

  • Abort task execution chain on failure within a group.

Examples:

Group that aborts on failure


group :frontend, :halt_on_fail => true do
  guard 'coffeescript', :input => 'spec/coffeescripts', :output => 'spec/javascripts'
  guard 'jasmine-headless-webkit' do
    watch(%r{^spec/javascripts/(.*)\..*}) { |m| newest_js_file("spec/javascripts/#{m[1]}_spec") }
  end
end

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Group

Initialize a Group.

Parameters:

  • name (String)

    the name of the group

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

    the group options

Options Hash (options):

  • halt_on_fail (Boolean)

    if a task execution should be halted for all Guards in this group if one Guard throws ‘:task_has_failed`



30
31
32
33
# File 'lib/guard/group.rb', line 30

def initialize(name, options = {})
  @name    = name.to_sym
  @options = options
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



21
22
23
# File 'lib/guard/group.rb', line 21

def name
  @name
end

#optionsObject

Returns the value of attribute options.



21
22
23
# File 'lib/guard/group.rb', line 21

def options
  @options
end