# Rev 0.3.0: Now with filesystem monitoring

**URL:** <https://www.ruby-forum.com/t/rev-0-3-0-now-with-filesystem-monitoring/174591>\
**Category:** Ruby\
**Created:** [August 29, 2009, 8:13am UTC](https://www.ruby-forum.com/t/rev-0-3-0-now-with-filesystem-monitoring/174591 "2009-08-29T08:13:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [August 29, 2009, 8:13am UTC](https://www.ruby-forum.com/t/rev-0-3-0-now-with-filesystem-monitoring/174591/1 "2009-08-29T08:13:24Z")

</div>

Rev is a high-performance event library for Ruby, providing event loops  
for  
monitoring network, timer, and now filesystem events. Rev is based on  
the  
libev C library.

[http://github.com/tarcieri/rev/](http://github.com/tarcieri/rev/)

Rev 0.3.0 provides some bugfixes and performance improvements as well as  
a  
slew of new features, including many new extensions to existing APIs  
that  
provide for better integration with the Ruby environment, and a new  
filesystem monitoring API built on the facilities provided by the libev  
event library, including inotify support on Linux.

The new StatWatcher API allows you to monitor any file or directory for  
changes and receive events when changes occur:

– snip –

class MyStatWatcher \< Rev::StatWatcher  
def on\_change  
begin  
puts “#{path} has new status #{File.stat(path).inspect}”  
rescue Errno::ENOENT  
puts “#{path} was deleted”  
end  
end  
end

watcher = MyStatWatcher.new “interesting/file”  
watcher.attach Rev::Loop.default  
Rev::Loop.default.run

– snip –

I know there are many gems already available to provide filesystem  
monitoring, such as directory\_watcher (  
[GitHub - TwP/directory\_watcher: Event notification for file system changes](http://github.com/TwP/directory_watcher/tree/master)), and that  
EventMachine  
already provides EM.watch\_file, but for the Rev users out there, you now  
have the same capabilities with Rev’s asynchronous event loops.

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [August 29, 2009, 4:18pm UTC](https://www.ruby-forum.com/t/rev-0-3-0-now-with-filesystem-monitoring/174591/2 "2009-08-29T16:18:03Z")

</div>

On Sat, Aug 29, 2009 at 12:12 AM, Tony A.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> event library, including inotify support on Linux.

Awesome work Tony!

I for one welcome our new event-loop driven file notification  
overlords. Thanks for adding inotify support in an elegant manner.

Blessings,  
TwP

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [August 31, 2009, 6:49pm UTC](https://www.ruby-forum.com/t/rev-0-3-0-now-with-filesystem-monitoring/174591/3 "2009-08-31T18:49:09Z")

</div>

On Sat, Aug 29, 2009 at 2:12 AM, Tony A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> event library, including inotify support on Linux.  
> rescue Errno::ENOENT

Hi Tony

Does this use fsevents on Mac OSX?

Thanks,  
Rob

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [August 31, 2009, 9:27pm UTC](https://www.ruby-forum.com/t/rev-0-3-0-now-with-filesystem-monitoring/174591/4 "2009-08-31T21:27:12Z")

</div>

On Mon, Aug 31, 2009 at 10:48 AM, Rob S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi Tony
> 
> Does this use fsevents on Mac OSX?

Unfortunately on all platforms besides Linux it’s just using stat()  
periodically, to my knowledge.

If you are interested in having other syscalls supported for filesystem  
monitoring, I can ask on the libev mailing list.
