Fix guard groups.

This commit is contained in:
Michael Kessler 2011-09-20 14:26:27 +02:00
parent 53802ed355
commit 33b52d2955
2 changed files with 9 additions and 9 deletions

View File

@ -81,11 +81,12 @@ module Guard
# Evaluate the DSL methods in the `Guardfile`. # Evaluate the DSL methods in the `Guardfile`.
# #
# @param [Hash] options the Guard options # @param [Hash] options the Guard options
# @option options [Array<Symbol,String>] groups the groups to evaluate
# @option options [String] guardfile the path to a valid Guardfile # @option options [String] guardfile the path to a valid Guardfile
# @option options [String] guardfile_contents a string representing the content of a valid Guardfile # @option options [String] guardfile_contents a string representing the content of a valid Guardfile
# @raise [ArgumentError] when options are not a Hash # @raise [ArgumentError] when options are not a Hash
# #
def evaluate_guardfile(options = { }) def evaluate_guardfile(options = {})
raise ArgumentError.new('No option hash passed to evaluate_guardfile!') unless options.is_a?(Hash) raise ArgumentError.new('No option hash passed to evaluate_guardfile!') unless options.is_a?(Hash)
@@options = options.dup @@options = options.dup
@ -140,9 +141,8 @@ module Guard
exit 1 exit 1
end end
# Get the content to evaluate. # Get the content to evaluate and stores it into
# # the options as :guardfile_contents.
# @return [String] the content of the Guardfile.
# #
def fetch_guardfile_contents def fetch_guardfile_contents
if @@options[:guardfile_contents] if @@options[:guardfile_contents]
@ -263,7 +263,7 @@ module Guard
# guard 'livereload' # guard 'livereload'
# end # end
# #
# @param [String] name the group's name called from the CLI # @param [Symbol, String] name the group's name called from the CLI
# @yield a block where you can declare several guards # @yield a block where you can declare several guards
# #
# @see Dsl#guard # @see Dsl#guard
@ -273,7 +273,7 @@ module Guard
@groups = @@options[:group] || [] @groups = @@options[:group] || []
name = name.to_sym name = name.to_sym
if guard_definition && (@groups.empty? || @groups.map(&:to_sym).include?(name)) if block_given? && (@groups.empty? || @groups.map(&:to_sym).include?(name))
@current_group = name @current_group = name
yield if block_given? yield if block_given?