guard / guard-compass

Guard::Compass automatically rebuilds scss|sass files when a modification occurs taking in account your compass configuration.
https://rubygems.org/gems/guard-compass
MIT License
58 stars 11 forks source link

Compass SyntaxError Growl notifications #3

Closed stefanoverna closed 11 years ago

stefanoverna commented 13 years ago

Hi there, this might interest you, as it adds growl notifications to guard-compass. Don't know if this approach it's too hackish for you, but IFAIK it's the only way to do it.

oliamb commented 13 years ago

Hi Stefan,

I can live with that code :) No time to merge now, but I definitly will.

Thanks!!

ttilley commented 12 years ago

I just wrote something that adds logging of all message types to the notifier. Your call whether or not it's intrusive.

module Compass

  class GuardLogger < Logger
    ACTION_IMAGES = {
      :error     => :failed,
      :warning   => :failed,
      :compile   => :success,
      :overwrite => :success,
      :create    => :success,
      :remove    => :success,
      :exists    => :success,
      :directory => :success,
      :identical => :success,
      :convert   => :success,
      :unchanged => :success
    }

    def record(action, *arguments)
      super
      image = ACTION_IMAGES[action]
      msg = "#{action} #{arguments.join(' ')}"
      ::Guard::Notifier.notify(msg, {:title => 'Compass', :image => image})
    end
  end

  module Commands
    class UpdateProject

      def new_compiler_instance_with_guard(additional_options = {})
        additional_options[:logger] = ::Compass::GuardLogger.new
        new_compiler_instance_without_guard(additional_options)
      end

      alias :new_compiler_instance_without_guard :new_compiler_instance
      alias :new_compiler_instance :new_compiler_instance_with_guard

    end
  end
end