Skip to content

Commit

Permalink
Housecleaning.
Browse files Browse the repository at this point in the history
History, License, config, Manifest, blah blah. README is the important bit.
  • Loading branch information
ymendel committed Jun 15, 2008
1 parent 4bc6ed1 commit e2dc633
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 42 deletions.
2 changes: 1 addition & 1 deletion History.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
== 0.0.1 2008-06-11
== 0.0.1 2008-06-15

* 1 major enhancement:
* Initial release
2 changes: 1 addition & 1 deletion License.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2008 FIXME full name
Copyright (c) 2008 Ezwan Aizat bin Abdullah Faiz, Eloy Duran, Rubaidh Ltd., Yossef Mendelssohn

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
4 changes: 4 additions & 0 deletions Manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ Rakefile
config/hoe.rb
config/requirements.rb
lib/fsevents.rb
lib/fsevents/event.rb
lib/fsevents/stream.rb
lib/fsevents/version.rb
script/console
script/destroy
script/generate
setup.rb
spec/event_spec.rb
spec/fsevents_spec.rb
spec/spec.opts
spec/spec_helper.rb
spec/stream_spec.rb
tasks/deployment.rake
tasks/environment.rake
tasks/rspec.rake
Expand Down
119 changes: 83 additions & 36 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,95 @@
= fsevents

* FIX (url)
http://rubyforge.org/projects/yomendel/
http://github.com/ymendel/fsevents

== DESCRIPTION:

FIX (describe your package)

== FEATURES/PROBLEMS:

* FIX (list of features or problems)

This is intended as a simple, usable FSEvents API. Rather than directly using the Carbon framework and a bunch of methods on OSX, you can pretend you're using a normal Ruby object.

Much of this was inspired by or almost directly taken from various sources:

* Ezwan Aizat bin Abdullah Faiz's excellent article on using FSEvents with autotest instead of polling -- http://rails.aizatto.com/2007/11/28/taming-the-autotest-beast-with-fsevents/
This was a major inspiration, especially because (no offense intended) it's so nasty. It shows just how much setup is necessary to do something that should be simple.
* Rucola's fsevents.rb -- http://rucola.svn.superalloy.nl/browser/r193/trunk/lib/rucola/fsevents.rb
I was tempted to use this directly, but it's not yet part of the gem. On top of that, requiring Rucola only to use FSEvents seems a little much.
* rubaidh's fsevent at master -- http://github.com/rubaidh/fsevent/ -- which gave me a few ideas for organization.

If you bother to look, you'll notice the license includes names other than my own. I may have made some improvements and done it all in BDD style, but I had a good foundation to work on. In the words of Isaac Newton, "If I have seen a little further it is by standing on the shoulders of Giants."

== SYNOPSIS:

FIX (code sample of usage)

It doesn't take much to set up an FSEvent stream. At its simplest, it looks like this:

require 'fsevents'

stream = FSEvents::Stream.watch('/tmp') { |events| p events }
stream.run

That will enter a loop that continually watches the stream and prints out the events. Try it and make some new files in /tmp.

You may want more details on the events, so just give it a better block.

require 'fsevents'

stream = FSEvents::Stream.watch('/tmp') do |events|
events.each do |event|
p event.modified_files
end
end
stream.run

Try that and make some new files in /tmp. Exciting, isn't it?

FSEvents::Stream.watch takes some options, most of which I fully admit I don't understand because I have little desire to read the documentation on FSEvents itself. One obvious option is latency, which the number of seconds to wait until an event is reported. A higher number allows FSEvents to bundle events.

stream = FSEvents::Stream.watch('/tmp', :latency => 15) {} # default is 1.0

# Like I said, I don't know what this means. The default is 0, though.
stream = FSEvents::Stream.watch('/tmp', :flags => 27) {}

stream = FSEvents::Stream.watch('/tmp', '/usr/local') {} # Yes, you can give multiple paths

stream = FSEvents::Stream.watch # no path means watch Dir.pwd

FSEvents::Stream.watch is probably the most common entry point, but there are others. You can simply initialize an FSEvents::Stream object with .new, but then the stream needs to be created, scheduled and started. There are a few convenience methods defined to make this easier. The following blocks of code are all equivalent.

stream = FSEvents::Stream.new('/tmp') {}
stream.create
stream.schedule
stream.start

stream = FSEvents::Stream.new('/tmp') {}
stream.create
stream.startup

stream = FSEvents::Stream.create('/tmp') {}
stream.startup

stream = FSEvents::Stream.watch('/tmp') {}

Just as a stream can be started, it can also be stopped (paused, more like, since apparently you can resume it later).

stream.stop

A stream can also be invalidated and release it.

stream.invalidate

stream.release

stream.shutdown # stops, invalidates, and releases the stream


From what I can tell, entering the run loop requires an interrupt to get back out. Bear that in mind.

== REQUIREMENTS:

* FIX (list of requirements)
* OS X, of course. How exactly were you expecting to use FSEvents?
* RubyCocoa

Note that the easiest way to have this work is use the stock Ruby install with Leopard.

== INSTALL:

* FIX (sudo gem install, anything else)

== LICENSE:

(The MIT License)

Copyright (c) 2008 FIX

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
sudo gem install fsvents
8 changes: 4 additions & 4 deletions config/hoe.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require 'fsevents/version'

AUTHOR = 'FIXME full name' # can also be an array of Authors
EMAIL = "FIXME email"
DESCRIPTION = "description of gem"
AUTHOR = 'Yossef Mendelssohn' # can also be an array of Authors
EMAIL = "ymendel@pobox.com"
DESCRIPTION = "Simple, usable FSEvents API"
GEM_NAME = 'fsevents' # what ppl will type to install your gem
RUBYFORGE_PROJECT = 'fsevents' # The unix name for your project
RUBYFORGE_PROJECT = 'yomendel' # The unix name for your project
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
EXTRA_DEPENDENCIES = [
Expand Down

0 comments on commit e2dc633

Please sign in to comment.