2011-09-22 22:20:35 +00:00
|
|
|
module Guard
|
|
|
|
|
2011-09-30 09:30:05 +00:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# @example 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 Guard::CLI
|
2011-09-22 22:20:35 +00:00
|
|
|
#
|
|
|
|
class Group
|
|
|
|
|
|
|
|
attr_accessor :name, :options
|
|
|
|
|
|
|
|
# Initialize a Group.
|
|
|
|
#
|
|
|
|
# @param [String] name the name of the group
|
2011-09-30 09:30:05 +00:00
|
|
|
# @param [Hash] options the group options
|
2011-09-22 22:20:35 +00:00
|
|
|
# @option options [Boolean] halt_on_fail if a task execution
|
2011-09-23 08:52:58 +00:00
|
|
|
# should be halted for all Guards in this group if one Guard throws `:task_has_failed`
|
2011-09-22 22:20:35 +00:00
|
|
|
#
|
|
|
|
def initialize(name, options = {})
|
|
|
|
@name = name.to_sym
|
|
|
|
@options = options
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|