Merge branch 'master' of github.com:guard/guard

This commit is contained in:
Thibaud Guillaume-Gentil 2011-08-16 09:06:23 +02:00
commit 8144a43726
12 changed files with 193 additions and 201 deletions

View File

@ -1,3 +1,10 @@
## 0.6.1 - August 15, 2011
### Bugs fixes:
- Pull request [#120](https://github.com/guard/guard/pull/120): remove guardfile_contents when re-evaluating so that the Guardfile gets reloaded correctly. ([@mordaroso][])
- Pull request [#119](https://github.com/guard/guard/pull/119): Dsl.evaluate_guardfile uses all groups if none specified. ([@ches][])
## 0.6.0 - August 13, 2011
### Bugs fixes:
@ -194,8 +201,10 @@
[@brainopia]: https://github.com/brainopia
[@bronson]: https://github.com/bronson
[@capotej]: https://github.com/capotej
[@ches]: https://github.com/ches
[@chrisberkhout]: https://github.com/chrisberkhout
[@dnagir]: https://github.com/dnagir
[@docwhat]: https://github.com/docwhat
[@etehtsea]: https://github.com/etehtsea
[@fnichol]: https://github.com/fnichol
[@Gazer]: https://github.com/Gazer
@ -208,6 +217,7 @@
[@koshigoe]: https://github.com/koshigoe
[@mcmire]: https://github.com/mcmire
[@mislav]: https://github.com/mislav
[@mordaroso]: https://github.com/mordaroso
[@nestegg]: https://github.com/nestegg
[@netzpirat]: https://github.com/netzpirat
[@nicksieger]: https://github.com/nicksieger

View File

@ -1,4 +1,4 @@
source "http://rubygems.org"
source :rubygems
gemspec
@ -8,6 +8,10 @@ group :guard do
gem 'guard-ronn'
end
group :test do
gem 'fuubar'
end
require 'rbconfig'
if RbConfig::CONFIG['target_os'] =~ /darwin/i

View File

@ -1,9 +1,13 @@
guard 'rspec', :version => 2, :keep_failed => false, :cli => '-f doc' do
guard :rspec, :version => 2, :keep_failed => false, :cli => '--format Fuubar' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end
guard :ronn do
watch(%r{^man/.+\.ronn?$})
end
# require 'guard/guard'
#
# module ::Guard
@ -17,7 +21,3 @@ end
# group "exceptional" do
# guard :breaking
# end
guard 'ronn' do
watch(%r{^man/.+\.m(ark)?d(own)?$})
end

View File

@ -15,7 +15,12 @@ Features
* 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).
* Libnotify notifications ([libnotify gem](https://rubygems.org/gems/libnotify) required).
* Tested on Ruby 1.8.7, 1.9.2 && ree.
* Tested against Ruby 1.8.7, 1.9.2 and REE.
Screencast
----------
Ryan Bates made a screencast on Guard, you can view it here: http://railscasts.com/episodes/264-guard
Install
-------
@ -244,7 +249,7 @@ Required:
Optional:
* 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 guard's `#run_on_change` method or to launch any arbitrary command.
* 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.
* 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. Guards that don't belong to a group are considered global and are always run.
Example:

View File

@ -14,6 +14,7 @@ module Guard
def reevaluate_guardfile
::Guard.guards.clear
@@options.delete(:guardfile_contents)
Dsl.evaluate_guardfile(@@options)
msg = "Guardfile has been re-evaluated."
UI.info(msg)
@ -104,7 +105,8 @@ module Guard
end
def group(name, &guard_definition)
guard_definition.call if guard_definition && (@@options[:group].empty? || @@options[:group].include?(name.to_s))
@groups = @@options[:group] || []
guard_definition.call if guard_definition && (@groups.empty? || @groups.include?(name.to_s))
end
def guard(name, options = {}, &watch_definition)

View File

@ -1,3 +1,3 @@
module Guard
VERSION = "0.6.0" unless defined? Guard::VERSION
VERSION = "0.6.1" unless defined? Guard::VERSION
end

View File

@ -10,7 +10,7 @@
Guard is a command line tool that easily handle events on files modifications\.
.
.SH "SYNOPSIS"
guard \fIcommand\fR \fIoptions\fR
\fBguard <COMMAND> <OPTIONS>\fR
.
.SH "COMMANDS"
.
@ -21,103 +21,54 @@ Starts Guard\. This is the default command if none is provided\.
The following options are available:
.
.P
\fB\-c\fR/\fB\-\-clear\fR
.
.IP "" 4
.
.nf
Clears the Shell after each change\.
.
.fi
.
.IP "" 0
\fB\-c\fR, \fB\-\-clear\fR Clears the Shell after each change\.
.
.P
\fB\-n\fR/\fB\-\-notify\fR \fIflag\fR
.
.IP "" 4
.
.nf
Disable notifications (Growl or Libnotify depending on your system)\.
Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false\.
The <flag> part can be passed to guard using true/false or t/f\.
.
.fi
.
.IP "" 0
\fB\-n\fR, \fB\-\-notify\fR \fIFLAG\fR Disable notifications (Growl or Libnotify depending on your system)\. Notifications can be disabled globally by setting a GUARD_NOTIFY environment variable to false\. FLAG can be \fBtrue\fR/\fBfalse\fR or \fBt\fR/\fBf\fR\.
.
.P
\fB\-d\fR/\fB\-\-debug\fR
.
.IP "" 4
.
.nf
Runs Guard in debug mode\.
.
.fi
.
.IP "" 0
\fB\-d\fR, \fB\-\-debug\fR Runs Guard in debug mode\.
.
.P
\fB\-g\fR/\fB\-\-group\fR \fIgroup\fR \.\.\.
.
.IP "" 4
.
.nf
Runs only the groups specified\.
.
.fi
.
.IP "" 0
\fB\-g\fR, \fB\-\-group\fR \fIGROUP1\fR \fIGROUP2\fR\.\.\. Runs only the groups specified by GROUP1, GROUP2 etc\. Groups name should be separated by spaces\. Guards that don\'t belong to a group are considered global and are always run\.
.
.P
\fB\-w\fR/\fB\-\-watchdir\fR \fIfolder\fR
.
.IP "" 4
.
.nf
Specify the directory to watch\.
.
.fi
.
.IP "" 0
\fB\-w\fR, \fB\-\-watchdir\fR \fIPATH\fR
.
.P
\fB\-G\fR/\fB\-\-guardfile\fR \fIfile\fR
Tells Guard to watch PATH instead of \fB\./\fR\.
.
.IP "" 4
.P
\fB\-G\fR, \fB\-\-guardfile\fR \fIFILE\fR Tells Guard to use FILE as its Guardfile instead of \fB\./Guardfile\fR or \fB~/\.Guardfile\fR\.
.
.nf
Specify a Guardfile by giving its path\.
.SS "init [GUARD]"
If no Guardfile is present in the current directory, creates an empty Guardfile\.
.
.fi
.
.IP "" 0
.
.SS "init [guard]"
Add the requested guard\'s default Guardfile configuration to the current Guardfile\.
.P
If \fIGUARD\fR is present, add its default Guardfile configuration to the current Guardfile\. Note that \fIGUARD\fR is the guard\'s name without the \fBguard\-\fR prefix\. For instance to initialize guard\-rspec, run \fBguard init rspec\fR\.
.
.SS "list"
Lists guards that can be used with the \fBinit\fR command\.
.
.SS "\-T/show"
.SS "\-T, show"
List defined groups and guards for the current Guardfile\.
.
.SH "OPTIONS"
.
.TP
\fB\-h\fR
.SS "\-h, help [COMMAND]"
List all of Guard\'s available commands\.
.
.SS "start"
.P
If \fICOMMAND\fR is given, displays a specific help for \fITASK\fR\.
.
.SH "EXAMPLES"
Initialize Guard and a specific guard at the same time:
.
.P
\fB[bundle exec] guard init [rspec]\fR
.
.P
Run Guard:
.
.P
\fB[bundle exec] guard [start] \-\-watchdir ~/dev \-\-guardfile ~/env/Guardfile \-\-clear \-\-group backend frontend \-\-notify false \-\-debug\fR
.
.P

View File

@ -57,7 +57,6 @@
<a href="#DESCRIPTION">DESCRIPTION</a>
<a href="#SYNOPSIS">SYNOPSIS</a>
<a href="#COMMANDS">COMMANDS</a>
<a href="#OPTIONS">OPTIONS</a>
<a href="#EXAMPLES">EXAMPLES</a>
<a href="#AUTHORS-CONTRIBUTORS">AUTHORS / CONTRIBUTORS</a>
<a href="#WWW">WWW</a>
@ -80,71 +79,69 @@
<h2 id="SYNOPSIS">SYNOPSIS</h2>
<p>guard <var>command</var> <var>options</var></p>
<p><code>guard &lt;COMMAND> &lt;OPTIONS></code></p>
<h2 id="COMMANDS">COMMANDS</h2>
<h3 id="start">start</h3>
<p> Starts Guard. This is the default command if none is provided.</p>
<p>Starts Guard. This is the default command if none is provided.</p>
<p>The following options are available:</p>
<p> <code>-c</code>/<code>--clear</code></p>
<p><code>-c</code>, <code>--clear</code>
Clears the Shell after each change.</p>
<pre><code> Clears the Shell after each change.
</code></pre>
<p><code>-n</code>, <code>--notify</code> <var>FLAG</var>
Disable notifications (Growl or Libnotify depending on your system).
Notifications can be disabled globally by setting a GUARD_NOTIFY environment variable to false.
FLAG can be <code>true</code>/<code>false</code> or <code>t</code>/<code>f</code>.</p>
<p> <code>-n</code>/<code>--notify</code> <var>flag</var></p>
<p><code>-d</code>, <code>--debug</code>
Runs Guard in debug mode.</p>
<pre><code> Disable notifications (Growl or Libnotify depending on your system).
Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false.
The &lt;flag> part can be passed to guard using true/false or t/f.
</code></pre>
<p><code>-g</code>, <code>--group</code> <var>GROUP1</var> <var>GROUP2</var>...
Runs only the groups specified by GROUP1, GROUP2 etc.
Groups name should be separated by spaces.
Guards that don't belong to a group are considered global and are always run.</p>
<p> <code>-d</code>/<code>--debug</code></p>
<p><code>-w</code>, <code>--watchdir</code> <var>PATH</var></p>
<pre><code> Runs Guard in debug mode.
</code></pre>
<p>Tells Guard to watch PATH instead of <code>./</code>.</p>
<p> <code>-g</code>/<code>--group</code> <var>group</var> ...</p>
<p><code>-G</code>, <code>--guardfile</code> <var>FILE</var>
Tells Guard to use FILE as its Guardfile instead of <code>./Guardfile</code> or <code>~/.Guardfile</code>.</p>
<pre><code> Runs only the groups specified.
</code></pre>
<h3 id="init-GUARD-">init [GUARD]</h3>
<p> <code>-w</code>/<code>--watchdir</code> <var>folder</var></p>
<p>If no Guardfile is present in the current directory, creates an empty Guardfile.</p>
<pre><code> Specify the directory to watch.
</code></pre>
<p> <code>-G</code>/<code>--guardfile</code> <var>file</var></p>
<pre><code> Specify a Guardfile by giving its path.
</code></pre>
<h3 id="init-guard-">init [guard]</h3>
<p> Add the requested guard's default Guardfile configuration to the current Guardfile.</p>
<p>If <var>GUARD</var> is present, add its default Guardfile configuration to the current Guardfile.
Note that <var>GUARD</var> is the guard's name without the <code>guard-</code> prefix.
For instance to initialize guard-rspec, run <code>guard init rspec</code>.</p>
<h3 id="list">list</h3>
<p> Lists guards that can be used with the <code>init</code> command.</p>
<p>Lists guards that can be used with the <code>init</code> command.</p>
<h3 id="-T-show">-T/show</h3>
<h3 id="-T-show">-T, show</h3>
<p> List defined groups and guards for the current Guardfile.</p>
<p>List defined groups and guards for the current Guardfile.</p>
<h2 id="OPTIONS">OPTIONS</h2>
<h3 id="-h-help-COMMAND-">-h, help [COMMAND]</h3>
<dl>
<dt class="flush"><code>-h</code></dt><dd>List all of Guard's available commands.</dd>
</dl>
<p>List all of Guard's available commands.</p>
<h3 id="start">start</h3>
<p>If <var>COMMAND</var> is given, displays a specific help for <var>TASK</var>.</p>
<h2 id="EXAMPLES">EXAMPLES</h2>
<p>Initialize Guard and a specific guard at the same time:</p>
<p><code>[bundle exec] guard init [rspec]</code></p>
<p>Run Guard:</p>
<p><code>[bundle exec] guard [start] --watchdir ~/dev --guardfile ~/env/Guardfile --clear --group backend frontend --notify false --debug</code></p>
<p>or in a more concise way:</p>

View File

@ -1,77 +0,0 @@
guard(1) -- Guard keeps an eye on your file modifications.
========================================================
## DESCRIPTION
Guard is a command line tool that easily handle events on files modifications.
## SYNOPSIS
guard <command> <options>
## COMMANDS
### start
Starts Guard. This is the default command if none is provided.
The following options are available:
`-c`/`--clear`
Clears the Shell after each change.
`-n`/`--notify` <flag>
Disable notifications (Growl or Libnotify depending on your system).
Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false.
The <flag> part can be passed to guard using true/false or t/f.
`-d`/`--debug`
Runs Guard in debug mode.
`-g`/`--group` <group> ...
Runs only the groups specified.
`-w`/`--watchdir` <folder>
Specify the directory to watch.
`-G`/`--guardfile` <file>
Specify a Guardfile by giving its path.
### init [guard]
Add the requested guard's default Guardfile configuration to the current Guardfile.
### list
Lists guards that can be used with the `init` command.
### -T/show
List defined groups and guards for the current Guardfile.
## OPTIONS
* `-h`:
List all of Guard's available commands.
### start
## EXAMPLES
`[bundle exec] guard [start] --watchdir ~/dev --guardfile ~/env/Guardfile --clear --group backend frontend --notify false --debug`
or in a more concise way:
`[bundle exec] guard [start] -w ~/dev -G ~/env/Guardfile -c -g backend frontend -n f -d`
## AUTHORS / CONTRIBUTORS
Thibaud Guillaume-Gentil is the main author.
A list of contributors based on all commits can be found here:
https://github.com/guard/guard/contributors
For an exhaustive list of all the contributors, please see the CHANGELOG:
https://github.com/guard/guard/blob/master/CHANGELOG.md
This manual has been written by Remy Coutable.
## WWW
https://github.com/guard/guard

93
man/guard.ronn Normal file
View File

@ -0,0 +1,93 @@
guard(1) -- Guard keeps an eye on your file modifications.
========================================================
## DESCRIPTION
Guard is a command line tool that easily handle events on files modifications.
## SYNOPSIS
`guard <COMMAND> <OPTIONS>`
## COMMANDS
### start
Starts Guard. This is the default command if none is provided.
The following options are available:
`-c`, `--clear`
Clears the Shell after each change.
`-n`, `--notify` <FLAG>
Disable notifications (Growl or Libnotify depending on your system).
Notifications can be disabled globally by setting a GUARD_NOTIFY environment variable to false.
FLAG can be `true`/`false` or `t`/`f`.
`-d`, `--debug`
Runs Guard in debug mode.
`-g`, `--group` <GROUP1> <GROUP2>...
Runs only the groups specified by GROUP1, GROUP2 etc.
Groups name should be separated by spaces.
Guards that don't belong to a group are considered global and are always run.
`-w`, `--watchdir` <PATH>
Tells Guard to watch PATH instead of `./`.
`-G`, `--guardfile` <FILE>
Tells Guard to use FILE as its Guardfile instead of `./Guardfile` or `~/.Guardfile`.
### init [GUARD]
If no Guardfile is present in the current directory, creates an empty Guardfile.
If <GUARD> is present, add its default Guardfile configuration to the current Guardfile.
Note that <GUARD> is the guard's name without the `guard-` prefix.
For instance to initialize guard-rspec, run `guard init rspec`.
### list
Lists guards that can be used with the `init` command.
### -T, show
List defined groups and guards for the current Guardfile.
### -h, help [COMMAND]
List all of Guard's available commands.
If <COMMAND> is given, displays a specific help for <TASK>.
## EXAMPLES
Initialize Guard and a specific guard at the same time:
`[bundle exec] guard init [rspec]`
Run Guard:
`[bundle exec] guard [start] --watchdir ~/dev --guardfile ~/env/Guardfile --clear --group backend frontend --notify false --debug`
or in a more concise way:
`[bundle exec] guard [start] -w ~/dev -G ~/env/Guardfile -c -g backend frontend -n f -d`
## AUTHORS / CONTRIBUTORS
Thibaud Guillaume-Gentil is the main author.
A list of contributors based on all commits can be found here:
https://github.com/guard/guard/contributors
For an exhaustive list of all the contributors, please see the CHANGELOG:
https://github.com/guard/guard/blob/master/CHANGELOG.md
This manual has been written by Remy Coutable.
## WWW
https://github.com/guard/guard

View File

@ -213,6 +213,11 @@ describe Guard::Dsl do
::Guard.should_receive(:add_guard).with('another', anything, {})
lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string, :group => ['x','y']) }.should_not raise_error
end
it "should evaluate all groups when no group option is specified" do
::Guard.should_receive(:add_guard).with('test', anything, {}).twice
::Guard.should_receive(:add_guard).with('another', anything, {}).twice
lambda { subject.evaluate_guardfile(:guardfile_contents => valid_guardfile_string) }.should_not raise_error
end
end
# TODO: not sure if each seperate quoting/call type needs its own test

View File

@ -8,9 +8,11 @@ private
end
def record_results
noise = %r|\.sw.$| # don't fail specs due to editor swap files, etc.
@results = []
@listener.on_change do |files|
@results += files
@results += files.reject { |f| f =~ noise }
end
end