Sha256: 58a84dcf6653372e35386a5be9c3c37f4955d2682f10da42005b38da906ef93a

Contents?: true

Size: 466 Bytes

Versions: 3

Compression:

Stored size: 466 Bytes

Contents

#!usr/bin/ruby

require 'inotify'
require 'find'

i = Inotify.new

t = Thread.new do
	i.each_event do |ev|
		p ev.name
		p ev.mask
	end
end

raise("Specify a directory") if !ARGV[0]

Find.find(ARGV[0]) do |e| 
	if ['.svn', 'CVS', 'RCS'].include? File.basename(e) or !File.directory? e
		Find.prune
	else
		begin
			puts "Adding #{e}"
			i.add_watch(e, Inotify::CREATE | Inotify::DELETE | Inotify::MOVE)
		rescue
			puts "Skipping #{e}: #{$!}"
		end
	end
end

t.join

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-inotify-1.0.2 examples/watcher.rb
ruby-inotify-1.0.1 examples/watcher.rb
ruby-inotify-1.0.0 examples/watcher.rb