rails/rails — pull request #9237 by wangjohn (2013-02-10 01:04:32+00:00)
Title: Extending Notifications to know about File System Changes

There is now functionality which allows a user to get notifications about file system changes. The majority of this pull request creates a module which queries for file system changes using the Ruby IO classes (note that it doesn't require any C or operating system specific extensions).

I've added the capability to listen for file additions, modifications, and deletions and send these on to a new notification queue. Subscribing to this queue will allow you to receive file system updates.

The Notifications module is also changed because of this. There is now a notion of the type of Notification one is subscribing to. The regular notifications are the canonical notifications that one could subscribe to in the previous code. However, there is now a filesystem notification that one can subscribe to. There is a completely separate notification queue for each type of notification.

I kept the previous methods for the regular notifications intact for backwards compatibility, but I also included methods such as "subscribe_with_type" or "publish_with_type" which allows you do deal with notifications of a particular type.

The code is still in its infancy and looks pretty raw, so I'm looking forward to comments.