Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee9021c
commit 177aaff
Showing
5 changed files
with
513 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
vendor/plugins/silverline/lib/filesystemwatcher/README.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<html> | ||
|
||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> | ||
<meta http-equiv="Content-Language" content="en-us"> | ||
<meta name="AUTHOR" content="Jason Horman"> | ||
<title>Torrent (Workflow)</title> | ||
<style> | ||
BODY { font-family: Tahoma; font-size: 9pt; } | ||
.example { background-color: #00FFCC; border-style: solid; border-width: 1; padding: 3 } | ||
</style> | ||
</head> | ||
|
||
<body bgcolor="#FFFFFF"> | ||
|
||
<p align="center"><b><font size="3">FileSystemWatcher<br> | ||
<br> | ||
</font></b><a href="FileSystemWatcher.1.0.0.zip">current release 1.0.0</a></p> | ||
<p align="left"><b>Overview</b></p> | ||
<p align="left">Simple library for watching events occurring on a file system. | ||
The events watched are CREATED, MODIFIED and DELETED. This solution is (should | ||
be) platform independent. For example, you might use this inside of your server | ||
to monitor changes in your config files.</p> | ||
<p align="left"><b>Example</b></p> | ||
|
||
<div class="example" width="85%"> | ||
require "filesystemwatcher" | ||
<p>watcher = FileSystemWatcher.new()<br> | ||
watcher.addDirectory("/inetpub/ftproot", "*.xml")<br> | ||
watcher.sleepTime = 10<br> | ||
watcher.start { |status,file|<br> | ||
if(status == FileSystemWatcher::CREATED) then<br> | ||
puts "created: #{file}"<br> | ||
elsif(status == FileSystemWatcher::MODIFIED) then<br> | ||
puts "modified: #{file}"<br> | ||
elsif(status == FileSystemWatcher::DELETED then<br> | ||
puts "deleted: #{file}"<br> | ||
end<br> | ||
} | ||
</div> | ||
|
||
<p><b>Installation</b></p> | ||
<p>Run <b>'ruby install.rb'</b>. This will place the libraries in your ruby/lib/site_ruby | ||
directory. There are 2 files, filesystemwatcher.rb and servicestate.rb.</p> | ||
<p><b>General Usage</b></p> | ||
<ol> | ||
<li><b>Create the watcher<br> | ||
<br> | ||
</b>watcher = FileSystemWatcher.new()<b><br> | ||
<br> | ||
</b> | ||
</li> | ||
<li><b>Tell the watcher what to watch<br> | ||
</b><br> | ||
watcher.addDirectory(dir[, expression])<br> | ||
watcher.addFile(fileName)<br> | ||
<br> | ||
You can watch individual files or directories. If you watch a directory you | ||
can specify an ruby Dir[] expression to search that directory for. The | ||
default expression is "**/*" which means any file recursively.<br> | ||
<br> | ||
</li> | ||
<li><b>Optionally specify the sleep time<br> | ||
</b>The watcher uses a single thread to search for changes. This sets that | ||
threads sleep time between iterations.<br> | ||
<br> | ||
watcher.sleepTime = 10<br> | ||
<br> | ||
</li> | ||
<li><b>Optionally specify the threads priority</b><br> | ||
<br> | ||
watcher.priority = 2<br> | ||
<br> | ||
</li> | ||
<li><b>Optionally specify to use MD5 hashs of watched files<br> | ||
</b>Only use this if you know your files are small. This option will | ||
generate a hash of each file and only alert you of modifications if the | ||
files hash value changes.<br> | ||
<br> | ||
watcher.useMD5 = true<br> | ||
<br> | ||
</li> | ||
<li><b>Start Watching<br> | ||
</b>Specify the block to use when a file is created modified or deleted, as | ||
shown in the example at the top.<br> | ||
<br> | ||
</li> | ||
<li><b>Stop Watching<br> | ||
<br> | ||
</b>watcher.stop()<br> | ||
watcher.stopWhen { block }<br> | ||
<br> | ||
The stopWhen method lets you specify a block, and when that block evaluates | ||
to true the watcher will stop. This is provided by the servicestate mixin. | ||
</li> | ||
</ol> | ||
<p><b>Notes</b></p> | ||
<p>If you know that your directory contains many many files consider creating | ||
multiple FileSystemWatcher(s). Each watcher only uses 1 thread so if the number | ||
of directories is large is could slow down notifications.</p> | ||
<p>Also, if you know your files are large be careful with the useMD5 option | ||
since it must read the contents of each file to generate a hash.</p> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.