Readme cleanup

This commit is contained in:
Rémy Coutable 2011-05-07 19:00:21 +02:00
parent df98c4ff4c
commit 057549a84d

View File

@ -10,7 +10,7 @@ Features
* [FSEvent](http://en.wikipedia.org/wiki/FSEvents) support on Mac OS X 10.5+ (without RubyCocoa!, [rb-fsevent gem, >= 0.3.5](https://rubygems.org/gems/rb-fsevent) required). * [FSEvent](http://en.wikipedia.org/wiki/FSEvents) support on Mac OS X 10.5+ (without RubyCocoa!, [rb-fsevent gem, >= 0.3.5](https://rubygems.org/gems/rb-fsevent) required).
* [Inotify](http://en.wikipedia.org/wiki/Inotify) support on Linux ([rb-inotify gem, >= 0.5.1](https://rubygems.org/gems/rb-inotify) required). * [Inotify](http://en.wikipedia.org/wiki/Inotify) support on Linux ([rb-inotify gem, >= 0.5.1](https://rubygems.org/gems/rb-inotify) required).
* [Directory Change Notification](http://msdn.microsoft.com/en-us/library/aa365261\(VS.85\).aspx) suuport on Windows ([rb-fchange, >= 0.0.2](https://rubygems.org/gems/rb-fchange) required) * [Directory Change Notification](http://msdn.microsoft.com/en-us/library/aa365261\(VS.85\).aspx) support on Windows ([rb-fchange, >= 0.0.2](https://rubygems.org/gems/rb-fchange) required).
* Polling on the other operating systems (help us to support more OS). * Polling on the other operating systems (help us to support more OS).
* Automatic & Super fast (when polling is not used) files modifications detection (even new files are detected). * Automatic & Super fast (when polling is not used) files modifications detection (even new files are detected).
* Growl notifications ([growlnotify](http://growl.info/documentation/growlnotify.php) & [growl gem](https://rubygems.org/gems/growl) required). * Growl notifications ([growlnotify](http://growl.info/documentation/growlnotify.php) & [growl gem](https://rubygems.org/gems/growl) required).
@ -22,9 +22,9 @@ Install
Install the gem: Install the gem:
$ gem install guard `$ gem install guard`
Add it to your Gemfile (inside the <tt>test</tt> group): Add it to your Gemfile (inside the `test` group):
``` ruby ``` ruby
gem 'guard' gem 'guard'
@ -32,7 +32,7 @@ gem 'guard'
Generate an empty Guardfile with: Generate an empty Guardfile with:
$ guard init `$ guard init`
Add the guards you need to your Guardfile (see the existing guards below). Add the guards you need to your Guardfile (see the existing guards below).
@ -40,11 +40,11 @@ Add the guards you need to your Guardfile (see the existing guards below).
Install the rb-fsevent gem for [FSEvent](http://en.wikipedia.org/wiki/FSEvents) support: Install the rb-fsevent gem for [FSEvent](http://en.wikipedia.org/wiki/FSEvents) support:
$ gem install rb-fsevent `$ gem install rb-fsevent`
Install the Growl gem if you want notification support: Install the Growl gem if you want notification support:
$ gem install growl `$ gem install growl`
And add it to you Gemfile: And add it to you Gemfile:
@ -56,11 +56,11 @@ gem 'growl'
Install the rb-inotify gem for [inotify](http://en.wikipedia.org/wiki/Inotify) support: Install the rb-inotify gem for [inotify](http://en.wikipedia.org/wiki/Inotify) support:
$ gem install rb-inotify `$ gem install rb-inotify`
Install the Libnotify gem if you want notification support: Install the Libnotify gem if you want notification support:
$ gem install libnotify `$ gem install libnotify`
And add it to you Gemfile: And add it to you Gemfile:
@ -72,19 +72,18 @@ gem 'libnotify'
Install the rb-fchange gem for [Directory Change Notification](http://msdn.microsoft.com/en-us/library/aa365261\(VS.85\).aspx) support: Install the rb-fchange gem for [Directory Change Notification](http://msdn.microsoft.com/en-us/library/aa365261\(VS.85\).aspx) support:
$ gem install rb-fchange `$ gem install rb-fchange`
Usage Usage
----- -----
Just launch Guard inside your Ruby / Rails project with: Just launch Guard inside your Ruby / Rails project with:
$ guard [start] `$ guard [start]`
or if you use Bundler, to run the Guard executable specific to your bundle: or if you use Bundler, to run the Guard executable specific to your bundle:
$ bundle exec guard `$ bundle exec guard`
Command line options Command line options
-------------------- --------------------
@ -101,23 +100,23 @@ Notifications (growl/libnotify) can be disabled with:
Notifications can also be disabled by setting a `GUARD_NOTIFY` environment variable to `false` Notifications can also be disabled by setting a `GUARD_NOTIFY` environment variable to `false`
The guards to start can be specified by group (see the Guardfile DSL below) specifying the <tt>--group</tt> (or <tt>-g</tt>) option: The guards to start can be specified by group (see the Guardfile DSL below) specifying the `--group` (or `-g`) option:
$ guard --group group_name another_group_name $ guard --group group_name another_group_name
$ guard -g group_name another_group_name # shortcut $ guard -g group_name another_group_name # shortcut
Options list is available with: Options list is available with:
$ guard help [TASK] `$ guard help [TASK]`
Signal handlers Signal handlers
--------------- ---------------
Signal handlers are used to interact with Guard: Signal handlers are used to interact with Guard:
* <tt>Ctrl-C</tt> - Calls each guard's <tt>stop</tt> method, in the same order they are declared in the Guardfile, and then quits Guard itself. * `Ctrl-C` - Calls each guard's `stop` method, in the same order they are declared in the Guardfile, and then quits Guard itself.
* <tt>Ctrl-\\</tt> - Calls each guard's <tt>run_all</tt> method, in the same order they are declared in the Guardfile. * `Ctrl-\` - Calls each guard's `run_all` method, in the same order they are declared in the Guardfile.
* <tt>Ctrl-Z</tt> - Calls each guard's <tt>reload</tt> method, in the same order they are declared in the Guardfile. * `Ctrl-Z` - Calls each guard's `reload` method, in the same order they are declared in the Guardfile.
Available Guards Available Guards
---------------- ----------------
@ -126,7 +125,7 @@ Available Guards
### Add a guard to your Guardfile ### Add a guard to your Guardfile
Add it to your Gemfile (inside the <tt>test</tt> group): Add it to your Gemfile (inside the `test` group):
``` ruby ``` ruby
gem '<guard-name>' gem '<guard-name>'
@ -134,21 +133,23 @@ gem '<guard-name>'
Insert default guard's definition to your Guardfile by running this command: Insert default guard's definition to your Guardfile by running this command:
$ guard init <guard-name> `$ guard init <guard-name>`
You are good to go! You are good to go!
Guardfile DSL Guardfile DSL
------------- -------------
The Guardfile DSL consists of just three simple methods: <tt>guard</tt>, <tt>watch</tt> & <tt>group</tt>. The Guardfile DSL consists of just three simple methods: `guard`, `watch` & `group`.
Required: Required:
* The <tt>guard</tt> method allows you to add a guard with an optional hash of options.
* The <tt>watch</tt> method allows you to define which files are supervised by this guard. An optional block can be added to overwrite the paths sent to the <tt>run_on_change</tt> guard method or to launch any arbitrary command. * The `guard` method allows you to add a guard with an optional hash of options.
* The `watch` method allows you to define which files are supervised by this guard. An optional block can be added to overwrite the paths sent to the `run_on_change` guard method or to launch any arbitrary command.
Optional: Optional:
* The <tt>group</tt> method allows you to group several guards together. Groups to be run can be specified with the Guard DSL option <tt>--group</tt> (or <tt>-g</tt>). This comes in handy especially when you have a huge Guardfile and want to focus your development on a certain part.
* The `group` method allows you to group several guards together. Groups to be run can be specified with the Guard DSL option `--group` (or `-g`). This comes in handy especially when you have a huge Guardfile and want to focus your development on a certain part.
Example: Example:
@ -184,7 +185,7 @@ end
Create a new guard Create a new guard
------------------ ------------------
Creating a new guard is very easy, just create a new gem (<tt>bundle gem</tt> if you use Bundler) with this basic structure: Creating a new guard is very easy, just create a new gem (`bundle gem` if you use Bundler) with this basic structure:
lib/ lib/
guard/ guard/
@ -193,7 +194,7 @@ Creating a new guard is very easy, just create a new gem (<tt>bundle gem</tt> if
Guardfile (needed for guard init <guard-name>) Guardfile (needed for guard init <guard-name>)
guard-name.rb guard-name.rb
<tt>Guard::GuardName</tt> (in <tt>lib/guard/guard-name.rb</tt>) must inherit from <tt>Guard::Guard</tt> and should overwrite at least one of the five basic <tt>Guard::Guard</tt> instance methods. Example: `Guard::GuardName` (in `lib/guard/guard-name.rb`) must inherit from `Guard::Guard` and should overwrite at least one of the five basic `Guard::Guard` instance methods. Example:
``` ruby ``` ruby
require 'guard' require 'guard'
@ -254,7 +255,7 @@ Alternatively, a new guard can be added inline to a Guardfile with this basic st
require 'guard/guard' require 'guard/guard'
module ::Guard module ::Guard
class Example < ::Guard::Guard class InlineGuard < ::Guard::Guard
def run_all def run_all
true true
end end
@ -279,3 +280,8 @@ Author
------ ------
[Thibaud Guillaume-Gentil](https://github.com/thibaudgg) [Thibaud Guillaume-Gentil](https://github.com/thibaudgg)
Contributors
------
https://github.com/guard/guard/contributors