lib/guard/ui.rb in guard-1.5.4 vs lib/guard/ui.rb in guard-1.6.0

- old
+ new

@@ -8,19 +8,19 @@ # # If your Guard plugin does some output that is piped into another process for further # processing, please just write it to STDOUT with `puts`. # module UI - + class << self # Get the Guard::UI logger instance # def logger @logger ||= Lumberjack::Logger.new($stderr, self.options) end - + # Get the logger options # # @return [Hash] the logger options # def options @@ -129,30 +129,38 @@ # # @param [String] action the action to show # @param [Hash] scopes hash with a guard or a group scope # def action_with_scopes(action, scopes) - scope_message ||= scopes[:guard] - scope_message ||= scopes[:group] + plugins = scopes[:plugins] || [] + groups = scopes[:groups] || [] + + if plugins.empty? && groups.empty? + plugins = ::Guard.scope[:plugins] || [] + groups = ::Guard.scope[:groups] || [] + end + + scope_message ||= plugins.join(',') unless plugins.empty? + scope_message ||= groups.join(',') unless groups.empty? scope_message ||= 'all' - info "#{action} #{scope_message}" + info "#{ action } #{ scope_message }" end private - + # Filters log messages depending on either the # `:only`` or `:except` option. # # @param [String] plugin the calling plugin name # @yield When the message should be logged - # @yieldparam [String] param the calling plugin name + # @yieldparam [String] param the calling plugin name # def filter(plugin) only = self.options[:only] except = self.options[:except] plugin = plugin || calling_plugin_name - + if (!only && !except) || (only && only.match(plugin)) || (except && !except.match(plugin)) yield plugin end end