From 51c171e9da43212884c01eb0e5d34c2feaa59323 Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Tue, 3 Mar 2009 13:35:26 -0800 Subject: [PATCH] - Docs --- README.rdoc | 30 ++++++++++++++++++++++++++++-- Todo.rdoc | 2 +- bin/bind | 2 +- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/README.rdoc b/README.rdoc index ae17301..3fc69a8 100644 --- a/README.rdoc +++ b/README.rdoc @@ -5,9 +5,35 @@ Bind actions to various file system events, helping aid in automation of tasks such as refreshing browser(s) when you update a css / sass / js file. -== Features +== Executable -* Coming soon +The 'bind' executable allows you to perform arbitrary actions +based on several events. Currently only the change (mtime) event +is supported. + +Bind to a single file, outputting its path when changed + $ bind to style.css -e 'puts file.path' + +Refresh Safari, and Firefox in the background to the uri specified when +style.css or reset.css are modified. + $ bind refresh http://localhost/page --files style.css,reset.css --browsers Safari,Firefox + +Refresh local static html when the style you are working on is modified. + $ bind refresh examples/demo.html -f style.css -b Safari + +== Library + +Bind of course supplies a Ruby library as well, which provides the same +functionality as the executable above. + + +Refresh Safari and Firefox, using the RefreshBrowsersHaml action, whenever a haml or +sass file is modified, it will be compiled to '..' (up a directory) preceding the refresh. + + path = 'http://localhost' + action = Bind::Actions::RefreshBrowsersHaml.new path, '..', 'Safari', 'Firefox' + listener = Bind::Listener.new :interval => 1, :debug => $stdout, :action => action, :files => Dir['*.haml'] + Dir['*.sass'] + listener.run! == License: diff --git a/Todo.rdoc b/Todo.rdoc index cd0dfb6..599aa83 100644 --- a/Todo.rdoc +++ b/Todo.rdoc @@ -1,7 +1,7 @@ == Major: -* Add support for an eval BEFORE actions, such as building SASS / HAML +* Add sass / haml support in exec == Minor: diff --git a/bin/bind b/bin/bind index e2be133..0b1f62b 100644 --- a/bin/bind +++ b/bin/bind @@ -14,7 +14,7 @@ command :to do |c| c.syntax = 'bind to [file ...] [options] ' c.summary = 'Bind to modification of a file' c.description = 'Bind to modification of a file or all files within a directory.' - c.example 'Bind to a single file, logging its path when changed', "bind change style.css -e 'puts file'" + c.example 'Bind to a single file, logging its path when changed', "bind to style.css -e 'puts file'" c.option '-e', '--eval STRING', String, 'Evaluate a string of Ruby in context of Bind, so the file local variable is available.' c.when_called do |args, options| populate_common_options options