Git Product home page Git Product logo

fssm's Introduction

FSSM - currently unmaintained

endorse

Monitor API

There are three ways you can run the monitor.

  1. Call monitor with a path parameter, and define callbacks in a block
  2. Call monitor with a block to configure multiple paths and callbacks
  3. Create a monitor object and run each step manually

Monitor with path

This form watches one path, and enters the run loop automatically. The first parameter is the path to watch, and the second parameter is an optional glob pattern or array of glob patterns that a file must match in order to trigger a callback. The default glob, if ommitted, is '**/*'.

FSSM.monitor('/some/directory/', '**/*') do
  update {|base, relative|}
  delete {|base, relative|}
  create {|base, relative|}
end

Monitor with block

This form watches one or more paths, and enters the run loop automatically. The glob configuration call can be ommitted, and defaults to '**/*'.

FSSM.monitor do
  path '/some/directory/' do
    glob '**/*.yml'

    update {|base, relative|}
    delete {|base, relative|}
    create {|base, relative|}
  end

  path '/some/other/directory/' do
    update {|base, relative|}
    delete {|base, relative|}
    create {|base, relative|}
  end
end

Monitor object

This form doesn't enter the run loop automatically.

monitor = FSSM::Monitor.new

monitor.path '/some/directory/' do
  update {|base, relative|}
  delete {|base, relative|}
  create {|base, relative|}
end

monitor.run

Monitoring directories

By default, FSSM monitors changes in files only. To enable monitoring of files and directories, pass option directories => true in a hash to the monitor. Please note that this may not work as expected in all backends. For example:

FSSM::Monitor.new(:directories => true)
FSSM.monitor(dir, file_glob, :directories => true)

When directories are monitored, there's an additional third argument to the callbacks. Instead of

FSSM.monitor('/some/directory/', '**/*') do
  update {|base, relative|}
  delete {|base, relative|}
  create {|base, relative|}
end

you get this:

FSSM.monitor('/some/directory/', '**/*', :directories => true) do
  update {|base, relative, type|}
  delete {|base, relative, type|}
  create {|base, relative, type|}
end

The value of type argument is either :file or :directory.

fssm's People

Contributors

chriseppstein avatar dhruvaljain avatar lucasmoura avatar mattbrictson avatar nex3 avatar pablo-merino avatar tkareine avatar ttilley avatar twisol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fssm's Issues

Support rb-fsevent

In addition to RubyCocoa's fsevents class, please consider supporting rb-fsevent. This is a C extension for interacting with fsevent, and thus does not rely on the built-in OS X Ruby to work.

Fssm breaks with jruby

I am getting the error here while running jruby with fssm. But I do not see any error when I run it with plain ruby
Jruby version - 1.6.5
fssm version - 0.2.8.1

NoMethodError: undefined method `ftype' for nil:NilClass
ftype at /home/ubuntu/.rvm/gems/jruby-1.6.5/gems/fssm-0.2.8.1/lib/fssm/tree.rb:170
call at org/jruby/RubyProc.java:258
each at /home/ubuntu/.rvm/gems/jruby-1.6.5/gems/fssm-0.2.8.1/lib/fssm/tree.rb:39
each at org/jruby/RubyHash.java:1175
each at /home/ubuntu/.rvm/gems/jruby-1.6.5/gems/fssm-0.2.8.1/lib/fssm/tree.rb:35
inject at org/jruby/RubyEnumerable.java:830
ftype at /home/ubuntu/.rvm/gems/jruby-1.6.5/gems/fssm-0.2.8.1/lib/fssm/tree.rb:169
files at /home/ubuntu/.rvm/gems/jruby-1.6.5/gems/fssm-0.2.8.1/lib/fssm/tree.rb:153
cache_entries at /home/ubuntu/.rvm/gems/jruby-1.6.5/gems/fssm-0.2.8.1/lib/fssm/state/directory.rb:64
recache at /home/ubuntu/.rvm/gems/jruby-1.6.5/gems/fssm-0.2.8.1/lib/fssm/state/directory.rb:47
refresh at /home/ubuntu/.rvm/gems/jruby-1.6.5/gems/fssm-0.2.8.1/lib/fssm/state/directory.rb:13
add_handler at /home/ubuntu/.rvm/gems/jruby-1.6.5/gems/fssm-0.2.8.1/lib/fssm/backends/polling.rb:9
path at /home/ubuntu/.rvm/gems/jruby-1.6.5/gems/fssm-0.2.8.1/lib/fssm/monitor.rb:9
monitor at /home/ubuntu/.rvm/gems/jruby-1.6.5/gems/fssm-0.2.8.1/lib/fssm.rb:68
monitor at client.rb:18
(root) at client.rb:121

Any thoughts on this?

rb-fsevent backend doesn't work

When I install rb-fsevent into my compass project, watching breaks. Touches to files are not transmitted to the callbacks. Is this an issue with how compass is using the API or an FSSM bug?

Odd Bug with rb-inotify backend

$ irb -rubygems -rfssm
>> FSSM.monitor {path("/tmp/foo") {update {|b,r| p [:up, b, r]}; create {|b,r| p [:cr, b, r]}; delete {|b,r| p [:del, b, r]};}}
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/spec/root/file.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/lib/fssm/state.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/LICENSE"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/pkg/fssm-0.1.2.gem"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/README.markdown"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/VERSION.yml"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/lib/fssm/backends/inotify.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/lib/fssm/monitor.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/lib/fssm/support.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/profile/prof.html"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/lib/fssm.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/profile/prof-fssm-pathname.html"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/example.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/spec/root/file.css"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/spec/root/file.yml"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/spec/root/duck/quack.txt"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/lib/fssm/backends/polling.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/lib/fssm/backends/rubycocoa/fsevents.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/lib/fssm/backends/fsevents.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/profile/prof-plain-pathname.html"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/profile/prof-pathname.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/spec/path_spec.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/spec/root/moo/cow.txt"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/lib/fssm/pathname.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/fssm.gemspec"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/lib/fssm/tree.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/profile/prof-cache.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/Rakefile"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/lib/fssm/path.rb"]
[:cr, "/tmp/foo", "../../home/nex3/code/fssm/spec/spec_helper.rb"]

This is on Linux, using the rb-inotify backend. Following this, no output is generated when files within the /tmp/foo directory are created or modified.

Pathname#to_s stack overflow on Rubinius

The relevant code is here: https://github.com/ttilley/fssm/blob/master/lib/fssm/pathname.rb#L185-L187

"#{self}" calls to_s on self, which causes infinite recursion. This doesn't occur on 1.9.2 or 1.8.7, but I've heard that subclassing primitive types in MRI causes weird behavior, so I suspect you're relying on that behavior to make it work.

Testing with a class not derived from String shows that it causes a stack overflow on any of 1.8.7, 1.9.2, and Rubinius.

improve documentation around using FSSM inside an OO class

I'm stumped on how to make it work in a pretty basic class:

class Watcher
  def start 
    monitor = FSSM::Monitor.new(:directories => true)
    monitor.path('test_data/', '**/*') do
      update do |base, relative, ftype| 
        output(relative)
      end
      create do |base, relative, ftype| 
        output(relative)
      end
      # don't really care about delete right now
      delete { |base, relative, ftype| puts "DELETED #{relative} (#{ftype})" }   
    end
    monitor.run
  end

  def output(relative)
    puts "WOOT! #{relative}"
  end 
end

In this relatively contrived case, it seems that in the update and create callbacks, it has no visibility to the instance-level output() method. I'm flummoxed on how to solve this. If I instantiate a new Watcher and do watcher.start it runs fine, but as soon as a file change occurs, all I get is:

undefined local variable or method `output' for /Users/mpatterson/mywatcher/test_data:FSSM::Path (FSSM::CallbackError)

(reposted here from an email exchange between ttilley and myself so that he can update the docs with the explanation he gave me)

Polling Backend, Errno::ENOENT on some deletes (race condition?)

### example.rb ###
require 'rubygems'
require 'fssm'

FSSM.monitor('.', '**/*') do
  update {|b, r| puts "Update in #{b} to #{r}"}
  delete {|b, r| puts "Delete in #{b} to #{r}"}
  create {|b, r| puts "#{r} created in #{b}" }
end

### END example.rb ###

$ ruby example.rb

Warning: Unable to load rb-inotify >= 0.5.1. Inotify will be unavailable.
Delete in /path/to to myself
myself created in /path/to
Update in /path/to to myself
/var/lib/gems/1.8/gems/fssm-0.1.4/lib/fssm/pathname.rb:349:in `ftype': No such file or directory - /path/to/myself (Errno::ENOENT)
    from /var/lib/gems/1.8/gems/fssm-0.1.4/lib/fssm/pathname.rb:349:in `ftype'
    from /var/lib/gems/1.8/gems/fssm-0.1.4/lib/fssm/tree.rb:131:in `from_path'
    from /var/lib/gems/1.8/gems/fssm-0.1.4/lib/fssm/tree.rb:68:in `set'
    from /var/lib/gems/1.8/gems/fssm-0.1.4/lib/fssm/tree.rb:149:in `set'

### in another shell ###
$ touch myself
$ rm myself
$ touch myself
$ echo HI > myself
$ rm myself

### END ###

I am able to reproduce this regularly but intermittently. It does not happen every time, maybe 10 - 40% of the time, depending on timing.

uname -a
Linux QA-AUTH02-NY 2.6.28-13-server #44-Ubuntu SMP Tue Jun 2 08:47:41 UTC 2009 i686 GNU/Linux

ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

gem --version
1.3.1

fssm (0.1.4)

Warning: Unable to load rb-inotify >= 0.3.0. Inotify will be unavailable.

I installed rb-inotify (0.7.0) on my Debian System because I'm using Compass and still getting this warning message.
On script/console,
>> require 'rubygems'
=> []
>> gem 'rb-inotify'
=> true
works fine, so I don't understand this warning.

ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
gem 1.3.6
Rails 2.3.5

inotify backend doesn't re-watch the directory after it's been deleted

If a directory is watched using the inotify backend, and the directory is deleted and subsequently recreated, the new directory is not watched.

This is a built-in restriction for the inotify backend, but perhaps it could be worked around either by resorting to the polling backend until the directory comes back or by using inotify to watch the parent directory.

Too many inotify events are caught

The inotify backend catches all available events. This means that it fires events when a file's mtime changes, whenever it's read, etc. Since FSSM only exposes events for file creation, deletion, and modification, it would be prudent to only watch for these events.

Multiple monitors not executing all Ruby code

Considering this code:

FSSM.monitor('.', '**/*.haml') do
    update do |b, r| 
        puts "Changing #{r} to #{File.basename("#{r}", ".haml")}.html"
        %x[haml #{r} #{File.basename("#{r}", ".haml")}.html]
    end
end

FSSM.monitor('.', '**/*.sass') do
    update do |b, r| 
        puts "Changing #{r} to stylesheets/#{File.basename("#{r}", ".sass")}.css"
        %x[sass #{r} stylesheets/#{File.basename("#{r}", ".sass")}.css]
    end
end

FSSM will execute the bash commands in both cases; it will change Haml to HTML and Sass to CSS. However, it will only run the puts in the Haml monitor, not in the Sass monitor. Is that a gotcha of Ruby and to be expected, or is it a bug?

rb-inotify breaks threads

Hi,
rb-inotify seems to break threads, so anything like

Thread.new do
   monitor.run
 end

locks the program.

Though this is not a fssm problem, I think rb-inotify should not be recommended as an optimized backend on Linux, or at least a warning should be issued when trying to run a monitor inside a thread.

Support for CREATE vs CLOSE_WRITE

FSSM is a great, easy way to monitor directories. I am curious about the CREATE event. It appears to me that it fires as soon as the file/dir is created. I want to use this to process the file when it is posted. When using CREATE it appears that my test print statement is printed before the file is completely written. That's where CLOSE_WRITE can come in. CLOSE_WRITE doesn't fire until the file is completely written.

Suppress undesired recommendation

Sorry for bad English, is there a way to suppress recommendations to install additional Gem's?
For now in mail i receives

Message 128:
From [email protected]  Tue May 15 04:10:25 2012
X-Original-To: woto
Delivered-To: [email protected]
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <woto@MacBook-Pro-Ruslan> /bin/bash -l -c 'cd /Users/woto/rails/yaponama && RAILS_ENV=production bundle exec rake app:notify --silent'
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=woto>
X-Cron-Env: <USER=woto>
X-Cron-Env: <HOME=/Users/woto>
Date: Tue, 15 May 2012 04:10:19 +0400 (MSK)

FSSM -> An optimized backend is available for this platform!
FSSM ->     gem install rb-fsevent

Or is there a way to resolve this situation when i developing both on Ubuntu and MacOS and it's OS's require different gems not compatible with each other.

FSSM Crashes for filename changes

I had written a script to monitor a directory of SVG images I had created, and to auto-convert them to PNG files (stored in another directory) whenever I saved the SVG files. I was working on upgrading the script so that it could handle variable DPI values, but ran into a problem: renaming a file while the script is running will cause it to crash.

This is the error output that was given on the command line:

/usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm/path.rb:45:in block in init_callbacks': delete - //home/zauber/TheLordsOfMaelstrom/COMIC/VECTORS/Yggath.svg: wrong number of arguments (3 for 2) (FSSM::CallbackError) from /usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm/path.rb:73:incall'
from /usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm/path.rb:73:in run_callback' from /usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm/path.rb:55:incallback_action'
from /usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm/path.rb:39:in delete' from /usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm/state/directory.rb:32:inblock in deleted'
from /usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm/state/directory.rb:31:in each' from /usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm/state/directory.rb:31:indeleted'
from /usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm/state/directory.rb:16:in refresh' from /usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm/backends/inotify.rb:12:inblock in add_handler'
from /usr/lib/ruby/gems/1.9.1/gems/rb-inotify-0.8.8/lib/rb-inotify/notifier.rb:200:in call' from /usr/lib/ruby/gems/1.9.1/gems/rb-inotify-0.8.8/lib/rb-inotify/notifier.rb:200:inblock in watch'
from /usr/lib/ruby/gems/1.9.1/gems/rb-inotify-0.8.8/lib/rb-inotify/watcher.rb:41:in []' from /usr/lib/ruby/gems/1.9.1/gems/rb-inotify-0.8.8/lib/rb-inotify/watcher.rb:41:incallback!'
from /usr/lib/ruby/gems/1.9.1/gems/rb-inotify-0.8.8/lib/rb-inotify/event.rb:128:in callback!' from /usr/lib/ruby/gems/1.9.1/gems/rb-inotify-0.8.8/lib/rb-inotify/notifier.rb:233:inblock in process'
from /usr/lib/ruby/gems/1.9.1/gems/rb-inotify-0.8.8/lib/rb-inotify/notifier.rb:233:in each' from /usr/lib/ruby/gems/1.9.1/gems/rb-inotify-0.8.8/lib/rb-inotify/notifier.rb:233:inprocess'
from /usr/lib/ruby/gems/1.9.1/gems/rb-inotify-0.8.8/lib/rb-inotify/notifier.rb:216:in run' from /usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm/backends/inotify.rb:20:inrun'
from /usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm/monitor.rb:26:in run' from /usr/lib/ruby/gems/1.9.1/gems/fssm-0.2.7/lib/fssm.rb:20:inmonitor'
from SVG_Monitor_NEW.rb:54:in `

'

symlink resolution broken with fsevents

I ran into this while trying to watch a subdirectory of /var on Mac OS X where /var is a link to private/var.

Run testa.rb and then testb.rb(without stopping testa) and you'll get a bunch of paths printed out that don't actually exist on the filesystem.

testa.rb:
require 'rubygems'
require 'fssm'
require 'tmpdir'

FSSM.monitor do
  path Dir.tmpdir do
    create do |base, relative|
      p "#{base}/#{relative}"
    end
    update do |base, relative|
      p "#{base}/#{relative}"
    end
    delete do |base, relative|
      p "#{base}/#{relative}"
    end
  end
end

testb.rb:
require 'tmpdir'

path = "#{Dir.tmpdir}/fssmsymlinktest"
File.open(path, 'w') do |w|
  w.write("fssm is about to output a bad path")
end
sleep 2
File.delete(path)

FSSM is essentially dead

Getting this when running the example.rb:

Dear developers making use of FSSM in your projects,
FSSM is essentially dead at this point. Further development will
be taking place in the new shared guard/listen project. Please
let us know if you need help transitioning! ^_^b

  • Travis Tilley

But the README on GitHub still shows the "still maintained" image, please fix that and add an explanatory text to the README

crazy talk from FSSM on Ubuntu

I'm trying to monitor a top-level directory for specific things happening in directories below it:

monitor = FSSM::Monitor.new(:directories => true)
monitor.path(@watch_directory, ["**/code.txt", '**/map.xml', '**/data/*.cgi']) do |path|
    path.update do |base, relative, ftype| 
      publish_file_change(relative, 'updated') if ftype == :file
    end
    path.create do |base, relative, ftype| 
      publish_file_change(relative, 'created') if ftype == :file
    end
    path.delete do |base, relative, ftype|
      publish_file_change(relative, 'deleted', false) if ftype == :file
    end
end
monitor.run

my publish_file_change method does a puts just so i can see what happens.

on my Mac, everything works great if I, say, touch a new file foo.cgi in the data directory:

[FILE CREATED] /Users/mpatterson/parser/test_data/test2/data/foo.cgi

but on my production Ubuntu server, exact same code, when I touch foo.cgi in the production directory structure, I get this:

[FILE DELETED] /var/www/html/parser/abc/test/data/foo.cgi
[FILE DELETED] /var/www/html/parser/abc/test/data/v026.cgi
[FILE DELETED] /var/www/html/parser/abc/test/data/v025.cgi
[FILE DELETED] /var/www/html/parser/abc/test/data/v024.cgi
[FILE DELETED] /var/www/html/parser/abc/test/data/v023.cgi
[FILE DELETED] /var/www/html/parser/abc/test/data/v022.cgi

those 'v0xx.cgi' files are other files that ARE in that directory, but neither they nor the foo.cgi file were actually deleted. It doesn't give me the CREATE event for anything.

WTF!?

Is there something I'm blatantly doing wrong in the code?

FSSM::Monitor.file doesn't work

In FSSM 0.2.2, Monitor#file is broken. For example:

FSSM.monitor {|m| m.file("test") {|p| p.create {puts "now it exists"}}}

fails with

NoMethodError: undefined method `exists?' for #<FSSM::Pathname:/home/nweiz/code/haml/test>
        from /home/nweiz/.rvm/gems/ruby-1.8.7-p302/gems/fssm-0.2.2/lib/fssm/state/file.rb:11:in `refresh'
        from /home/nweiz/.rvm/gems/ruby-1.8.7-p302/gems/fssm-0.2.2/lib/fssm/backends/polling.rb:9:in `add_handler'
        from /home/nweiz/.rvm/gems/ruby-1.8.7-p302/gems/fssm-0.2.2/lib/fssm/monitor.rb:15:in `file'
        from (irb):1
        from /home/nweiz/.rvm/gems/ruby-1.8.7-p302/gems/fssm-0.2.2/lib/fssm/support.rb:56:in `call'
        from /home/nweiz/.rvm/gems/ruby-1.8.7-p302/gems/fssm-0.2.2/lib/fssm/support.rb:56:in `use_block'
        from /home/nweiz/.rvm/gems/ruby-1.8.7-p302/gems/fssm-0.2.2/lib/fssm.rb:16:in `monitor'
        from (irb):1

fssm 0.2.7 fails tests with rb-inotify 0.8.6 installed

This is with ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux] on a Gentoo Linux machine. Please let me know if you need more information to track this down. Without rb-inotify all specs pass.

  1) The File System State Monitor monitor when configured to consider files and directories should call create, update, and delete callbacks upon directory renaming in the same directory
     Failure/Error: @handler_results[:update].should include([@tmp_dir, 'root', :directory])
       expected [] to include ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-bbyjna", "root", :directory]
       Diff:
       @@ -1,4 +1,2 @@
       -["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-bbyjna",
       - "root",
       - :directory]
       +[]
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/handler.rb:19:in `handle_matcher'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/extensions/kernel.rb:27:in `should'
     # ./spec/monitor_spec.rb:131
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `instance_eval'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:107:in `with_around_hooks'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:45:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:294:in `run_examples'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `run_examples'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:262:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/reporter.rb:12:in `report'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:21:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'

  2) The File System State Monitor monitor when configured to consider files and directories should call create, update, and delete callbacks upon directory moving to another directory
     Failure/Error: @handler_results[:update].should include([@tmp_dir, 'root', :directory])
       expected [] to include ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-1nb5ggj", "root", :directory]
       Diff:
       @@ -1,4 +1,2 @@
       -["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-1nb5ggj",
       - "root",
       - :directory]
       +[]
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/handler.rb:19:in `handle_matcher'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/extensions/kernel.rb:27:in `should'
     # ./spec/monitor_spec.rb:140
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `instance_eval'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:107:in `with_around_hooks'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:45:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:294:in `run_examples'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `run_examples'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:262:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/reporter.rb:12:in `report'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:21:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'

  3) The File System State Monitor monitor when configured to consider files and directories should call create, update, and delete callbacks upon file renaming in the same directory
     Failure/Error: @handler_results[:update].should include([@tmp_dir, 'root', :directory])
       expected [] to include ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-1665872", "root", :directory]
       Diff:
       @@ -1,4 +1,2 @@
       -["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-1665872",
       - "root",
       - :directory]
       +[]
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/handler.rb:19:in `handle_matcher'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/extensions/kernel.rb:27:in `should'
     # ./spec/monitor_spec.rb:149
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `instance_eval'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:107:in `with_around_hooks'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:45:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:294:in `run_examples'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `run_examples'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:262:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/reporter.rb:12:in `report'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:21:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'

  4) The File System State Monitor monitor when configured to consider files and directories should call create, update, and delete callbacks upon file moving to another directory
     Failure/Error: @handler_results[:update].should include([@tmp_dir, 'root', :directory])
       expected [] to include ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-9h534q", "root", :directory]
       Diff:
       @@ -1,4 +1,2 @@
       -["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-9h534q",
       - "root",
       - :directory]
       +[]
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/handler.rb:19:in `handle_matcher'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/extensions/kernel.rb:27:in `should'
     # ./spec/monitor_spec.rb:158
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `instance_eval'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:107:in `with_around_hooks'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:45:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:294:in `run_examples'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `run_examples'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:262:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/reporter.rb:12:in `report'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:21:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'

  5) The File System State Monitor monitor when configured to consider files and directories should call create callbacks upon directory structure creation, in order
     Failure/Error: @handler_results[:create].should == expected_create_events.map { |(file, type)| [@tmp_dir, file, type] }
       expected: [["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root", :directory], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/duck", :directory], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/duck/quack.txt", :file], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/file.css", :file], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/file.rb", :file], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/file.yml", :file], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/moo", :directory], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/moo/cow.txt", :file], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/yawn", :directory]]
            got: [["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root", :directory], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/moo", :directory], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/moo/cow.txt", :file], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/yawn", :directory], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/file.rb", :file], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/file.yml", :file], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/file.css", :file], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/duck", :directory], ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol", "new_root/duck/quack.txt", :file]] (using ==)
       Diff:


       @@ -2,14 +2,14 @@
          "new_root",
          :directory],
         ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol",
       -  "new_root/duck",
       +  "new_root/moo",
          :directory],
         ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol",
       -  "new_root/duck/quack.txt",
       +  "new_root/moo/cow.txt",
          :file],
         ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol",
       -  "new_root/file.css",
       -  :file],
       +  "new_root/yawn",
       +  :directory],
         ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol",
          "new_root/file.rb",
          :file],

       @@ -17,12 +17,12 @@
          "new_root/file.yml",
          :file],
         ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol",
       -  "new_root/moo",
       -  :directory],
       - ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol",
       -  "new_root/moo/cow.txt",
       +  "new_root/file.css",
          :file],
         ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol",
       -  "new_root/yawn",
       -  :directory]]
       +  "new_root/duck",
       +  :directory],
       + ["/var/tmp/portage/dev-ruby/fssm-0.2.7-r1/temp/d20110813-22103-8zfpol",
       +  "new_root/duck/quack.txt",
       +  :file]]
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/matchers/operator_matcher.rb:48:in `fail_with_message'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/matchers/operator_matcher.rb:70:in `__delegate_operator'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/matchers/operator_matcher.rb:60:in `eval_match'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-expectations-2.6.0/lib/rspec/matchers/operator_matcher.rb:29:in `=='
     # ./spec/monitor_spec.rb:196
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `instance_eval'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:107:in `with_around_hooks'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:45:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:294:in `run_examples'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `run_examples'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:262:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `map'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/reporter.rb:12:in `report'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:21:in `run'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
     # /usr/lib64/ruby/gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'

Finished in 15.97 seconds
26 examples, 5 failures

Monitor directories

I'm probably missing something but, how can I monitor if a directory is added/updated/deleted?

Callback for all changes

I don’t know maybe it is API issue or doc issue, but I didn’t find callback for all changes, not seperated for update, create, delete.

For example, I need to rebuild static site on every change and I want API like this:

FSSM.monitor('/content/', '**/*') do
  changes { rebuild }
end

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

  spec.license = 'MIT'
  # or
  spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

API oddity: why two arguments for block?

The block that is called on update/delete/create has two arguments, base and relative, but I’m not sure how these apply when monitoring files instead of paths using monitor.file(filename, &watcher). base seems to be the entire filename, and relative is then simply ".". Is there a better way to handle this situation?

Do not alter $LOAD_PATH from library itself

Hello,

Noticed that by requiring fssm, $LOAD_PATH gets altered:

https://github.com/ttilley/fssm/blob/master/lib/fssm.rb#L1-2

I've a series of good reasons why you shouldn't alter the LOAD_PATH during a require:

From Sinatra Issue:
sinatra/sinatra#441

The usage of File.dirname will result in a relative path (./) contrary to a full path in some implementations of Ruby.

Since Ruby 1.9.2, $LOAD_PATH is expanded, which means that it will have to expand the paths over and over again and resolve it prior doing a require.

Please remove those lines, since 99% or use cases are covered by RubyGems (lib directory is already in the $LOAD_PATH and you shouldn't play with it)

ruby -Ilib ...

Altering the $LOAD_PATH after RubyGems did for you result in duplicate entries (RubyGems expanded versus non-expanded one)

And from Thin pull request:

macournoyer/thin#80

Thank you.

Detecting modifications between 2 given times.

Hello,

I´m trying to do something like the the FSSM, but, I want to check the changes not every time a change is made, but every for example 10 minutes.
So if the file is the same, nothing happens, and if it has been modified, somehow, a notification.

The reason is that the expected modification rate is 1 per second, or even 20 per second, and I don´t want to spend that many resources that often. Once each ten minutes is ok.

I´m trying to figure out how to use this gem. Maybe stopping it some how, and checking when is recalled for a little time searching for changes, and then stopping killing it again...

If you can suggest me a smart way of coding this, or the combined use of other gems I´d be glad, since my ruby skills are not that good to know if there is another way of reaching this.

Thank you.

Can FSSM watch a file by name ?

Can FSSM watch a file by name, not just the directory its in ?

And just report the changes to that 1 file, how do I pass the name to watch ?

Thanks,
JT

rb-fsevent backend can only monitor a single path at a time

I have the following code:

FSSM.monitor do
  base_dirs.each do |base_dir|
    puts "going to monitor: #{base_dir}"
    path base_dir do
      create {|base, relative| puts "create: #{relative}"}
      update {|base, relative| puts "update: #{relative}"}
      delete {|base, relative| puts "delete: #{relative}"}
    end
  end
end

Where base_dirs is an array of directories.
I do get the following output:

going to monitor: /Users/smyp/development/wetten_leip/xturf_feeds/horse
going to monitor: /Users/smyp/development/wetten_leip/xturf_feeds/sport
going to monitor: /Users/smyp/development/wetten_leip/xturf_feeds/live
going to monitor: /Users/smyp/development/wetten_leip/xturf_feeds/alpha

But no events occur on update, create or delete. If I only have 1 path it works.

Am I missing something on how to monitor multiple directories?

Incorrect path segments for cygwin path

For cygwin paths, following code produces incorrect array of path segments:

require 'rubygems'
require 'fssm'
print "#{FSSM::Pathname.for('/cygdrive/c/tmp').segments.join(', ')}\n"
//, cygdrive, c, tmp

This is due to line 26 of pathname.rb:

  array[0] += File::SEPARATOR if path[0, 3] =~ SEPARATOR_PAT

100% CPU usage then crashes on Ubuntu 9.10

As soon as I run this basic program:

require 'rubygems'
require 'fssm'

FSSM.monitor('.') do
  update {|b, r| puts b+r }
  delete {|b, r| puts b+r }
  create {|b, r| puts b+r }
end

The CPU shoots up to 100%, and about minute later, an error causes the script to exit. Here is the stack trace:

/usr/lib/ruby/gems/1.8/gems/rb-inotify-0.7.0/lib/rb-inotify/event.rb:120:in `initialize': inotify event queue has overflowed. (Exception)
from /usr/lib/ruby/gems/1.8/gems/rb-inotify-0.7.0/lib/rb-inotify/event.rb:100:in `new'
from /usr/lib/ruby/gems/1.8/gems/rb-inotify-0.7.0/lib/rb-inotify/event.rb:100:in `consume'
from /usr/lib/ruby/gems/1.8/gems/rb-inotify-0.7.0/lib/rb-inotify/notifier.rb:236:in `read_events'
from /usr/lib/ruby/gems/1.8/gems/rb-inotify-0.7.0/lib/rb-inotify/notifier.rb:211:in `process'
from /usr/lib/ruby/gems/1.8/gems/rb-inotify-0.7.0/lib/rb-inotify/notifier.rb:194:in `run'
from /usr/lib/ruby/gems/1.8/gems/fssm-0.1.2/lib/fssm/backends/inotify.rb:19:in `run'
from /usr/lib/ruby/gems/1.8/gems/fssm-0.1.2/lib/fssm/monitor.rb:23:in `run'
from /usr/lib/ruby/gems/1.8/gems/fssm-0.1.2/lib/fssm.rb:25:in `monitor'
from broken_monitor.rb:4

I have no idea what's wrong!

Please teach me how to monitoring unit test

Sorry, my english is terrible.

I want to monitoring test in rspec.
i tried below, but "create!" doesn't puts stdout.
Please teach me something wrong point.

Thanks.

https://github.com/onigra/fssm_test

# test.rb

require 'fssm'

module Foo
  def self.run
    FSSM.monitor(File.expand_path("./lib/tmp"), "**/*") do
      create { |monitoring_dir, new_file| puts "create!" }
    end
  end
end

# Foo.run
# test_spec.rb

require 'spec_helper'

describe Foo do
  before :all do
    @path = File.expand_path("./lib/tmp")
    @pid = fork { Foo.run }
  end

  after :all do
    Process.kill "KILL", @pid
    File.delete "#{@path}/file"
  end

  describe ".run" do
    it "puts create!" do
      FileUtils.touch "#{@path}/file"
    end
  end
end

"An optimized backend is available for this platform!"

tody i updated my gems and fssm won't load rb-fsevent.

  • Mac OS X Lion
  • ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
  • fssm 0.2.7
  • rb-fsevent 0.4.3

mMac:sass mathiasschopmans$ compass watch
FSSM -> An optimized backend is available for this platform!
FSSM -> gem install rb-fsevent

Compass is polling for changes. Press Ctrl-C to Stop

any workarounds?

fssm 0.2.8 builds native extension in wrong place

when installing fssm using bundler with the --path option, the native extension is not being built in the specified path. For instance, our rails app is in

/var/web/rails

and we invoke bundler like so:

bundle install --path /var/web/rails/vendor/bundle

however, fssm 0.2.8 still attempts to build the native gem into the system ruby path, which the user running bundle install doesn't have write access to, so the install fails. We've worked around this for now, by pinning fssm to 0.2.7 in our Gemfile, since 0.2.7 doesn't have this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.