joshbuddy-guard 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +370 -0
- data/LICENSE +20 -0
- data/README.md +470 -0
- data/bin/fsevent_watch_guard +0 -0
- data/bin/guard +6 -0
- data/images/failed.png +0 -0
- data/images/pending.png +0 -0
- data/images/success.png +0 -0
- data/lib/guard.rb +463 -0
- data/lib/guard/cli.rb +125 -0
- data/lib/guard/dsl.rb +370 -0
- data/lib/guard/dsl_describer.rb +150 -0
- data/lib/guard/group.rb +37 -0
- data/lib/guard/guard.rb +129 -0
- data/lib/guard/hook.rb +118 -0
- data/lib/guard/interactor.rb +116 -0
- data/lib/guard/listener.rb +351 -0
- data/lib/guard/listeners/darwin.rb +60 -0
- data/lib/guard/listeners/linux.rb +91 -0
- data/lib/guard/listeners/polling.rb +55 -0
- data/lib/guard/listeners/windows.rb +61 -0
- data/lib/guard/notifier.rb +290 -0
- data/lib/guard/templates/Guardfile +2 -0
- data/lib/guard/ui.rb +193 -0
- data/lib/guard/version.rb +6 -0
- data/lib/guard/watcher.rb +114 -0
- 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
- data/man/guard.1 +96 -0
- data/man/guard.1.html +181 -0
- metadata +193 -0
data/CHANGELOG.md
ADDED
@@ -0,0 +1,370 @@
|
|
1
|
+
## 0.8.8 - October 21, 2011
|
2
|
+
|
3
|
+
### Bug fix
|
4
|
+
|
5
|
+
- Fix `guard init` when a guard name is given. ([@rymai][])
|
6
|
+
|
7
|
+
## 0.8.7 - October 18, 2011
|
8
|
+
|
9
|
+
### Bug fix
|
10
|
+
|
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 [reproductible test case](https://github.com/dyfrgi/Guard-Broken))
|
12
|
+
|
13
|
+
## 0.8.6 - October 17, 2011
|
14
|
+
|
15
|
+
### Bug fixes
|
16
|
+
|
17
|
+
- [#168](https://github.com/guard/guard/issues/168): Fix `guard init` path to Guardfile template. (reported by [@semperos][])
|
18
|
+
- [#167](https://github.com/guard/guard/issues/167): Include objects in changed_paths when Guard allows any return from the watchers. (reported by [@earlonrails][], fixed by [@netzpirat][])
|
19
|
+
|
20
|
+
## 0.8.5 - October 17, 2011
|
21
|
+
|
22
|
+
### Improvements
|
23
|
+
|
24
|
+
- `reload` and `run_all` Guard terminal interactions actions can be scoped to only run on a certain guard or group. ([@thibaudgg][])
|
25
|
+
- Add cli option (-i / --no-interactions) to turn off Guard terminal interactions. ([@thibaudgg][])
|
26
|
+
- Add support for Growl Notification Transport Protocol. ([@netzpirat][])
|
27
|
+
- [#157](https://github.com/guard/guard/issues/157): Allow any return from the Guard watchers. ([@earlonrails][])
|
28
|
+
- [#156](https://github.com/guard/guard/issues/156): Log error and diagnostic messages to STDERR. ([@sunaku][])
|
29
|
+
- [#152](https://github.com/guard/guard/issues/152): Growl Notify API update for a graceful fail. ([@scottdavis][])
|
30
|
+
|
31
|
+
### Bug fix
|
32
|
+
|
33
|
+
- [#160](https://github.com/guard/guard/issues/160): Avoid `Guard is not missing constant ...` exceptions. (reported by [@earlonrails][], fixed by [@netzpirat][])
|
34
|
+
|
35
|
+
## 0.8.4 - October 3, 2011
|
36
|
+
|
37
|
+
### Bug fix
|
38
|
+
|
39
|
+
- [#149](https://github.com/guard/guard/issues/149) & [#150](https://github.com/guard/guard/issues/150): Fix issue where interator thread was continuing to capture input from stdin while a guard is being executed. (reported by [@hardipe][], fixed by [@f1sherman][])
|
40
|
+
|
41
|
+
## 0.8.3 - October 1, 2011
|
42
|
+
|
43
|
+
### Bug fix
|
44
|
+
|
45
|
+
- [#145](https://github.com/guard/guard/issues/145): Fix over-utilization of CPU in Interactor. ([@johnbintz][])
|
46
|
+
|
47
|
+
### Improvements
|
48
|
+
|
49
|
+
- [#146](https://github.com/guard/guard/issues/146): Use a mutex instead of a lock for more efficient/simple locking. ([@f1sherman][])
|
50
|
+
- Make Guard implementation of `:task_has_failed` simple. ([@netzpirat][])
|
51
|
+
|
52
|
+
## 0.8.2 - September 30, 2011
|
53
|
+
|
54
|
+
### Bug fix
|
55
|
+
|
56
|
+
- Fixed guard stop to prevent run_guard_task(:stop) to be skipped [guard-spork issue #28](https://github.com/guard/guard-spork/issues/28). ([@thibaudgg][])
|
57
|
+
|
58
|
+
### Improvement
|
59
|
+
|
60
|
+
- Update docs regarding :task_has_failed. ([@netzpirat][])
|
61
|
+
|
62
|
+
## 0.8.1 - September 29, 2011
|
63
|
+
|
64
|
+
### Bug fix
|
65
|
+
|
66
|
+
- [#144](https://github.com/guard/guard/issues/144): Fix `guard init`. (reported by [@fabioyamate][], fixed by [@rymai][])
|
67
|
+
|
68
|
+
## 0.8.0 - September 28, 2011
|
69
|
+
|
70
|
+
### Bug fixes
|
71
|
+
|
72
|
+
- [#137](https://github.com/guard/guard/issues/137): Fix interacting with tools like ruby-debug. ([@hron][] & [@netzpirat][])
|
73
|
+
- [#138](https://github.com/guard/guard/issues/138): Fixed comments in example scaffold to reference interactions. ([@rmm5t][] & [@netzpirat][])
|
74
|
+
|
75
|
+
### New feature
|
76
|
+
|
77
|
+
- [#136](https://github.com/guard/guard/issues/136): New CLI `:watch_all_modifications`/`-A` option to watch for deleted and moved files too. ([@limeyd][] & [@netzpirat][])
|
78
|
+
- [#97](https://github.com/guard/guard/issues/97): Guard dependencies. Task execution can now be halted if a Guard throws `:task_has_failed` and `Guard::Dsl#group` options include `:halt_on_fail => true`. ([@rymai][])
|
79
|
+
- [#121](https://github.com/guard/guard/issues/121): `Guard.guards` and `Guard.groups` are now smart accessors. Filters can be passed to find a specific Guard/group or several Guards/groups that match (see YARDoc). ([@rymai][] & [@ches][])
|
80
|
+
- New `Guard::Group` class to store groups defined in Guardfile (with `Guard::Dsl#group`). ([@rymai][])
|
81
|
+
|
82
|
+
### Improvements
|
83
|
+
|
84
|
+
- Specs refactoring. ([@netzpirat][])
|
85
|
+
- Full YARD documentation. ([@netzpirat][] & a little of [@rymai][])
|
86
|
+
|
87
|
+
## 0.7.0 - September 14, 2011
|
88
|
+
|
89
|
+
## 0.7.0.rc1 - September 5, 2011
|
90
|
+
|
91
|
+
### Major Changes
|
92
|
+
|
93
|
+
- Posix Signals handlers (`Ctrl-C`, `Ctrl-\` and `Ctrl-Z`) are no more supported and replaced by `$stdin.gets`. Please refer to the "Interactions" section in the README for more information. ([@thibaudgg][])
|
94
|
+
- JRuby & Rubinius support (beta). ([@thibaudgg][] & [@netzpirat][])
|
95
|
+
|
96
|
+
### New features
|
97
|
+
|
98
|
+
- [#42](https://github.com/guard/guard/issues/42): New DSL method: `callback` allows you to execute arbitrary code before or after any of the `start`, `stop`, `reload`, `run_all` and `run_on_change` guards' method. New [Wiki page](https://github.com/guard/guard/wiki/Hooks-and-callbacks) for documenting it. ([@monocle][] & [@rymai][])
|
99
|
+
- Ability to 'pause' files modification listening. Please refer to the "Interactions" section in the README for more information. ([@thibaudgg][])
|
100
|
+
|
101
|
+
### Improvement
|
102
|
+
|
103
|
+
- Remove the need to scan the whole directory after guard's `run_on_change` method. ([@thibaudgg][])
|
104
|
+
|
105
|
+
## 0.6.3 - September 1, 2011
|
106
|
+
|
107
|
+
### New features
|
108
|
+
|
109
|
+
- [#130](https://github.com/guard/guard/issues/130): Adds `ignore_paths` method to DSL. ([@ianwhite][])
|
110
|
+
- [#128](https://github.com/guard/guard/issues/128): Users can add additional settings to `~/.guard.rb` that augment the existing Guardfile. ([@tpope][])
|
111
|
+
|
112
|
+
## 0.6.2 - August 17, 2011
|
113
|
+
|
114
|
+
### Bug fixes
|
115
|
+
|
116
|
+
- Re-add the possibility to use the `growl` gem since the `growl_notify` gem this is currently known to not work in conjunction with Spork. ([@netzpirat][])
|
117
|
+
- Ensure that scoped groups and group name are symbolized before checking for inclusion. ([@rymai][])
|
118
|
+
|
119
|
+
### New features
|
120
|
+
|
121
|
+
- Groups are now stored in a `@groups` variable (will be used for future features). ([@rymai][])
|
122
|
+
- Guards will now receive their group in the options hash at initialization (will be used for future features). ([@rymai][])
|
123
|
+
|
124
|
+
### Improvement
|
125
|
+
|
126
|
+
- Explain the growl/growl_notify differences in the README. ([@netzpirat][])
|
127
|
+
|
128
|
+
## 0.6.1 - August 15, 2011
|
129
|
+
|
130
|
+
### Bug fixes
|
131
|
+
|
132
|
+
- [#120](https://github.com/guard/guard/issues/120): remove `guardfile_contents` when re-evaluating so that the Guardfile gets reloaded correctly. ([@mordaroso][])
|
133
|
+
- [#119](https://github.com/guard/guard/issues/119): `Dsl.evaluate_guardfile` uses all groups if none specified. ([@ches][])
|
134
|
+
|
135
|
+
## 0.6.0 - August 13, 2011
|
136
|
+
|
137
|
+
### Bug fixes
|
138
|
+
|
139
|
+
- Pull request [#107](https://github.com/guard/guard/issues/107): Small spelling fix. ([@dnagir][])
|
140
|
+
- `Dir.glob` now ignores files that don't need to be watched. ([@rymai][])
|
141
|
+
|
142
|
+
### New feature
|
143
|
+
|
144
|
+
- Pull request [#112](https://github.com/guard/guard/issues/112): Add `list` command to CLI. ([@docwhat][])
|
145
|
+
|
146
|
+
### Improvements
|
147
|
+
|
148
|
+
- [#99](https://github.com/guard/guard/issues/99): [OS X] Switch from growl gem to growl_notify gem. ([@johnbintz][])
|
149
|
+
- [#115](https://github.com/guard/guard/issues/115): [Linux] Add `:transient => true` to default libnotify options. ([@zonque][])
|
150
|
+
- [#95](https://github.com/guard/guard/issues/95): Output system commands and options to be executed when in debug mode. ([@uk-ar][] and [@netzpirat][])
|
151
|
+
- `Guard::Dsl.revaluate_guardfile` has been renamed to `Guard::Dsl.reevaluate_guardfile`. ([@rymai][])
|
152
|
+
- New CLI options: ([@nestegg][])
|
153
|
+
- `watchdir`/`-w` to specify the directory in which Guard should watch for changes,
|
154
|
+
- `guardfile`/`-G` to specify an alternate location for the Guardfile to use.
|
155
|
+
- [#90](https://github.com/guard/guard/issues/90): Refactoring of color handling in the `Guard::UI`. ([@stereobooster][])
|
156
|
+
|
157
|
+
## 0.5.1 - July 2, 2011
|
158
|
+
|
159
|
+
### Bug fix
|
160
|
+
|
161
|
+
- Fixed `guard show` command. ([@bronson][] & [@thibaudgg][])
|
162
|
+
|
163
|
+
## 0.5.0 - July 2, 2011
|
164
|
+
|
165
|
+
### New features
|
166
|
+
|
167
|
+
- Guard::Ego is now part of Guard, so Guardfile is automagically re-evaluated when modified. ([@thibaudgg][])
|
168
|
+
- [#91](https://github.com/guard/guard/issues/91): Show Guards in Guardfile with the `guard -T`. ([@johnbintz][])
|
169
|
+
|
170
|
+
### Improvements
|
171
|
+
|
172
|
+
- [#98](https://github.com/guard/guard/issues/98): Multiple calls per watch event on linux with rb-inotify. ([@jeffutter][] & [@netzpirat][])
|
173
|
+
- [#94](https://github.com/guard/guard/issues/94): Show backtrace in terminal when a problem with a watch action occurs. ([@capotej][])
|
174
|
+
- [#88](https://github.com/guard/guard/issues/88): Write exception trace in the terminal when a supervised task fail. ([@mcmire][])
|
175
|
+
- Color in red the "ERROR:" flag when using `UI.error`. ([@rymai][])
|
176
|
+
- [#79](https://github.com/guard/guard/issues/79) and Pull request [#82](https://github.com/guard/guard/issues/82): Improve INotify support on Linux. ([@Gazer][] & [@yannlugrin][])
|
177
|
+
- [#12](https://github.com/guard/guard/issues/12) and Pull request [#86](https://github.com/guard/guard/issues/86): Eventually exits with SystemStackError. ([@stereobooster][])
|
178
|
+
- [#84](https://github.com/guard/guard/issues/84): Use RbConfig instead of obsolete and deprecated Config. ([@etehtsea][])
|
179
|
+
- [#80](https://github.com/guard/guard/issues/80): Watching dotfile (hidden files under unix). (reported by [@chrisberkhout][], fixed by [@yannlugrin][])
|
180
|
+
- Clear the terminal on start when the `:clear` option is given. ([@rymai][])
|
181
|
+
- Rename home directory Guardfile to `.Guardfile`. ([@tpope][])
|
182
|
+
|
183
|
+
## 0.4.2 - June 7, 2011
|
184
|
+
|
185
|
+
### Bug fixes
|
186
|
+
|
187
|
+
- Fixed Guard::Version in ruby 1.8.7 ([@thibaudgg][])
|
188
|
+
- Fix ([@mislav][]) link in CHANGELOG (Note: this is a recursive CHANGELOG item). ([@fnichol][])
|
189
|
+
|
190
|
+
## 0.4.1 - June 7, 2011
|
191
|
+
|
192
|
+
### Improvements
|
193
|
+
|
194
|
+
- [#77](https://github.com/guard/guard/issues/77): Refactor `get_guard_class` to first try the constant and fallback to require + various tweaks. ([@mislav][])
|
195
|
+
- Notifier improvement, don't use system notification library if could not be required. ([@yannlugrin][])
|
196
|
+
|
197
|
+
## 0.4.0 - June 5, 2011
|
198
|
+
|
199
|
+
### Bug fix
|
200
|
+
|
201
|
+
- In Ruby < 1.9, `Symbol#downcase` doesn't exist! ([@rymai][])
|
202
|
+
|
203
|
+
### New features
|
204
|
+
|
205
|
+
- [#73](https://github.com/guard/guard/issues/73): Allow DSL's `group` method to accept a Symbol as group name. ([@johnbintz][])
|
206
|
+
- [#51](https://github.com/guard/guard/issues/51): Allow options (like `:priority`) to be passed through to the Notifier. ([@indirect][] & [@netzpirat][])
|
207
|
+
|
208
|
+
### Improvement
|
209
|
+
|
210
|
+
- [#74](https://github.com/guard/guard/issues/74): Added link definitions to make the CHANGELOG more DRY! That's for sure now, we have the cleanest CHANGELOG ever! (even the link definitions are sorted alphabetically!) ([@pcreux][])
|
211
|
+
|
212
|
+
## 0.4.0.rc - May 28, 2011
|
213
|
+
|
214
|
+
### Bug fixes
|
215
|
+
|
216
|
+
- [#69](https://github.com/guard/guard/issues/69): Fixed typo in README: `Ctr-/` => `Ctr-\`. ([@tinogomes][])
|
217
|
+
- [#66](https://github.com/guard/guard/issues/66): Support for dashes in guard names. ([@johnbintz][])
|
218
|
+
- Require `guard/ui` because `Guard::Notifier` can be required without full Guard. ([@yannlugrin][])
|
219
|
+
- Handled quick file (<1s) modification. Avoid to catch modified files without content modification (sha1 checksum). ([@thibaudgg][] & [@netzpirat][])
|
220
|
+
- Fixed `Guard::Notifier` (when growl/libnotify not present). ([@thibaudgg][])
|
221
|
+
- Fixed Rubygems deprecation messages. ([@thibaudgg][])
|
222
|
+
|
223
|
+
### New features
|
224
|
+
|
225
|
+
- [#67](https://github.com/guard/guard/issues/67): Allow Guardfile in `$HOME` folder. ([@hashrocketeer][])
|
226
|
+
- [#64](https://github.com/guard/guard/issues/64): Windows notifications support. ([@stereobooster][])
|
227
|
+
- [#63](https://github.com/guard/guard/issues/63): Refactor listeners to work as a library. ([@niklas][])
|
228
|
+
- Use `ENV["GUARD_NOTIFY"]` to disable notifications. ([@thibaudgg][])
|
229
|
+
- Cleaning up all specs. ([@netzpirat][])
|
230
|
+
- [#60](https://github.com/guard/guard/issues/60): Added Windows support. ([@stereobooster][])
|
231
|
+
- [#58](https://github.com/guard/guard/issues/58): Extract code from signal handlers into methods. ([@nicksieger][])
|
232
|
+
- [#55](https://github.com/guard/guard/issues/55): It is now possible to pass `:guardfile` (a Guardfile path) or `:guardfile_contents` (the content of a Guardfile) to `Guard::Dsl.evaluate_guardfile`. Hence this allows the use of `Guard::Dsl.evaluate_guardfile` in a programmatic manner. ([@anithri][], improved by [@rymai][])
|
233
|
+
|
234
|
+
## 0.3.4 - April 24, 2011
|
235
|
+
|
236
|
+
### Bug fix
|
237
|
+
|
238
|
+
- [#41](https://github.com/guard/guard/issues/41): Removed useless Bundler requirement. ([@thibaudgg][])
|
239
|
+
|
240
|
+
### New features
|
241
|
+
|
242
|
+
- Changed CHANGELOG from RDOC to Markdown and cleaned it! Let's celebrate! ([@rymai][])
|
243
|
+
- Changed README from RDOC to Markdown! Let's celebrate! ([@thibaudgg][])
|
244
|
+
- [#48](https://github.com/guard/guard/issues/48): Adding support for inline Guard classes rather than requiring a gem. ([@jrsacks][])
|
245
|
+
|
246
|
+
## 0.3.3 - April 18, 2011
|
247
|
+
|
248
|
+
### Bug fix
|
249
|
+
|
250
|
+
- Fixed `new_modified_files` rerun conditions on `Guard.run_on_change_for_all_guards`. ([@thibaudgg][])
|
251
|
+
|
252
|
+
## 0.3.2 - April 17, 2011
|
253
|
+
|
254
|
+
### Bug fixe
|
255
|
+
|
256
|
+
- [#43](https://github.com/guard/guard/issues/43): Fixed `guard init` command. ([@brainopia][])
|
257
|
+
|
258
|
+
## 0.3.1 - April 14, 2011
|
259
|
+
|
260
|
+
### Bug fixes
|
261
|
+
|
262
|
+
- Return unique filenames from Linux listener. (Marian Schubert)
|
263
|
+
- `Guard.get_guard_class` return wrong class when loaded nested class. ([@koshigoe][])
|
264
|
+
- [#35](https://github.com/guard/guard/issues/35): Fixed open-gem/gem_open dependency problem by using `gem which` to locate guards gem path. (reported by [@thierryhenrio][], fixed by [@thibaudgg][])
|
265
|
+
- [#38](https://github.com/guard/guard/issues/38) & Pull request [#39](https://github.com/guard/guard/issues/39): Fixed an invalid ANSI escape code in `Guard::UI.reset_line`. ([@gix][])
|
266
|
+
|
267
|
+
### New feature
|
268
|
+
|
269
|
+
- [#28](https://github.com/guard/guard/issues/28): New `-n` command line option to disable notifications (Growl / Libnotify). ([@thibaudgg][])
|
270
|
+
|
271
|
+
## 0.3.0 - January 19, 2011
|
272
|
+
|
273
|
+
### Bug fix
|
274
|
+
|
275
|
+
- Avoid launching `run_on_change` guards method when no files matched. `--clear` guard argument is now usable. ([@thibaudgg][])
|
276
|
+
|
277
|
+
### New features
|
278
|
+
|
279
|
+
- The whole directory is now watched during `run_on_change` to detect new files modifications. ([@thibaudgg][])
|
280
|
+
- [#26](https://github.com/guard/guard/issues/26): New DSL method: `group` allows you to group several guards. New CLI option: `--group group_name` to specify certain groups of guards to start. ([@netzpirat][])
|
281
|
+
- `watch` patterns are now more strict: strings are matched with `String#==`, `Regexp` are matched with `Regexp#match`. ([@rymai][])
|
282
|
+
- A deprecation warning is displayed if your `Guardfile` contains `String` that look like `Regexp` (bad!). ([@rymai][])
|
283
|
+
- It's now possible to return an `Enumerable` in the `watch` optional blocks in the `Guardfile`. ([@rymai][])
|
284
|
+
|
285
|
+
### New specs
|
286
|
+
|
287
|
+
- `Guard::Watcher`. ([@rymai][])
|
288
|
+
- [#13](https://github.com/guard/guard/issues/13): `Guard::Dsl`. ([@oliamb][])
|
289
|
+
|
290
|
+
## 0.2.2 - October 25, 2010
|
291
|
+
|
292
|
+
### Bug fix
|
293
|
+
|
294
|
+
- [#5](https://github.com/guard/guard/issues/5): avoid creating new copy of `fsevent_watch` every time a file is changed. (reported by [@stouset][], fixed by [@thibaudgg][])
|
295
|
+
|
296
|
+
## 0.2.1 - October 24, 2010
|
297
|
+
|
298
|
+
### Bug fixes
|
299
|
+
|
300
|
+
- [#7](https://github.com/guard/guard/issues/7): Fixes for Linux support. ([@yannlugrin][])
|
301
|
+
- [#6](https://github.com/guard/guard/issues/6): Locate guard now chomp newline in result path. ([@yannlugrin][])
|
302
|
+
|
303
|
+
## 0.2.0 - October 21, 2010
|
304
|
+
|
305
|
+
### Bug fixes
|
306
|
+
|
307
|
+
- [#3](https://github.com/guard/guard/issues/3): `guard init <guard-name>` no more need `Gemfile` but `open_gem` is required now. (reported by [@wereHamster][], fixed by [@thibaudgg][])
|
308
|
+
- [#2](https://github.com/guard/guard/issues/2): 1.8.6 compatibility. (reported by [@veged][], fixed by [@thibaudgg][])
|
309
|
+
- Removes Growl & Libnotify dependencies. ([@thibaudgg][])
|
310
|
+
|
311
|
+
## 0.2.0.beta.1 - October 17, 2010
|
312
|
+
|
313
|
+
### New features
|
314
|
+
|
315
|
+
- Improved listeners support (`rb-fsevent` & `rb-inotify`). ([@thibaudgg][])
|
316
|
+
- Added polling listening fallback. ([@thibaudgg][])
|
317
|
+
|
318
|
+
[@anithri]: https://github.com/anithri
|
319
|
+
[@brainopia]: https://github.com/brainopia
|
320
|
+
[@bronson]: https://github.com/bronson
|
321
|
+
[@capotej]: https://github.com/capotej
|
322
|
+
[@ches]: https://github.com/ches
|
323
|
+
[@chrisberkhout]: https://github.com/chrisberkhout
|
324
|
+
[@dgutov]: https://github.com/dgutov
|
325
|
+
[@dnagir]: https://github.com/dnagir
|
326
|
+
[@docwhat]: https://github.com/docwhat
|
327
|
+
[@dyfrgi]: https://github.com/dyfrgi
|
328
|
+
[@earlonrails]: https://github.com/earlonrails
|
329
|
+
[@etehtsea]: https://github.com/etehtsea
|
330
|
+
[@f1sherman]: https://github.com/f1sherman
|
331
|
+
[@fabioyamate]: https://github.com/fabioyamate
|
332
|
+
[@fnichol]: https://github.com/fnichol
|
333
|
+
[@Gazer]: https://github.com/Gazer
|
334
|
+
[@gix]: https://github.com/gix
|
335
|
+
[@hron]: https://github.com/hron
|
336
|
+
[@hardipe]: https://github.com/hardipe
|
337
|
+
[@hashrocketeer]: https://github.com/hashrocketeer
|
338
|
+
[@ianwhite]: https://github.com/ianwhite
|
339
|
+
[@indirect]: https://github.com/indirect
|
340
|
+
[@jeffutter]: https://github.com/jeffutter
|
341
|
+
[@johnbintz]: https://github.com/johnbintz
|
342
|
+
[@jrsacks]: https://github.com/jrsacks
|
343
|
+
[@koshigoe]: https://github.com/koshigoe
|
344
|
+
[@limeyd]: https://github.com/limeyd
|
345
|
+
[@mcmire]: https://github.com/mcmire
|
346
|
+
[@mislav]: https://github.com/mislav
|
347
|
+
[@monocle]: https://github.com/monocle
|
348
|
+
[@mordaroso]: https://github.com/mordaroso
|
349
|
+
[@nestegg]: https://github.com/nestegg
|
350
|
+
[@netzpirat]: https://github.com/netzpirat
|
351
|
+
[@nicksieger]: https://github.com/nicksieger
|
352
|
+
[@niklas]: https://github.com/niklas
|
353
|
+
[@oliamb]: https://github.com/oliamb
|
354
|
+
[@pcreux]: https://github.com/pcreux
|
355
|
+
[@rmm5t]: https://github.com/rmm5t
|
356
|
+
[@rymai]: https://github.com/rymai
|
357
|
+
[@scottdavis]: https://github.com/scottdavis
|
358
|
+
[@semperos]: https://github.com/semperos
|
359
|
+
[@stereobooster]: https://github.com/stereobooster
|
360
|
+
[@stouset]: https://github.com/stouset
|
361
|
+
[@sunaku]: https://github.com/sunaku
|
362
|
+
[@thibaudgg]: https://github.com/thibaudgg
|
363
|
+
[@thierryhenrio]: https://github.com/thierryhenrio
|
364
|
+
[@tinogomes]: https://github.com/tinogomes
|
365
|
+
[@tpope]: https://github.com/tpope
|
366
|
+
[@uk-ar]: https://github.com/uk-ar
|
367
|
+
[@veged]: https://github.com/veged
|
368
|
+
[@wereHamster]: https://github.com/wereHamster
|
369
|
+
[@yannlugrin]: https://github.com/yannlugrin
|
370
|
+
[@zonque]: https://github.com/zonque
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Thibaud Guillaume-Gentil
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,470 @@
|
|
1
|
+
Guard [![Build Status](https://secure.travis-ci.org/guard/guard.png?branch=master)](http://travis-ci.org/guard/guard)
|
2
|
+
=====
|
3
|
+
|
4
|
+
Guard is a command line tool to easily handle events on file modifications.
|
5
|
+
|
6
|
+
If you have any questions please join us on our [Google group](http://groups.google.com/group/guard-dev) or on `#guard` (irc.freenode.net).
|
7
|
+
|
8
|
+
Features
|
9
|
+
--------
|
10
|
+
|
11
|
+
* [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).
|
12
|
+
* [Inotify](http://en.wikipedia.org/wiki/Inotify) support on Linux ([rb-inotify gem, >= 0.5.1](https://rubygems.org/gems/rb-inotify) required).
|
13
|
+
* [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).
|
14
|
+
* Polling on the other operating systems (help us to support more OS).
|
15
|
+
* Automatic & Super fast (when polling is not used) file modifications detection (even new files are detected).
|
16
|
+
* Visual notifications on Mac OSX ([Growl](http://growl.info)), Linux ([Libnotify](http://developer.gnome.org/libnotify)) and Windows ([Notifu](http://www.paralint.com/projects/notifu)).
|
17
|
+
* Tested against Ruby 1.8.7, 1.9.2, REE and the latest versions of JRuby & Rubinius.
|
18
|
+
|
19
|
+
Screencast
|
20
|
+
----------
|
21
|
+
|
22
|
+
Ryan Bates made a Railscast on Guard, you can view it here: [http://railscasts.com/episodes/264-guard](http://railscasts.com/episodes/264-guard)
|
23
|
+
|
24
|
+
Install
|
25
|
+
-------
|
26
|
+
|
27
|
+
Add Guard to your `Gemfile`:
|
28
|
+
|
29
|
+
group :development do
|
30
|
+
gem 'guard'
|
31
|
+
end
|
32
|
+
|
33
|
+
and install it via Bundler:
|
34
|
+
|
35
|
+
$ bundle
|
36
|
+
|
37
|
+
Generate an empty Guardfile with:
|
38
|
+
|
39
|
+
$ guard init
|
40
|
+
|
41
|
+
You may optionally place a .Guardfile in your home directory to use it across multiple projects.
|
42
|
+
Also note that if a `.guard.rb` is found in your home directory, it will be appended to the Guardfile.
|
43
|
+
|
44
|
+
Add the guards you need to your Guardfile (see the existing guards below).
|
45
|
+
|
46
|
+
Now, be sure to read the particular instructions for your operating system: [Mac OS X](#mac) | [Linux](#linux) | [Windows](#win)
|
47
|
+
|
48
|
+
<a name="mac" />
|
49
|
+
|
50
|
+
### On Mac OS X
|
51
|
+
|
52
|
+
Install the rb-fsevent gem for [FSEvent](http://en.wikipedia.org/wiki/FSEvents) support:
|
53
|
+
|
54
|
+
$ gem install rb-fsevent
|
55
|
+
|
56
|
+
You have three possibilities for getting Growl support:
|
57
|
+
|
58
|
+
Use the [growl_notify gem](https://rubygems.org/gems/growl_notify):
|
59
|
+
|
60
|
+
$ gem install growl_notify
|
61
|
+
|
62
|
+
The `growl_notify` gem is compatible with Growl >= 1.3 and uses AppleScript to send Growl notifications.
|
63
|
+
The gem needs a native C extension to make use of AppleScript and does not run on JRuby and MacRuby.
|
64
|
+
|
65
|
+
Use the [ruby_gntp gem](https://github.com/snaka/ruby_gntp):
|
66
|
+
|
67
|
+
$ gem install ruby_gntp
|
68
|
+
|
69
|
+
The `ruby_gntp` gem is compatible with Growl >= 1.3 and uses the Growl Notification Transport Protocol to send Growl
|
70
|
+
notifications. Guard supports multiple notification channels for customizing each notification type, but it's limited
|
71
|
+
to the local host currently.
|
72
|
+
|
73
|
+
Use the [growl gem](https://rubygems.org/gems/growl):
|
74
|
+
|
75
|
+
$ gem install growl
|
76
|
+
|
77
|
+
The `growl` gem is compatible with all versions of Growl and uses a command line tool [growlnotify](http://growl.info/extras.php#growlnotify)
|
78
|
+
that must be separately downloaded and installed. You can also install it with HomeBrew:
|
79
|
+
|
80
|
+
$ brew install growlnotify
|
81
|
+
|
82
|
+
Finally you have to add your Growl library of choice to your Gemfile:
|
83
|
+
|
84
|
+
gem 'rb-fsevent'
|
85
|
+
gem 'growl_notify' # or gem 'ruby_gntp' or gem 'growl'
|
86
|
+
|
87
|
+
Have a look at the [Guard Wiki](https://github.com/guard/guard/wiki/Which-Growl-library-should-I-use) for more information.
|
88
|
+
|
89
|
+
<a name="linux" />
|
90
|
+
|
91
|
+
### On Linux
|
92
|
+
|
93
|
+
Install the [rb-inotify gem](https://rubygems.org/gems/rb-inotify) for [inotify](http://en.wikipedia.org/wiki/Inotify) support:
|
94
|
+
|
95
|
+
$ gem install rb-inotify
|
96
|
+
|
97
|
+
Install the [libnotify gem](https://rubygems.org/gems/libnotify) if you want visual notification support:
|
98
|
+
|
99
|
+
$ gem install libnotify
|
100
|
+
|
101
|
+
And add them to your Gemfile:
|
102
|
+
|
103
|
+
gem 'rb-inotify'
|
104
|
+
gem 'libnotify'
|
105
|
+
|
106
|
+
<a name="win" />
|
107
|
+
|
108
|
+
### On Windows
|
109
|
+
|
110
|
+
Install the [rb-fchange gem](https://rubygems.org/gems/rb-fchange) for [Directory Change Notification](http://msdn.microsoft.com/en-us/library/aa365261\(VS.85\).aspx) support:
|
111
|
+
|
112
|
+
$ gem install rb-fchange
|
113
|
+
|
114
|
+
Install the [win32console gem](https://rubygems.org/gems/win32console) if you want colors in your terminal:
|
115
|
+
|
116
|
+
$ gem install win32console
|
117
|
+
|
118
|
+
Install the [rb-notifu gem](https://rubygems.org/gems/rb-notifu) if you want visual notification support:
|
119
|
+
|
120
|
+
$ gem install rb-notifu
|
121
|
+
|
122
|
+
And add them to your Gemfile:
|
123
|
+
|
124
|
+
gem 'rb-fchange'
|
125
|
+
gem 'rb-notifu'
|
126
|
+
gem 'win32console'
|
127
|
+
|
128
|
+
Usage
|
129
|
+
-----
|
130
|
+
|
131
|
+
Just launch Guard inside your Ruby / Rails project with:
|
132
|
+
|
133
|
+
$ guard [start]
|
134
|
+
|
135
|
+
or if you use Bundler, to run the Guard executable specific to your bundle:
|
136
|
+
|
137
|
+
$ bundle exec guard [start]
|
138
|
+
|
139
|
+
Guard will look for a Guardfile in your current directory. If it does not find one, it will look in your `$HOME` directory for a .Guardfile.
|
140
|
+
|
141
|
+
Command line options
|
142
|
+
--------------------
|
143
|
+
|
144
|
+
### `-c`/`--clear` option
|
145
|
+
|
146
|
+
Shell can be cleared after each change:
|
147
|
+
|
148
|
+
$ guard --clear
|
149
|
+
$ guard -c # shortcut
|
150
|
+
|
151
|
+
### `-n`/`--notify` option
|
152
|
+
|
153
|
+
Notifications (growl/libnotify) can be disabled:
|
154
|
+
|
155
|
+
$ guard --notify false
|
156
|
+
$ guard -n f # shortcut
|
157
|
+
|
158
|
+
Notifications can also be disabled globally by setting a `GUARD_NOTIFY` environment variable to `false`
|
159
|
+
|
160
|
+
### `-g`/`--group` option
|
161
|
+
|
162
|
+
Only certain guards groups can be run (see the Guardfile DSL below for creating groups):
|
163
|
+
|
164
|
+
$ guard --group group_name another_group_name
|
165
|
+
$ guard -g group_name another_group_name # shortcut
|
166
|
+
|
167
|
+
### `-d`/`--debug` option
|
168
|
+
|
169
|
+
Guard can be run in debug mode:
|
170
|
+
|
171
|
+
$ guard --debug
|
172
|
+
$ guard -d # shortcut
|
173
|
+
|
174
|
+
### `-w`/`--watchdir` option
|
175
|
+
|
176
|
+
Guard can watch in any directory (instead of the current directory):
|
177
|
+
|
178
|
+
$ guard --watchdir ~/your/fancy/project
|
179
|
+
$ guard -w ~/your/fancy/project # shortcut
|
180
|
+
|
181
|
+
### `-G`/`--guardfile` option
|
182
|
+
|
183
|
+
Guard can use a Guardfile not located in the current directory:
|
184
|
+
|
185
|
+
$ guard --guardfile ~/.your_global_guardfile
|
186
|
+
$ guard -G ~/.your_global_guardfile # shortcut
|
187
|
+
|
188
|
+
### `-A`/`--watch-all-modifications` option
|
189
|
+
|
190
|
+
Guard can optionally watch all file modifications like moves or deletions with:
|
191
|
+
|
192
|
+
$ guard start -A
|
193
|
+
$ guard start --watch-all-modifications
|
194
|
+
|
195
|
+
### `-i`/`--no-interactions` option
|
196
|
+
|
197
|
+
Turn off completely any Guard terminal [interactions](#interactions) with:
|
198
|
+
|
199
|
+
$ guard start -i
|
200
|
+
$ guard start --no-interactions
|
201
|
+
|
202
|
+
### `-I`/`--no-vendor` option
|
203
|
+
|
204
|
+
Ignore the use of vendored gems with:
|
205
|
+
|
206
|
+
$ guard start -I
|
207
|
+
$ guard start --no-vendor
|
208
|
+
|
209
|
+
An exhaustive list of options is available with:
|
210
|
+
|
211
|
+
$ guard help [TASK]
|
212
|
+
|
213
|
+
<a name="interactions" />
|
214
|
+
|
215
|
+
Interactions
|
216
|
+
------------
|
217
|
+
|
218
|
+
**From version >= 0.7.0 Posix Signal handlers are no more used to interact with Guard. If you're using a version < 0.7, please refer to the [README in the v0.6 branch](https://github.com/guard/guard/blob/v0.6/README.md).**
|
219
|
+
|
220
|
+
When Guard do nothing you can interact with by entering a command + hitting return/enter:
|
221
|
+
|
222
|
+
* `stop`: `stop|quit|exit|s|q|e + return` - Calls each guard's `#stop` method, in the same order they are declared in the Guardfile, and then quits Guard itself.
|
223
|
+
* `reload`: `reload|r|z + return` - Calls each guard's `#reload` method, in the same order they are declared in the Guardfile.
|
224
|
+
* `pause`: `pause|p + return` - Toggle file modification listening. Useful when switching git branches.
|
225
|
+
* `run_all`: `just return (no commands)` - Calls each guard's `#run_all` method, in the same order they are declared in the Guardfile.
|
226
|
+
|
227
|
+
`reload` and `run_all` actions can be scoped to only run on a certain guard or group. Examples:
|
228
|
+
|
229
|
+
* `backend reload + return` - Call only each guard's `#reload` method on backend group.
|
230
|
+
* `rspec + return` - Call only rspec guard's `#run_all` method.
|
231
|
+
|
232
|
+
Available Guards
|
233
|
+
----------------
|
234
|
+
|
235
|
+
A list of the available guards is present [in the wiki](https://github.com/guard/guard/wiki/List-of-available-Guards).
|
236
|
+
|
237
|
+
### Add a guard to your Guardfile
|
238
|
+
|
239
|
+
Add it to your Gemfile (inside the `development` group):
|
240
|
+
|
241
|
+
gem '<guard-name>'
|
242
|
+
|
243
|
+
You can list all guards installed on your system with:
|
244
|
+
|
245
|
+
$ guard list
|
246
|
+
|
247
|
+
Insert default guard's definition to your Guardfile by running this command:
|
248
|
+
|
249
|
+
$ guard init <guard-name>
|
250
|
+
|
251
|
+
You are good to go, or you can modify your guards' definition to suit your needs.
|
252
|
+
|
253
|
+
Guardfile DSL
|
254
|
+
-------------
|
255
|
+
|
256
|
+
The Guardfile DSL consists of the following methods:
|
257
|
+
|
258
|
+
* `#guard` - Allows you to add a guard with an optional hash of options.
|
259
|
+
* `#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.
|
260
|
+
* `#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.
|
261
|
+
* `#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.
|
262
|
+
* `#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.
|
263
|
+
|
264
|
+
Example:
|
265
|
+
|
266
|
+
ignore_paths 'foo', 'bar'
|
267
|
+
|
268
|
+
group 'backend' do
|
269
|
+
guard 'bundler' do
|
270
|
+
watch('Gemfile')
|
271
|
+
end
|
272
|
+
|
273
|
+
guard 'rspec', :cli => '--color --format doc' do
|
274
|
+
# Regexp watch patterns are matched with Regexp#match
|
275
|
+
watch(%r{^spec/.+_spec\.rb$})
|
276
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
277
|
+
watch(%r{^spec/models/.+\.rb$}) { ["spec/models", "spec/acceptance"] }
|
278
|
+
watch(%r{^spec/.+\.rb$}) { `say hello` }
|
279
|
+
|
280
|
+
# String watch patterns are matched with simple '=='
|
281
|
+
watch('spec/spec_helper.rb') { "spec" }
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
group 'frontend' do
|
286
|
+
guard 'coffeescript', :output => 'public/javascripts/compiled' do
|
287
|
+
watch(%r{^app/coffeescripts/.+\.coffee$})
|
288
|
+
end
|
289
|
+
|
290
|
+
guard 'livereload' do
|
291
|
+
watch(%r{^app/.+\.(erb|haml)$})
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
Using a Guardfile without the `guard` binary
|
296
|
+
--------------------------------------------
|
297
|
+
|
298
|
+
The Guardfile DSL can also be used in a programmatic fashion by calling directly `Guard::Dsl.evaluate_guardfile`.
|
299
|
+
Available options are as follow:
|
300
|
+
|
301
|
+
* `:guardfile` - The path to a valid Guardfile.
|
302
|
+
* `:guardfile_contents` - A string representing the content of a valid Guardfile
|
303
|
+
|
304
|
+
Remember, without any options given, Guard will look for a Guardfile in your current directory and if it does not find one, it will look for it in your `$HOME` directory.
|
305
|
+
|
306
|
+
For instance, you could use it as follow:
|
307
|
+
|
308
|
+
gem 'guard'
|
309
|
+
require 'guard'
|
310
|
+
|
311
|
+
Guard.setup
|
312
|
+
|
313
|
+
Guard::Dsl.evaluate_guardfile(:guardfile => '/your/custom/path/to/a/valid/Guardfile')
|
314
|
+
# or
|
315
|
+
Guard::Dsl.evaluate_guardfile(:guardfile_contents => "
|
316
|
+
guard 'rspec' do
|
317
|
+
watch(%r{^spec/.+_spec\.rb$})
|
318
|
+
end
|
319
|
+
")
|
320
|
+
|
321
|
+
Guard.start
|
322
|
+
|
323
|
+
### Listing defined guards/groups for the current project
|
324
|
+
|
325
|
+
You can list the defined groups and guards for the current Guardfile from the command line using `guard show` or `guard -T`:
|
326
|
+
|
327
|
+
$ guard -T
|
328
|
+
|
329
|
+
(global):
|
330
|
+
shell
|
331
|
+
Group backend:
|
332
|
+
bundler
|
333
|
+
rspec: cli => "--color --format doc"
|
334
|
+
Group frontend:
|
335
|
+
coffeescript: output => "public/javascripts/compiled"
|
336
|
+
livereload
|
337
|
+
|
338
|
+
User config file
|
339
|
+
----------------
|
340
|
+
|
341
|
+
If a `.guard.rb` is found in your home directory, it will be appended to
|
342
|
+
the Guardfile. This can be used for tasks you want guard to handle but
|
343
|
+
other users probably don't. For example, indexing your source tree with
|
344
|
+
[Ctags](http://ctags.sourceforge.net):
|
345
|
+
|
346
|
+
guard 'shell' do
|
347
|
+
watch(%r{^(?:app|lib)/.+\.rb$}) { `ctags -R` }
|
348
|
+
end
|
349
|
+
|
350
|
+
Create a new guard
|
351
|
+
------------------
|
352
|
+
|
353
|
+
Creating a new guard is very easy, just create a new gem (`bundle gem` if you use Bundler) with this basic structure:
|
354
|
+
|
355
|
+
.travis.yml # bonus point!
|
356
|
+
CHANGELOG.md # bonus point!
|
357
|
+
Gemfile
|
358
|
+
guard-name.gemspec
|
359
|
+
Guardfile
|
360
|
+
lib/
|
361
|
+
guard/
|
362
|
+
guard-name/
|
363
|
+
templates/
|
364
|
+
Guardfile # needed for `guard init <guard-name>`
|
365
|
+
version.rb
|
366
|
+
guard-name.rb
|
367
|
+
test/ # or spec/
|
368
|
+
README.md
|
369
|
+
|
370
|
+
`Guard::GuardName` (in `lib/guard/guard-name.rb`) must inherit from
|
371
|
+
[Guard::Guard](http://rubydoc.info/github/guard/guard/master/Guard/Guard) and should overwrite at least one of
|
372
|
+
the basic `Guard::Guard` task methods.
|
373
|
+
|
374
|
+
Here is an example scaffold for `lib/guard/guard-name.rb`:
|
375
|
+
|
376
|
+
require 'guard'
|
377
|
+
require 'guard/guard'
|
378
|
+
|
379
|
+
module Guard
|
380
|
+
class GuardName < Guard
|
381
|
+
|
382
|
+
# Initialize a Guard.
|
383
|
+
# @param [Array<Guard::Watcher>] watchers the Guard file watchers
|
384
|
+
# @param [Hash] options the custom Guard options
|
385
|
+
def initialize(watchers = [], options = {})
|
386
|
+
super
|
387
|
+
end
|
388
|
+
|
389
|
+
# Call once when Guard starts. Please override initialize method to init stuff.
|
390
|
+
# @raise [:task_has_failed] when start has failed
|
391
|
+
def start
|
392
|
+
end
|
393
|
+
|
394
|
+
# Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
|
395
|
+
# @raise [:task_has_failed] when stop has failed
|
396
|
+
def stop
|
397
|
+
end
|
398
|
+
|
399
|
+
# Called when `reload|r|z + enter` is pressed.
|
400
|
+
# This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
|
401
|
+
# @raise [:task_has_failed] when reload has failed
|
402
|
+
def reload
|
403
|
+
end
|
404
|
+
|
405
|
+
# Called when just `enter` is pressed
|
406
|
+
# This method should be principally used for long action like running all specs/tests/...
|
407
|
+
# @raise [:task_has_failed] when run_all has failed
|
408
|
+
def run_all
|
409
|
+
end
|
410
|
+
|
411
|
+
# Called on file(s) modifications that the Guard watches.
|
412
|
+
# @param [Array<String>] paths the changes files or paths
|
413
|
+
# @raise [:task_has_failed] when run_on_change has failed
|
414
|
+
def run_on_change(paths)
|
415
|
+
end
|
416
|
+
|
417
|
+
# Called on file(s) deletions that the Guard watches.
|
418
|
+
# @param [Array<String>] paths the deleted files or paths
|
419
|
+
# @raise [:task_has_failed] when run_on_change has failed
|
420
|
+
def run_on_deletion(paths)
|
421
|
+
end
|
422
|
+
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
Please take a look at the [existing guards' source code](https://github.com/guard/guard/wiki/List-of-available-Guards)
|
427
|
+
for more concrete example and inspiration.
|
428
|
+
|
429
|
+
Alternatively, a new guard can be added inline to a Guardfile with this basic structure:
|
430
|
+
|
431
|
+
require 'guard/guard'
|
432
|
+
|
433
|
+
module ::Guard
|
434
|
+
class InlineGuard < ::Guard::Guard
|
435
|
+
def run_all
|
436
|
+
end
|
437
|
+
|
438
|
+
def run_on_change(paths)
|
439
|
+
end
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
Here is a very cool example by [@avdi](https://github.com/avdi) : [http://avdi.org/devblog/2011/06/15/a-guardfile-for-redis](http://avdi.org/devblog/2011/06/15/a-guardfile-for-redis)
|
444
|
+
|
445
|
+
Development
|
446
|
+
-----------
|
447
|
+
|
448
|
+
* Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/guard/master/frames).
|
449
|
+
* Source hosted at [GitHub](https://github.com/guard/guard).
|
450
|
+
* Report issues and feature requests to [GitHub Issues](https://github.com/guard/guard/issues).
|
451
|
+
|
452
|
+
Pull requests are very welcome! Please try to follow these simple "rules", though:
|
453
|
+
|
454
|
+
- Please create a topic branch for every separate change you make;
|
455
|
+
- Make sure your patches are well tested;
|
456
|
+
- Update the README (if applicable);
|
457
|
+
- Update the CHANGELOG (maybe not for a typo but don't hesitate!);
|
458
|
+
- Please **do not change** the version number.
|
459
|
+
|
460
|
+
For questions please join us on our [Google group](http://groups.google.com/group/guard-dev) or on `#guard` (irc.freenode.net).
|
461
|
+
|
462
|
+
Author
|
463
|
+
------
|
464
|
+
|
465
|
+
[Thibaud Guillaume-Gentil](https://github.com/thibaudgg)
|
466
|
+
|
467
|
+
Contributors
|
468
|
+
------------
|
469
|
+
|
470
|
+
[https://github.com/guard/guard/contributors](https://github.com/guard/guard/contributors)
|