TCP functionality was removed in Listen 3.0.0 (#319, #218). There are plans to extract this feature to separate gems (#258), until this is finished, you can use by locking the listen gem to version '~> 2.10'.

Note: You should keep track of all started listeners and stop them properly on finish.

Ignore / ignore!

Listen ignores some directories and extensions by default (See DEFAULT_IGNORED_DIRECTORIES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer), you can add ignoring patterns with the ignore option/method or overwrite default with ignore! option/method.

Changes callback

Changes to the listened-to directories gets reported back to the user in a callback.
The registered callback gets invoked, when there are changes, with three parameters:
modified, added and removed paths, in that particular order.
Paths are always returned in their absolute form.

Example:

listener=Listen.to('path/to/app')do|modified,added,removed|# This block will be called when there are changes.
endlistener.startsleep

or ...

# Create a callback
callback=Proc.newdo|modified,added,removed|# This proc will be called when there are changes.
endlistener=Listen.to('dir',&callback)listener.startsleep

Options

All the following options can be set through the Listen.to after the directory path(s) params.