Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified assets/compass_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 10 additions & 9 deletions lib/compass-growl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


module CompassGrowl
ICON = File.join(File.expand_path('../', __FILE__), '..', 'assets', 'compass_icon.png')
GROWL = GNTP.new
ICON = File.join(File.expand_path('../../', __FILE__), 'assets', 'compass_icon.png')
GROWL = GNTP.new("Compass", "127.0.0.1")

LOADED = "Compass Growl Loaded"
STYLESHEET_SAVED = "Stylesheet Saved"
Expand All @@ -17,30 +17,31 @@ module CompassGrowl
{ :name => STYLESHEET_ERROR, :enabled => true }]
})

def growl(type, message)
def growl(type, title, message, sticky = false)
GROWL.notify({
:name => type,
:title => "Compass",
:title => title,
:text => message,
:icon => "file://#{ICON}"
:icon => ICON,
:sticky => sticky
})
end

def init
CompassGrowl.growl(STYLESHEET_ERROR, "Compass Growl has been initialized")
CompassGrowl.growl(LOADED, "Init", "Compass Growl has been initialized")

config = Compass.configuration

config.on_stylesheet_saved do |filename|
CompassGrowl.growl(STYLESHEET_SAVED, "Stylesheet: #{File.basename(filename)} saved")
CompassGrowl.growl(STYLESHEET_SAVED, "Stylesheet", "#{File.basename(filename)} saved")
end

config.on_sprite_saved do |filename|
CompassGrowl.growl(SPRITE_SAVED, "Sprite: #{File.basename(filename)} saved")
CompassGrowl.growl(SPRITE_SAVED, "Sprite", "#{File.basename(filename)} saved")
end

config.on_stylesheet_error do |filename, error|
CompassGrowl.growl(STYLESHEET_ERROR, "Stylesheet Error: #{File.basename(filename)} \n had the following error:\n #{error}")
CompassGrowl.growl(STYLESHEET_ERROR, "Stylesheet Error", "#{File.basename(filename)} had the following error:\n #{error}", true)
end

end
Expand Down