guard 0.8.8 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +16 -1
- data/README.md +665 -293
- data/bin/fsevent_watch_guard +0 -0
- data/lib/guard.rb +66 -31
- data/lib/guard/cli.rb +9 -3
- data/lib/guard/dsl.rb +32 -5
- data/lib/guard/dsl_describer.rb +3 -2
- data/lib/guard/guard.rb +2 -2
- data/lib/guard/interactor.rb +179 -48
- data/lib/guard/listener.rb +32 -17
- data/lib/guard/listeners/darwin.rb +5 -9
- data/lib/guard/listeners/linux.rb +6 -10
- data/lib/guard/listeners/windows.rb +4 -2
- data/lib/guard/notifier.rb +171 -258
- data/lib/guard/notifiers/gntp.rb +114 -0
- data/lib/guard/notifiers/growl.rb +98 -0
- data/lib/guard/notifiers/growl_notify.rb +91 -0
- data/lib/guard/notifiers/libnotify.rb +96 -0
- data/lib/guard/notifiers/rb_notifu.rb +101 -0
- data/lib/guard/ui.rb +2 -2
- data/lib/guard/version.rb +1 -1
- data/lib/guard/watcher.rb +1 -1
- data/lib/vendor/darwin/Gemfile +6 -0
- data/lib/vendor/darwin/Guardfile +8 -0
- data/lib/vendor/darwin/LICENSE +20 -0
- data/lib/vendor/darwin/README.rdoc +254 -0
- data/lib/vendor/darwin/Rakefile +21 -0
- data/lib/vendor/darwin/ext/extconf.rb +61 -0
- data/lib/vendor/darwin/ext/fsevent/fsevent_watch.c +226 -0
- data/lib/vendor/darwin/lib/rb-fsevent.rb +2 -0
- data/lib/vendor/darwin/lib/rb-fsevent/fsevent.rb +105 -0
- data/lib/vendor/darwin/lib/rb-fsevent/version.rb +3 -0
- data/lib/vendor/darwin/rb-fsevent.gemspec +24 -0
- data/lib/vendor/darwin/spec/fixtures/folder1/file1.txt +0 -0
- data/lib/vendor/darwin/spec/fixtures/folder1/folder2/file2.txt +0 -0
- data/lib/vendor/darwin/spec/rb-fsevent/fsevent_spec.rb +75 -0
- data/lib/vendor/darwin/spec/spec_helper.rb +24 -0
- data/lib/vendor/linux/MIT-LICENSE +20 -0
- data/lib/vendor/linux/README.md +66 -0
- data/lib/vendor/linux/Rakefile +54 -0
- data/lib/vendor/linux/VERSION +1 -0
- data/lib/vendor/linux/lib/rb-inotify.rb +17 -0
- data/lib/vendor/linux/lib/rb-inotify/event.rb +139 -0
- data/lib/vendor/linux/lib/rb-inotify/native.rb +31 -0
- data/lib/vendor/linux/lib/rb-inotify/native/flags.rb +89 -0
- data/lib/vendor/linux/lib/rb-inotify/notifier.rb +308 -0
- data/lib/vendor/linux/lib/rb-inotify/watcher.rb +83 -0
- data/lib/vendor/linux/rb-inotify.gemspec +53 -0
- data/lib/vendor/windows/Gemfile +4 -0
- data/lib/vendor/windows/README.md +34 -0
- data/lib/vendor/windows/Rakefile +18 -0
- data/lib/vendor/windows/lib/rb-fchange.rb +14 -0
- data/lib/vendor/windows/lib/rb-fchange/event.rb +29 -0
- data/lib/vendor/windows/lib/rb-fchange/native.rb +45 -0
- data/lib/vendor/windows/lib/rb-fchange/native/flags.rb +78 -0
- data/lib/vendor/windows/lib/rb-fchange/notifier.rb +149 -0
- data/lib/vendor/windows/lib/rb-fchange/version.rb +3 -0
- data/lib/vendor/windows/lib/rb-fchange/watcher.rb +99 -0
- data/lib/vendor/windows/rb-fchange.gemspec +34 -0
- data/lib/vendor/windows/spec/fixtures/folder1/file1.txt +0 -0
- data/lib/vendor/windows/spec/fixtures/folder1/folder2/file2.txt +0 -0
- data/lib/vendor/windows/spec/rb-fchange/fchange_spec.rb +119 -0
- data/lib/vendor/windows/spec/spec_helper.rb +21 -0
- metadata +87 -22
- data/lib/guard/version.rbc +0 -180
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## Dev
|
2
|
+
|
3
|
+
### Bug fix
|
4
|
+
|
5
|
+
- [#173](https://github.com/guard/guard/issues/173): Cannot set the watch_all_modifications option. (reported by [@sutherland][], fixed by [@netzpirat][]
|
6
|
+
- Fix `guard init` when a guard name is given. ([@rymai][])
|
7
|
+
|
8
|
+
### Improvements
|
9
|
+
|
10
|
+
- [#165](https://github.com/guard/guard/issues/175): Allow underscores in Guard name. ([@benolee][])
|
11
|
+
- Add readline support to the interactor. ([@netzpirat][])
|
12
|
+
- Add support for notification configuration. ([@netzpirat][])
|
13
|
+
|
1
14
|
## 0.8.8 - October 21, 2011
|
2
15
|
|
3
16
|
### Bug fix
|
@@ -8,7 +21,7 @@
|
|
8
21
|
|
9
22
|
### Bug fix
|
10
23
|
|
11
|
-
- [#166](https://github.com/guard/guard/issues/166): Fix silent failure after re-evaluating Guardfile. (reported by [@dgutov][], fixed by [@rymai][], special thanks to [@dyfrgi][] for the [
|
24
|
+
- [#166](https://github.com/guard/guard/issues/166): Fix silent failure after re-evaluating Guardfile. (reported by [@dgutov][], fixed by [@rymai][], special thanks to [@dyfrgi][] for the [reproducible test case](https://github.com/dyfrgi/Guard-Broken))
|
12
25
|
|
13
26
|
## 0.8.6 - October 17, 2011
|
14
27
|
|
@@ -316,6 +329,7 @@
|
|
316
329
|
- Added polling listening fallback. ([@thibaudgg][])
|
317
330
|
|
318
331
|
[@anithri]: https://github.com/anithri
|
332
|
+
[@benolee]: https://github.com/benolee
|
319
333
|
[@brainopia]: https://github.com/brainopia
|
320
334
|
[@bronson]: https://github.com/bronson
|
321
335
|
[@capotej]: https://github.com/capotej
|
@@ -359,6 +373,7 @@
|
|
359
373
|
[@stereobooster]: https://github.com/stereobooster
|
360
374
|
[@stouset]: https://github.com/stouset
|
361
375
|
[@sunaku]: https://github.com/sunaku
|
376
|
+
[@sutherland]: https://github.com/sutherland
|
362
377
|
[@thibaudgg]: https://github.com/thibaudgg
|
363
378
|
[@thierryhenrio]: https://github.com/thierryhenrio
|
364
379
|
[@tinogomes]: https://github.com/tinogomes
|
data/README.md
CHANGED
@@ -1,462 +1,834 @@
|
|
1
1
|
Guard [![Build Status](https://secure.travis-ci.org/guard/guard.png?branch=master)](http://travis-ci.org/guard/guard)
|
2
2
|
=====
|
3
3
|
|
4
|
-
Guard is a command line tool
|
4
|
+
Guard is a command line tool to easily handle events on file system modifications.
|
5
5
|
|
6
|
-
If you have any questions please join us
|
6
|
+
If you have any questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
7
|
+
`#guard` (irc.freenode.net).
|
7
8
|
|
8
9
|
Features
|
9
10
|
--------
|
10
11
|
|
11
|
-
* [FSEvent](http://en.wikipedia.org/wiki/FSEvents) support on Mac OS X
|
12
|
-
* [Inotify](http://en.wikipedia.org/wiki/Inotify) support on Linux
|
13
|
-
* [Directory Change Notification](http://msdn.microsoft.com/en-us/library/aa365261\(VS.85\).aspx) support on Windows
|
14
|
-
* Polling on the other operating systems
|
15
|
-
* Automatic
|
16
|
-
|
17
|
-
*
|
12
|
+
* [FSEvent](http://en.wikipedia.org/wiki/FSEvents) support on Mac OS X.
|
13
|
+
* [Inotify](http://en.wikipedia.org/wiki/Inotify) support on Linux.
|
14
|
+
* [Directory Change Notification](http://msdn.microsoft.com/en-us/library/aa365261\(VS.85\).aspx) support on Windows.
|
15
|
+
* Polling on the other operating systems.
|
16
|
+
* Automatic and super fast file modification detection when polling is not used.
|
17
|
+
Even new and deleted files are detected.
|
18
|
+
* Support for visual system notifications.
|
19
|
+
* Tested against Ruby 1.8.7, 1.9.2, 1.9.3, REE and the latest versions of JRuby & Rubinius.
|
18
20
|
|
19
21
|
Screencast
|
20
22
|
----------
|
21
23
|
|
22
|
-
Ryan Bates made
|
24
|
+
Ryan Bates made an excellent [RailsCast about Guard](http://railscasts.com/episodes/264-guard) and you should definitely
|
25
|
+
watch it for a nice introduction to Guard.
|
23
26
|
|
24
|
-
|
25
|
-
|
27
|
+
Installation
|
28
|
+
------------
|
29
|
+
|
30
|
+
The simplest way to install Guard is to use [Bundler](http://gembundler.com/).
|
26
31
|
|
27
32
|
Add Guard to your `Gemfile`:
|
28
33
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
gem 'rb-fsevent', :require => false
|
33
|
-
gem 'rb-fchange', :require => false
|
34
|
-
end
|
34
|
+
```ruby
|
35
|
+
group :development do
|
36
|
+
gem 'guard'
|
35
37
|
|
36
|
-
|
38
|
+
platforms :ruby do
|
39
|
+
gem 'rb-readline'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
```
|
37
43
|
|
38
|
-
|
44
|
+
and install it by running Bundler:
|
39
45
|
|
40
|
-
|
46
|
+
```bash
|
47
|
+
$ bundle
|
48
|
+
```
|
41
49
|
|
42
|
-
|
50
|
+
Generate an empty `Guardfile` with:
|
43
51
|
|
44
|
-
|
45
|
-
|
52
|
+
```bash
|
53
|
+
$ guard init
|
54
|
+
```
|
46
55
|
|
47
|
-
|
56
|
+
If you are using Windows and want colors in your terminal, you'll have to add the
|
57
|
+
[win32console](https://rubygems.org/gems/win32console) gem to your `Gemfile` and install it with Bundler:
|
48
58
|
|
49
|
-
|
59
|
+
```ruby
|
60
|
+
group :development do
|
61
|
+
gem 'win32console'
|
62
|
+
end
|
63
|
+
```
|
50
64
|
|
51
|
-
|
65
|
+
**It's important that you always run Guard through Bundler to avoid errors.** If you're getting sick of typing `bundle exec` all
|
66
|
+
the time, try the [Rubygems Bundler](https://github.com/mpapis/rubygems-bundler).
|
52
67
|
|
53
|
-
###
|
68
|
+
### System notifications
|
54
69
|
|
55
|
-
|
70
|
+
You can configure Guard to make use of the following system notification libraries:
|
56
71
|
|
57
|
-
|
72
|
+
#### Ruby GNTP
|
58
73
|
|
59
|
-
|
74
|
+
* Runs on Mac OS X, Linux and Windows
|
75
|
+
* Supports [Growl](http://growl.info/) version >= 1.3, [Growl for Linux](http://mattn.github.com/growl-for-linux/),
|
76
|
+
[Growl for Windows](http://www.growlforwindows.com/gfw/default.aspx) and
|
77
|
+
[Snarl](https://sites.google.com/site/snarlapp/home)
|
60
78
|
|
61
|
-
|
79
|
+
The [ruby_gntp](https://rubygems.org/gems/ruby_gntp) gem sends system notifications over the network with the
|
80
|
+
[Growl Notification Transport Protocol](http://www.growlforwindows.com/gfw/help/gntp.aspx) and supports local and
|
81
|
+
remote notifications.
|
62
82
|
|
63
|
-
|
83
|
+
Guard supports multiple notification channels for customizing each notification type. For Growl on Mac OS X you need
|
84
|
+
to have at least version 1.3 installed.
|
64
85
|
|
65
|
-
|
66
|
-
The gem needs a native C extension to make use of AppleScript and does not run on JRuby and MacRuby.
|
86
|
+
To use `ruby_gntp` you have to add it to your `Gemfile` and run bundler:
|
67
87
|
|
68
|
-
|
88
|
+
```ruby
|
89
|
+
group :development do
|
90
|
+
gem 'ruby_gntp'
|
91
|
+
end
|
92
|
+
```
|
69
93
|
|
70
|
-
|
94
|
+
#### Growl
|
71
95
|
|
72
|
-
|
73
|
-
|
74
|
-
to the local host currently.
|
96
|
+
* Runs on Mac OS X
|
97
|
+
* Supports all [Growl](http://growl.info/) versions
|
75
98
|
|
76
|
-
|
99
|
+
The [growl](https://rubygems.org/gems/growl) gem is compatible with all versions of Growl and uses a command line tool
|
100
|
+
[growlnotify](http://growl.info/extras.php#growlnotify) that must be separately downloaded and installed. The version of
|
101
|
+
the command line tool must match your Growl version. The `growl` gem does **not** support multiple notification
|
102
|
+
channels.
|
77
103
|
|
78
|
-
|
104
|
+
You can download an installer for `growlnotify` from the [Growl download section](http://growl.info/downloads) or
|
105
|
+
install it with HomeBrew:
|
79
106
|
|
80
|
-
|
81
|
-
|
107
|
+
```bash
|
108
|
+
$ brew install growlnotify
|
109
|
+
```
|
82
110
|
|
83
|
-
|
111
|
+
To use `growl` you have to add it to your `Gemfile` and run bundler:
|
84
112
|
|
85
|
-
|
113
|
+
```ruby
|
114
|
+
group :development do
|
115
|
+
gem 'growl'
|
116
|
+
end
|
117
|
+
```
|
86
118
|
|
87
|
-
|
88
|
-
gem 'growl_notify' # or gem 'ruby_gntp' or gem 'growl'
|
119
|
+
#### Libnotify
|
89
120
|
|
90
|
-
|
121
|
+
* Runs on Linux, FreeBSD, OpenBSD and Solaris
|
122
|
+
* Supports [Libnotify](http://developer.gnome.org/libnotify/)
|
91
123
|
|
92
|
-
|
124
|
+
The [libnotify](https://rubygems.org/gems/libnotify) gem supports the Gnome libnotify notification daemon, but it can be
|
125
|
+
used on other window managers as well. You have to install the `libnotify-bin` package with your favorite package
|
126
|
+
manager.
|
93
127
|
|
94
|
-
|
128
|
+
To use `libnotify` you have to add it to your `Gemfile` and run bundler:
|
95
129
|
|
96
|
-
|
130
|
+
```ruby
|
131
|
+
group :development do
|
132
|
+
gem 'libnotify'
|
133
|
+
end
|
134
|
+
```
|
97
135
|
|
98
|
-
|
136
|
+
#### Notifu
|
99
137
|
|
100
|
-
|
138
|
+
* Runs on Windows
|
139
|
+
* Supports [Notifu](http://www.paralint.com/projects/notifu/)
|
101
140
|
|
102
|
-
|
141
|
+
The [rb-notifu](https://rubygems.org/gems/rb-notifu) gem supports Windows system tray notifications.
|
103
142
|
|
104
|
-
|
143
|
+
To use `rb-notifu` you have to add it to your `Gemfile` and run bundler:
|
105
144
|
|
106
|
-
|
107
|
-
|
145
|
+
```ruby
|
146
|
+
group :development do
|
147
|
+
gem 'rb-notifu'
|
148
|
+
end
|
149
|
+
```
|
108
150
|
|
109
|
-
|
151
|
+
#### GrowlNotify
|
110
152
|
|
111
|
-
|
153
|
+
* Runs on Mac OS X
|
154
|
+
* Supports [Growl](http://growl.info/) version >= 1.3
|
155
|
+
* Doesn't support JRuby and MacRuby.
|
156
|
+
* Doesn't work when forking, e.g. with [Spork](https://github.com/sporkrb/spork).
|
112
157
|
|
113
|
-
|
158
|
+
The [growl_notify](https://rubygems.org/gems/growl_notify) gem uses AppleScript to send Growl notifications.
|
159
|
+
The gem needs a native C extension to make use of AppleScript and does not run on JRuby and MacRuby.
|
160
|
+
|
161
|
+
Guard supports multiple notification channels for customizing each notification type and you need to have at least
|
162
|
+
Growl version 1.3 installed.
|
114
163
|
|
115
|
-
|
164
|
+
To use `growl_notify` you have to add it to your `Gemfile` and run bundler:
|
116
165
|
|
117
|
-
|
166
|
+
```ruby
|
167
|
+
group :development do
|
168
|
+
gem 'growl_notify'
|
169
|
+
end
|
170
|
+
```
|
118
171
|
|
119
|
-
|
172
|
+
Add more Guards
|
173
|
+
---------------
|
120
174
|
|
121
|
-
|
175
|
+
Guard is now ready to use and you should add some Guards for your specific use. Start exploring the many Guards
|
176
|
+
available by browsing the [Guard organization](https://github.com/guard) on GitHub or by searching for `guard-` on
|
177
|
+
[RubyGems](https://rubygems.org/search?utf8=%E2%9C%93&query=guard-).
|
122
178
|
|
123
|
-
|
179
|
+
When you have found a Guard of your interest, add it to your `Gemfile`:
|
124
180
|
|
125
|
-
|
181
|
+
```ruby
|
182
|
+
group :development do
|
183
|
+
gem '<guard-name>'
|
184
|
+
end
|
185
|
+
```
|
126
186
|
|
127
|
-
|
128
|
-
|
129
|
-
gem 'win32console'
|
187
|
+
See the init section of the Guard usage below to see how to install the supplied Guard template that you can install and
|
188
|
+
to suit your needs.
|
130
189
|
|
131
190
|
Usage
|
132
191
|
-----
|
133
192
|
|
134
|
-
|
193
|
+
Guard is run from the command line. Please open your terminal and go to your project work directory.
|
194
|
+
|
195
|
+
### Help
|
196
|
+
|
197
|
+
You can always get help on the available tasks with the `help` task:
|
198
|
+
|
199
|
+
```bash
|
200
|
+
$ guard help
|
201
|
+
```
|
202
|
+
|
203
|
+
To request more detailed help on a specific task is simple: just appending the task name to the help task.
|
204
|
+
For example, to get help for the `start` task, simply run:
|
205
|
+
|
206
|
+
```bash
|
207
|
+
$ guard help start
|
208
|
+
```
|
209
|
+
|
210
|
+
### Init
|
211
|
+
|
212
|
+
You can generate an empty `Guardfile` by running the `init` task:
|
213
|
+
|
214
|
+
```bash
|
215
|
+
$ guard init
|
216
|
+
```
|
135
217
|
|
136
|
-
|
218
|
+
In addition, the `init` task can be used to append a supplied Guard template from an installed Guard to your existing
|
219
|
+
`Guardfile`:
|
137
220
|
|
138
|
-
|
221
|
+
```bash
|
222
|
+
$ guard init <guard-name>
|
223
|
+
```
|
139
224
|
|
140
|
-
|
225
|
+
### Start
|
141
226
|
|
142
|
-
|
227
|
+
Just launch Guard inside your Ruby or Rails project with:
|
143
228
|
|
144
|
-
|
145
|
-
|
229
|
+
```bash
|
230
|
+
$ guard
|
231
|
+
```
|
146
232
|
|
147
|
-
|
233
|
+
Guard will look for a `Guardfile` in your current directory. If it does not find one, it will look in your `$HOME`
|
234
|
+
directory for a `.Guardfile`.
|
148
235
|
|
149
|
-
|
236
|
+
#### `-c`/`--clear` option
|
150
237
|
|
151
|
-
|
152
|
-
$ guard -c # shortcut
|
238
|
+
The shell can be cleared after each change:
|
153
239
|
|
154
|
-
|
240
|
+
```bash
|
241
|
+
$ guard --clear
|
242
|
+
$ guard -c # shortcut
|
243
|
+
```
|
155
244
|
|
156
|
-
|
245
|
+
#### `-n`/`--notify` option
|
157
246
|
|
158
|
-
|
159
|
-
$ guard -n f # shortcut
|
247
|
+
System notifications can be disabled:
|
160
248
|
|
161
|
-
|
249
|
+
```bash
|
250
|
+
$ guard --notify false
|
251
|
+
$ guard -n f # shortcut
|
252
|
+
```
|
162
253
|
|
163
|
-
|
254
|
+
Notifications can also be disabled globally by setting a `GUARD_NOTIFY` environment variable to `false`.
|
164
255
|
|
165
|
-
|
256
|
+
#### `-g`/`--group` option
|
166
257
|
|
167
|
-
|
168
|
-
$ guard -g group_name another_group_name # shortcut
|
258
|
+
Only certain Guard groups can be run:
|
169
259
|
|
170
|
-
|
260
|
+
```bash
|
261
|
+
$ guard --group group_name another_group_name
|
262
|
+
$ guard -g group_name another_group_name # shortcut
|
263
|
+
```
|
171
264
|
|
172
|
-
|
265
|
+
See the Guardfile DSL below for creating groups.
|
173
266
|
|
174
|
-
|
175
|
-
$ guard -d # shortcut
|
267
|
+
#### `-v`/`--verbose` option
|
176
268
|
|
177
|
-
|
269
|
+
Guard can be run in verbose mode:
|
178
270
|
|
179
|
-
|
271
|
+
```bash
|
272
|
+
$ guard --verbose
|
273
|
+
$ guard -v # shortcut
|
274
|
+
```
|
180
275
|
|
181
|
-
|
182
|
-
$ guard -w ~/your/fancy/project # shortcut
|
276
|
+
#### `-w`/`--watchdir` option
|
183
277
|
|
184
|
-
|
278
|
+
Guard can watch in any directory instead of the current directory:
|
185
279
|
|
186
|
-
|
280
|
+
```bash
|
281
|
+
$ guard --watchdir ~/your/fancy/project
|
282
|
+
$ guard -w ~/your/fancy/project # shortcut
|
283
|
+
```
|
187
284
|
|
188
|
-
|
189
|
-
$ guard -G ~/.your_global_guardfile # shortcut
|
285
|
+
#### `-G`/`--guardfile` option
|
190
286
|
|
191
|
-
|
287
|
+
Guard can use a `Guardfile` not located in the current directory:
|
288
|
+
|
289
|
+
```bash
|
290
|
+
$ guard --guardfile ~/.your_global_guardfile
|
291
|
+
$ guard -G ~/.your_global_guardfile # shortcut
|
292
|
+
```
|
293
|
+
|
294
|
+
#### `-A`/`--watch-all-modifications` option
|
192
295
|
|
193
296
|
Guard can optionally watch all file modifications like moves or deletions with:
|
194
297
|
|
195
|
-
|
196
|
-
|
298
|
+
```bash
|
299
|
+
$ guard start -A
|
300
|
+
$ guard start --watch-all-modifications
|
301
|
+
```
|
197
302
|
|
198
|
-
|
303
|
+
#### `-i`/`--no-interactions` option
|
199
304
|
|
200
|
-
Turn off completely any Guard terminal
|
305
|
+
Turn off completely any Guard terminal interactions with:
|
201
306
|
|
202
|
-
|
203
|
-
|
307
|
+
```bash
|
308
|
+
$ guard start -i
|
309
|
+
$ guard start --no-interactions
|
310
|
+
```
|
204
311
|
|
205
|
-
|
312
|
+
### `-I`/`--no-vendor` option
|
206
313
|
|
207
|
-
|
314
|
+
Ignore the use of vendored gems with:
|
208
315
|
|
209
|
-
|
316
|
+
```bash
|
317
|
+
$ guard start -I
|
318
|
+
$ guard start --no-vendor
|
319
|
+
```
|
210
320
|
|
211
|
-
|
212
|
-
|
321
|
+
### List
|
322
|
+
|
323
|
+
You can list the available Guards with the `list` task:
|
324
|
+
|
325
|
+
```bash
|
326
|
+
$ guard list
|
327
|
+
|
328
|
+
Available guards:
|
329
|
+
coffeescript
|
330
|
+
compass
|
331
|
+
cucumber
|
332
|
+
jammit
|
333
|
+
ronn
|
334
|
+
rspec *
|
335
|
+
spork
|
336
|
+
yard
|
337
|
+
See also https://github.com/guard/guard/wiki/List-of-available-Guards
|
338
|
+
* denotes ones already in your Guardfile
|
339
|
+
```
|
213
340
|
|
214
|
-
|
341
|
+
### Show
|
215
342
|
|
216
|
-
|
343
|
+
You can show the structure of the groups and their Guards with the `show` task:
|
217
344
|
|
218
|
-
|
219
|
-
|
220
|
-
* `pause`: `pause|p + return` - Toggle files modification listening. Useful when switching git branches.
|
221
|
-
* `run_all`: `just return (no commands)` - Calls each guard's `#run_all` method, in the same order they are declared in the Guardfile.
|
345
|
+
```bash
|
346
|
+
$ guard show
|
222
347
|
|
223
|
-
|
348
|
+
(global):
|
349
|
+
shell
|
350
|
+
Group backend:
|
351
|
+
bundler
|
352
|
+
rspec: cli => "--color --format doc"
|
353
|
+
Group frontend:
|
354
|
+
coffeescript: output => "public/javascripts/compiled"
|
355
|
+
livereload
|
356
|
+
```
|
224
357
|
|
225
|
-
|
226
|
-
|
358
|
+
This shows the internal structure of the evaluated `Guardfile` or `.Guardfile`, with the `.guard.rb` file. You can
|
359
|
+
read more about these files in the shared configuration section below.
|
227
360
|
|
228
|
-
|
229
|
-
|
361
|
+
Interactions
|
362
|
+
------------
|
363
|
+
|
364
|
+
You can interact with Guard and enter commands when Guard has nothing to do. You'll see a command prompt `>` when Guard
|
365
|
+
is ready to accept a command. The command line supports history navigation with the `↑` and `↓` arrow keys, and
|
366
|
+
command auto-completion with the `⇥` key.
|
367
|
+
|
368
|
+
You can execute the following commands:
|
230
369
|
|
231
|
-
|
370
|
+
* `↩`: Run all Guards.
|
371
|
+
* `h`, `help`: Show a help of the available interactor commands.
|
372
|
+
* `r`, `reload`: Reload all Guards.
|
373
|
+
* `n`, `notification`: Toggle system notifications on and off.
|
374
|
+
* `p`, `pause`: Toggles the file modification listener. The prompt will change to `p>` when paused.
|
375
|
+
This is useful when switching Git branches.
|
376
|
+
* `e`, `exit`: Stop all Guards and quit Guard.
|
232
377
|
|
233
|
-
|
378
|
+
Instead of running all Guards with the `↩` key, you can also run a single Guard by entering its name:
|
234
379
|
|
235
|
-
|
380
|
+
```bash
|
381
|
+
> rspec
|
382
|
+
```
|
236
383
|
|
237
|
-
|
384
|
+
It's also possible to run all Guards within a group by entering the group name:
|
238
385
|
|
239
|
-
|
386
|
+
```bash
|
387
|
+
> frontend
|
388
|
+
```
|
240
389
|
|
241
|
-
|
390
|
+
The same applies to Guard reloading. You can reload a Guard with the following command:
|
242
391
|
|
243
|
-
|
392
|
+
```bash
|
393
|
+
> ronn reload
|
394
|
+
```
|
244
395
|
|
245
|
-
|
396
|
+
This will reload only the Ronn Guard. You can also reload all Guards within a group:
|
246
397
|
|
247
|
-
|
398
|
+
```bash
|
399
|
+
> backend reload
|
400
|
+
```
|
248
401
|
|
249
402
|
Guardfile DSL
|
250
403
|
-------------
|
251
404
|
|
252
|
-
The Guardfile DSL
|
405
|
+
The Guardfile DSL is evaluated as plain Ruby, so you can use normal Ruby code in your `Guardfile`.
|
406
|
+
Guard itself provides the following DSL methods that can be used for configuration:
|
253
407
|
|
254
|
-
|
255
|
-
* `#watch` - Allows you to define which files are supervised by a 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.
|
256
|
-
* `#group` - 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.
|
257
|
-
* `#callback` - Allows you to execute arbitrary code before or after any of the `start`, `stop`, `reload`, `run_all` and `run_on_change` guards' method. You can even insert more hooks inside these methods. Please [checkout the Wiki page](https://github.com/guard/guard/wiki/Hooks-and-callbacks) for more details.
|
258
|
-
* `#ignore_paths` - Allows you to ignore top level directories altogether. This comes is handy when you have large amounts of non-source data in you project. By default .bundle, .git, log, tmp, and vendor are ignored. Currently it is only possible to ignore the immediate descendants of the watched directory.
|
408
|
+
### guard
|
259
409
|
|
260
|
-
|
410
|
+
The `guard` method allows you to add a Guard to your toolchain and configure it by passing the
|
411
|
+
options after the name of the Guard:
|
261
412
|
|
262
|
-
|
413
|
+
```ruby
|
414
|
+
guard :coffeescript, :input => 'coffeescripts', :output => 'javascripts'
|
415
|
+
```
|
263
416
|
|
264
|
-
|
265
|
-
guard 'bundler' do
|
266
|
-
watch('Gemfile')
|
267
|
-
end
|
417
|
+
You can define the same Guard more than once:
|
268
418
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
watch(%r{^spec/models/.+\.rb$}) { ["spec/models", "spec/acceptance"] }
|
274
|
-
watch(%r{^spec/.+\.rb$}) { `say hello` }
|
419
|
+
```ruby
|
420
|
+
guard :coffeescript, :input => 'coffeescripts', :output => 'javascripts'
|
421
|
+
guard :coffeescript, :input => 'specs', :output => 'specs'
|
422
|
+
```
|
275
423
|
|
276
|
-
|
277
|
-
watch('spec/spec_helper.rb') { "spec" }
|
278
|
-
end
|
279
|
-
end
|
424
|
+
### watch
|
280
425
|
|
281
|
-
|
282
|
-
guard 'coffeescript', :output => 'public/javascripts/compiled' do
|
283
|
-
watch(%r{^app/coffeescripts/.+\.coffee$})
|
284
|
-
end
|
426
|
+
The `watch` method allows you to define which files are watched by a Guard:
|
285
427
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
428
|
+
```ruby
|
429
|
+
guard :bundler do
|
430
|
+
watch('Gemfile')
|
431
|
+
end
|
432
|
+
```
|
290
433
|
|
291
|
-
|
292
|
-
|
434
|
+
String watch patterns are matched with [String#==](http://www.ruby-doc.org/core-1.9.2/String.html#method-i-3D-3D).
|
435
|
+
You can also pass a regular expression to the watch method:
|
293
436
|
|
294
|
-
|
295
|
-
|
437
|
+
```ruby
|
438
|
+
guard :jessie do
|
439
|
+
watch(%r{^spec/.+(_spec|Spec)\.(js|coffee)})
|
440
|
+
end
|
441
|
+
```
|
296
442
|
|
297
|
-
|
298
|
-
|
443
|
+
This instructs the jessie Guard to watch for file changes in the `spec` folder,
|
444
|
+
but only for file names that ends with `_spec` or `Spec` and have a file type of `js` or `coffee`.
|
299
445
|
|
300
|
-
|
446
|
+
You can easily test your watcher regular expressions with [Rubular](http://rubular.com/).
|
301
447
|
|
302
|
-
|
448
|
+
When you add a block to the watch expression, you can modify the file name that has been
|
449
|
+
detected before sending it to the Guard for processing:
|
303
450
|
|
304
|
-
|
305
|
-
|
451
|
+
```ruby
|
452
|
+
guard :rspec do
|
453
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
454
|
+
end
|
455
|
+
```
|
306
456
|
|
307
|
-
|
457
|
+
In this example the regular expression capture group `(.+)` is used to transform a file change
|
458
|
+
in the `lib` folder to its test case in the `spec` folder. Regular expression watch patterns
|
459
|
+
are matched with [Regexp#match](http://www.ruby-doc.org/core-1.9.2/Regexp.html#method-i-match).
|
308
460
|
|
309
|
-
|
310
|
-
# or
|
311
|
-
Guard::Dsl.evaluate_guardfile(:guardfile_contents => "
|
312
|
-
guard 'rspec' do
|
313
|
-
watch(%r{^spec/.+_spec\.rb$})
|
314
|
-
end
|
315
|
-
")
|
461
|
+
You can also launch any arbitrary command in the supplied block:
|
316
462
|
|
317
|
-
|
463
|
+
```ruby
|
464
|
+
guard :shell do
|
465
|
+
watch('.*') { `git status` }
|
466
|
+
end
|
467
|
+
```
|
318
468
|
|
319
|
-
|
469
|
+
### group
|
320
470
|
|
321
|
-
|
471
|
+
The `group` method allows you to group several Guards together. This comes in handy especially when you
|
472
|
+
have a huge `Guardfile` and want to focus your development on a certain part.
|
322
473
|
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
coffeescript: output => "public/javascripts/compiled"
|
330
|
-
livereload
|
474
|
+
```ruby
|
475
|
+
group :specs do
|
476
|
+
guard :rspec do
|
477
|
+
watch(%r{^spec/.+_spec\.rb$})
|
478
|
+
end
|
479
|
+
end
|
331
480
|
|
332
|
-
|
333
|
-
|
481
|
+
group :docs do
|
482
|
+
guard :ronn do
|
483
|
+
watch(%r{^man/.+\.ronn?$})
|
484
|
+
end
|
485
|
+
end
|
486
|
+
```
|
334
487
|
|
335
|
-
|
336
|
-
the Guardfile. This can be used for tasks you want guard to handle but
|
337
|
-
other users probably don't. For example, indexing your source tree with
|
338
|
-
[Ctags](http://ctags.sourceforge.net):
|
488
|
+
Groups to be run can be specified with the Guard DSL option `--group` (or `-g`):
|
339
489
|
|
340
|
-
|
341
|
-
|
342
|
-
|
490
|
+
```bash
|
491
|
+
$ guard -g specs
|
492
|
+
```
|
493
|
+
|
494
|
+
Guards that don't belong to a group are considered global and are always run.
|
495
|
+
|
496
|
+
### notification
|
497
|
+
|
498
|
+
If you don't specify any notification configuration in your `Guardfile`, Guard goes through the list of available
|
499
|
+
notifiers and takes the first that is available. If you specify your preferred library, auto detection will not take
|
500
|
+
place:
|
501
|
+
|
502
|
+
```ruby
|
503
|
+
notification :growl
|
504
|
+
```
|
505
|
+
|
506
|
+
will select the `growl` gem for notifications. You can also set options for a notifier:
|
507
|
+
|
508
|
+
```ruby
|
509
|
+
notification :growl, :sticky => true
|
510
|
+
```
|
511
|
+
|
512
|
+
Each notifier has a slightly different set of supported options:
|
513
|
+
|
514
|
+
```ruby
|
515
|
+
notification :growl, :sticky => true, :host => '192.168.1.5', :password => 'secret'
|
516
|
+
notification :gntp, :sticky => true, :host => '192.168.1.5', :password => 'secret'
|
517
|
+
notification :growl_notify, :sticky => true, :priority => 0
|
518
|
+
notification :libnotify, :timeout => 5, :transient => true, :append => false
|
519
|
+
notification :notifu, :time => 5, :nosound => true, :xp => true
|
520
|
+
```
|
521
|
+
|
522
|
+
It's possible to use more than one notifier. This allows you to configure different notifiers for different OS if your
|
523
|
+
project is developed cross-platform or if you like to have local and remote notifications.
|
524
|
+
|
525
|
+
Notifications can also be turned off in the `Guardfile`, in addition to setting the environment variable `GUARD_NOTIFY`
|
526
|
+
or using the cli switch `-n`:
|
527
|
+
|
528
|
+
```ruby
|
529
|
+
notification :off
|
530
|
+
```
|
531
|
+
|
532
|
+
### callback
|
533
|
+
|
534
|
+
The `callback` method allows you to execute arbitrary code before or after any of the `start`, `stop`, `reload`,
|
535
|
+
`run_all` and `run_on_change` Guards' method. You can even insert more hooks inside these methods.
|
536
|
+
|
537
|
+
```ruby
|
538
|
+
guard :rspec do
|
539
|
+
watch(%r{^spec/.+_spec\.rb$})
|
540
|
+
|
541
|
+
callback(:start_begin) { `mate .` }
|
542
|
+
end
|
543
|
+
```
|
544
|
+
|
545
|
+
Please see the [hooks and callbacks](https://github.com/guard/guard/wiki/Hooks-and-callbacks) page in the Guard wiki for
|
546
|
+
more details.
|
547
|
+
|
548
|
+
### ignore_paths
|
549
|
+
|
550
|
+
The `ignore_paths` method allows you to ignore top level directories altogether. This comes is handy when you have large
|
551
|
+
amounts of non-source data in you project. By default `.bundle`, `.git`, `log`, `tmp`, and `vendor` are ignored.
|
552
|
+
Currently it is only possible to ignore the immediate descendants of the watched directory.
|
553
|
+
|
554
|
+
```ruby
|
555
|
+
ignore_paths 'public'
|
556
|
+
```
|
557
|
+
|
558
|
+
### Example
|
559
|
+
|
560
|
+
```ruby
|
561
|
+
ignore_paths 'foo', 'bar'
|
562
|
+
|
563
|
+
notification :growl_notify
|
564
|
+
notification :gntp, :host => '192.168.1.5'
|
565
|
+
|
566
|
+
group :backend do
|
567
|
+
guard :bundler do
|
568
|
+
watch('Gemfile')
|
569
|
+
end
|
570
|
+
|
571
|
+
guard :rspec, :cli => '--color --format doc' do
|
572
|
+
watch(%r{^spec/.+_spec\.rb$})
|
573
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
574
|
+
watch(%r{^spec/models/.+\.rb$}) { ["spec/models", "spec/acceptance"] }
|
575
|
+
watch(%r{^spec/.+\.rb$}) { `say hello` }
|
576
|
+
watch('spec/spec_helper.rb') { "spec" }
|
577
|
+
end
|
578
|
+
end
|
579
|
+
|
580
|
+
group :frontend do
|
581
|
+
guard :coffeescript, :output => 'public/javascripts/compiled' do
|
582
|
+
watch(%r{^app/coffeescripts/.+\.coffee$})
|
583
|
+
end
|
584
|
+
|
585
|
+
guard :livereload do
|
586
|
+
watch(%r{^app/.+\.(erb|haml)$})
|
587
|
+
end
|
588
|
+
end
|
589
|
+
```
|
343
590
|
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
591
|
+
Shared configurations
|
592
|
+
---------------------
|
593
|
+
|
594
|
+
You may optionally place a `.Guardfile` in your home directory to use it across multiple projects. It's evaluated when
|
595
|
+
you have no `Guardfile` in your current directory.
|
596
|
+
|
597
|
+
If a `.guard.rb` is found in your home directory, it will be appended to the `Guardfile` in your current directory.
|
598
|
+
This can be used for tasks you want guard to handle but other users probably don't.
|
599
|
+
|
600
|
+
For example, indexing your source tree with [Ctags](http://ctags.sourceforge.net):
|
601
|
+
|
602
|
+
```ruby
|
603
|
+
guard :shell do
|
604
|
+
watch(%r{^(?:app|lib)/.+\.rb$}) { `ctags -R` }
|
605
|
+
end
|
606
|
+
```
|
607
|
+
|
608
|
+
Advanced Linux system configuration
|
609
|
+
-----------------------------------
|
610
|
+
|
611
|
+
It's not uncommon to encounter a system limit on the number of files you can monitor.
|
612
|
+
For example, Ubuntu Lucid's (64bit) inotify limit is set to 8192.
|
613
|
+
|
614
|
+
You can get your current inotify file watch limit by executing:
|
615
|
+
|
616
|
+
```bash
|
617
|
+
$ cat /proc/sys/fs/inotify/max_user_watches
|
618
|
+
```
|
619
|
+
|
620
|
+
And set a new limit temporary with:
|
621
|
+
|
622
|
+
```bash
|
623
|
+
sudo sysctl fs.inotify.max_user_watches=524288
|
624
|
+
sudo sysctl -p
|
625
|
+
```
|
626
|
+
|
627
|
+
If you like to make your limit permanent, use:
|
628
|
+
|
629
|
+
```bash
|
630
|
+
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
|
631
|
+
sudo sysctl -p
|
632
|
+
```
|
633
|
+
|
634
|
+
You may also need to pay attention to the values of `max_queued_events` and `max_user_instances`.
|
635
|
+
|
636
|
+
Create a Guard
|
637
|
+
--------------
|
638
|
+
|
639
|
+
Creating a new Guard is very easy, just create a new gem by running `bundle gem guard-name`, where `name` is
|
640
|
+
the name of your Guard. Please make your Guard start with `guard-`, so that it can easily be found on RubyGems.
|
641
|
+
|
642
|
+
```bash
|
643
|
+
$ mkdir guard-name
|
644
|
+
$ cd guard-name
|
645
|
+
$ bundle gem guard-name
|
646
|
+
```
|
647
|
+
|
648
|
+
Now extend the project structure to have an initial Guard:
|
649
|
+
|
650
|
+
```bash
|
651
|
+
.travis.yml # bonus point!
|
652
|
+
CHANGELOG.md # bonus point!
|
653
|
+
Gemfile
|
654
|
+
guard-name.gemspec
|
655
|
+
Guardfile
|
656
|
+
lib/
|
657
|
+
guard/
|
658
|
+
guard-name/
|
659
|
+
templates/
|
660
|
+
Guardfile # needed for `guard init <guard-name>`
|
661
|
+
version.rb
|
662
|
+
guard-name.rb
|
663
|
+
test/ # or spec/
|
664
|
+
README.md
|
665
|
+
```
|
666
|
+
|
667
|
+
Your Guard main class `Guard::GuardName` in `lib/guard/guard-name.rb` must inherit from
|
668
|
+
[Guard::Guard](http://rubydoc.info/github/guard/guard/master/Guard/Guard) and should overwrite at least the
|
669
|
+
`#run_on_change` task methods.
|
367
670
|
|
368
671
|
Here is an example scaffold for `lib/guard/guard-name.rb`:
|
369
672
|
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
# Called on file(s) modifications that the Guard watches.
|
406
|
-
# @param [Array<String>] paths the changes files or paths
|
407
|
-
# @raise [:task_has_failed] when run_on_change has failed
|
408
|
-
def run_on_change(paths)
|
409
|
-
end
|
410
|
-
|
411
|
-
# Called on file(s) deletions that the Guard watches.
|
412
|
-
# @param [Array<String>] paths the deleted files or paths
|
413
|
-
# @raise [:task_has_failed] when run_on_change has failed
|
414
|
-
def run_on_deletion(paths)
|
415
|
-
end
|
416
|
-
|
417
|
-
end
|
673
|
+
```ruby
|
674
|
+
require 'guard'
|
675
|
+
require 'guard/guard'
|
676
|
+
|
677
|
+
module Guard
|
678
|
+
class GuardName < Guard
|
679
|
+
|
680
|
+
# Initialize a Guard.
|
681
|
+
# @param [Array<Guard::Watcher>] watchers the Guard file watchers
|
682
|
+
# @param [Hash] options the custom Guard options
|
683
|
+
def initialize(watchers = [], options = {})
|
684
|
+
super
|
685
|
+
end
|
686
|
+
|
687
|
+
# Call once when Guard starts. Please override initialize method to init stuff.
|
688
|
+
# @raise [:task_has_failed] when start has failed
|
689
|
+
def start
|
690
|
+
end
|
691
|
+
|
692
|
+
# Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
|
693
|
+
# @raise [:task_has_failed] when stop has failed
|
694
|
+
def stop
|
695
|
+
end
|
696
|
+
|
697
|
+
# Called when `reload|r|z + enter` is pressed.
|
698
|
+
# This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
|
699
|
+
# @raise [:task_has_failed] when reload has failed
|
700
|
+
def reload
|
701
|
+
end
|
702
|
+
|
703
|
+
# Called when just `enter` is pressed
|
704
|
+
# This method should be principally used for long action like running all specs/tests/...
|
705
|
+
# @raise [:task_has_failed] when run_all has failed
|
706
|
+
def run_all
|
418
707
|
end
|
419
708
|
|
420
|
-
|
709
|
+
# Called on file(s) modifications that the Guard watches.
|
710
|
+
# @param [Array<String>] paths the changes files or paths
|
711
|
+
# @raise [:task_has_failed] when run_on_change has failed
|
712
|
+
def run_on_change(paths)
|
713
|
+
end
|
714
|
+
|
715
|
+
# Called on file(s) deletions that the Guard watches.
|
716
|
+
# @param [Array<String>] paths the deleted files or paths
|
717
|
+
# @raise [:task_has_failed] when run_on_change has failed
|
718
|
+
def run_on_deletion(paths)
|
719
|
+
end
|
720
|
+
|
721
|
+
end
|
722
|
+
end
|
723
|
+
```
|
724
|
+
|
725
|
+
Please take a look at the source code of some of the [existing Guards](https://github.com/guard)
|
421
726
|
for more concrete example and inspiration.
|
422
727
|
|
423
|
-
Alternatively, a new
|
728
|
+
Alternatively, a new Guard can be added inline to a `Guardfile` with this basic structure:
|
424
729
|
|
425
|
-
|
730
|
+
```ruby
|
731
|
+
require 'guard/guard'
|
426
732
|
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
733
|
+
module ::Guard
|
734
|
+
class InlineGuard < ::Guard::Guard
|
735
|
+
def run_all
|
736
|
+
end
|
431
737
|
|
432
|
-
|
433
|
-
end
|
434
|
-
end
|
738
|
+
def run_on_change(paths)
|
435
739
|
end
|
740
|
+
end
|
741
|
+
end
|
742
|
+
```
|
743
|
+
|
744
|
+
[@avdi](https://github.com/avdi) has a very cool inline Guard example in his blog post
|
745
|
+
[A Guardfile for Redis](http://avdi.org/devblog/2011/06/15/a-guardfile-for-redis).
|
746
|
+
|
747
|
+
Programmatic use of Guard
|
748
|
+
-------------------------
|
749
|
+
|
750
|
+
The Guardfile DSL can also be used in a programmatic fashion by calling
|
751
|
+
[Guard::Dsl.evaluate_guardfile](http://rubydoc.info/github/guard/guard/master/Guard/Dsl#evaluate_guardfile-class_method).
|
752
|
+
|
753
|
+
Available options are as follow:
|
754
|
+
|
755
|
+
* `:guardfile` - The path to a valid `Guardfile`.
|
756
|
+
* `:guardfile_contents` - A string representing the content of a valid `Guardfile`.
|
757
|
+
|
758
|
+
Remember, without any options given, Guard will look for a `Guardfile` in your current directory and if it does not find
|
759
|
+
one, it will look for it in your `$HOME` directory.
|
760
|
+
|
761
|
+
Evaluate a `Guardfile`:
|
436
762
|
|
437
|
-
|
763
|
+
```ruby
|
764
|
+
require 'guard'
|
765
|
+
|
766
|
+
Guard.setup
|
767
|
+
Guard::Dsl.evaluate_guardfile(:guardfile => '/path/to/Guardfile')
|
768
|
+
Guard.start
|
769
|
+
```
|
770
|
+
|
771
|
+
Evaluate a string as `Guardfile`:
|
772
|
+
|
773
|
+
```ruby
|
774
|
+
require 'guard'
|
775
|
+
|
776
|
+
Guard.setup
|
777
|
+
|
778
|
+
guardfile = <<-EOF
|
779
|
+
guard 'rspec' do
|
780
|
+
watch(%r{^spec/.+_spec\.rb$})
|
781
|
+
end
|
782
|
+
EOF
|
783
|
+
|
784
|
+
Guard::Dsl.evaluate_guardfile(:guardfile_contents => guardfile)
|
785
|
+
Guard.start
|
786
|
+
```
|
787
|
+
|
788
|
+
Issues
|
789
|
+
------
|
790
|
+
|
791
|
+
You can report issues and feature requests to [GitHub Issues](https://github.com/guard/guard/issues). Try to figure out
|
792
|
+
where the issue belongs to: Is it an issue with Guard itself or with a Guard implementation you're using? Please don't
|
793
|
+
ask question in the issue tracker, instead join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
794
|
+
`#guard` (irc.freenode.net).
|
795
|
+
|
796
|
+
When you file an issue, please try to follow to these simple rules if applicable:
|
797
|
+
|
798
|
+
* Make sure you run Guard with `bundle exec` first.
|
799
|
+
* Add verbose information to the issue by running Guard with the `--verbose` option.
|
800
|
+
* Add your `Guardfile` and `Gemfile` to the issue.
|
801
|
+
* Make sure that the issue is reproducible with your description.
|
438
802
|
|
439
803
|
Development
|
440
804
|
-----------
|
441
805
|
|
442
806
|
* Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/guard/master/frames).
|
443
807
|
* Source hosted at [GitHub](https://github.com/guard/guard).
|
444
|
-
* Report issues and feature requests to [GitHub Issues](https://github.com/guard/guard/issues).
|
445
808
|
|
446
|
-
Pull requests are very welcome! Please try to follow these simple
|
809
|
+
Pull requests are very welcome! Please try to follow these simple rules if applicable:
|
810
|
+
|
811
|
+
* Please create a topic branch for every separate change you make.
|
812
|
+
* Make sure your patches are well tested. All specs run with `rake spec:portability` must pass.
|
813
|
+
* Update the [Yard](http://yardoc.org/) documentation.
|
814
|
+
* Update the README.
|
815
|
+
* Update the CHANGELOG for noteworthy changes.
|
816
|
+
* Please **do not change** the version number.
|
817
|
+
|
818
|
+
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
819
|
+
`#guard` (irc.freenode.net).
|
447
820
|
|
448
|
-
|
449
|
-
|
450
|
-
- Update the README (if applicable);
|
451
|
-
- Update the CHANGELOG (maybe not for a typo but don't hesitate!);
|
452
|
-
- Please **do not change** the version number.
|
821
|
+
Core Team
|
822
|
+
---------
|
453
823
|
|
454
|
-
|
824
|
+
* [Michael Kessler](https://github.com/netzpirat) ([@netzpirat](http://twitter.com/netzpirat))
|
825
|
+
* [Rémy Coutable](https://github.com/rymai) ([@rymai](http://twitter.com/rymai))
|
826
|
+
* [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](http://twitter.com/thibaudgg))
|
455
827
|
|
456
828
|
Author
|
457
829
|
------
|
458
830
|
|
459
|
-
[Thibaud Guillaume-Gentil](https://github.com/thibaudgg)
|
831
|
+
[Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](http://twitter.com/thibaudgg))
|
460
832
|
|
461
833
|
Contributors
|
462
834
|
------------
|