Created
June 14, 2012 22:46
-
-
Save paneq/2933478 to your computer and use it in GitHub Desktop.
Native operating system notifications about rails requests time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/environments/development.rb | |
NOTIFIER = case RUBY_PLATFORM | |
when /linux/ | |
Bundler.require(:linux) | |
Proc.new{|title, text| Libnotify.show(:body => text, :summary => title) } | |
when /darwin|mac/ | |
Bundler.require(:darwin) | |
Proc.new{|title, text| Growl.notify(text, :title => title) } | |
else | |
nil | |
end | |
ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, start, finish, id, payload| | |
NOTIFIER.call(payload[:path], (finish - start).to_s) if NOTIFIER | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment