guard 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +43 -8
- data/README.md +89 -40
- data/lib/guard.rb +26 -21
- data/lib/guard/cli.rb +29 -3
- data/lib/guard/dsl.rb +16 -2
- data/lib/guard/dsl_describer.rb +29 -0
- data/lib/guard/listener.rb +5 -6
- data/lib/guard/listeners/linux.rb +6 -8
- data/lib/guard/listeners/windows.rb +2 -1
- data/lib/guard/notifier.rb +2 -2
- data/lib/guard/ui.rb +13 -13
- data/lib/guard/version.rb +1 -1
- data/lib/guard/watcher.rb +13 -9
- data/man/guard.1 +70 -0
- data/man/guard.1.html +138 -0
- metadata +49 -84
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,47 @@
|
|
1
|
+
## 0.5.0 - July 2, 2011
|
2
|
+
|
3
|
+
## New features
|
4
|
+
|
5
|
+
- Guard::Ego is now part of Guard, so Guardfile is automagically re-evaluated when modified. ([@thibaudgg][])
|
6
|
+
- Pull request [#91](https://github.com/guard/guard/pull/91): Show Guards in Guardfile with the `guard -T`. ([@johnbintz][])
|
7
|
+
|
8
|
+
## Improvements
|
9
|
+
|
10
|
+
- Issue [#98](https://github.com/guard/guard/issues/98): Multiple calls per watch event on linux with rb-inotify. ([@jeffutter][] & [@netzpirat][])
|
11
|
+
- Pull request [#94](https://github.com/guard/guard/pull/94): Show backtrace in terminal when a problem with a watch action occurs. ([@capotej][])
|
12
|
+
- Pull request [#88](https://github.com/guard/guard/pull/88): Write exception trace in the terminal when a supervised task fail. ([@mcmire][])
|
13
|
+
- Color in red the "ERROR:" flag when using `UI.error`. ([@rymai][])
|
14
|
+
- Issue [#79](https://github.com/guard/guard/issues/79) and Pull request [#82](https://github.com/guard/guard/pull/82): Improve INotify support on Linux. ([@Gazer][] & [@yannlugrin][])
|
15
|
+
- Issue [#12](https://github.com/guard/guard/issues/12) and Pull request [#86](https://github.com/guard/guard/pull/86): Eventually exits with SystemStackError. ([@stereobooster][])
|
16
|
+
- Pull request [#84](https://github.com/guard/guard/pull/84): Use RbConfig instead of obsolete and deprecated Config. ([@etehtsea][])
|
17
|
+
- Pull request [#80](https://github.com/guard/guard/pull/80): Watching dotfile (hidden files under unix). (reported by [@chrisberkhout][], fixed by [@yannlugrin][])
|
18
|
+
- Clear the terminal on start when the `:clear` option is given. ([@rymai][])
|
19
|
+
- Rename home directory Guardfile to `.Guardfile`. ([@tpope][])
|
20
|
+
|
21
|
+
## 0.4.2 - June 7, 2011
|
22
|
+
|
23
|
+
### Bugs fixes:
|
24
|
+
|
25
|
+
- Fixed Guard::Version in ruby 1.8.7 ([@thibaudgg][])
|
26
|
+
- Fix ([@mislav][]) link in CHANGELOG (Note: this is a recursive CHANGELOG item). ([@fnichol][])
|
27
|
+
|
1
28
|
## 0.4.1 - June 7, 2011
|
2
29
|
|
3
30
|
### Improvements
|
4
31
|
|
5
|
-
- Pull request [#77](https://github.com/guard/guard/pull/77): Refactor `get_guard_class` to first try the constant and fallback to require + various tweaks ([@mislav][])
|
6
|
-
- Notifier improvement, don't use system notification library if could not be required ([@yannlugrin][])
|
32
|
+
- Pull request [#77](https://github.com/guard/guard/pull/77): Refactor `get_guard_class` to first try the constant and fallback to require + various tweaks. ([@mislav][])
|
33
|
+
- Notifier improvement, don't use system notification library if could not be required. ([@yannlugrin][])
|
7
34
|
|
8
35
|
## 0.4.0 - June 5, 2011
|
9
36
|
|
10
37
|
### Bugs fixes:
|
11
38
|
|
12
|
-
- In Ruby < 1.9, Symbol#downcase doesn't exist! ([@rymai][])
|
39
|
+
- In Ruby < 1.9, `Symbol#downcase` doesn't exist! ([@rymai][])
|
13
40
|
|
14
41
|
### New features:
|
15
42
|
|
16
43
|
- Pull request [#73](https://github.com/guard/guard/pull/73): Allow DSL's `group` method to accept a Symbol as group name. ([@johnbintz][])
|
17
|
-
- Pull request [#51](https://github.com/guard/guard/pull/51): Allow options (like
|
44
|
+
- Pull request [#51](https://github.com/guard/guard/pull/51): Allow options (like `:priority`) to be passed through to the Notifier. ([@indirect][] & [@netzpirat][])
|
18
45
|
|
19
46
|
### Improvements
|
20
47
|
|
@@ -24,10 +51,10 @@
|
|
24
51
|
|
25
52
|
### Bugs fixes:
|
26
53
|
|
27
|
-
- Pull request [#69](https://github.com/guard/guard/pull/69): Fixed typo in README: Ctr
|
54
|
+
- Pull request [#69](https://github.com/guard/guard/pull/69): Fixed typo in README: `Ctr-/` => `Ctr-\`. ([@tinogomes][])
|
28
55
|
- Pull request [#66](https://github.com/guard/guard/pull/66): Support for dashes in guard names. ([@johnbintz][])
|
29
56
|
- Require `guard/ui` because `Guard::Notifier` can be required without full Guard. ([@yannlugrin][])
|
30
|
-
- Handled quick file (<1s) modification. Avoid to catch modified files without content modification (sha1 checksum). ([@thibaudgg][]
|
57
|
+
- Handled quick file (<1s) modification. Avoid to catch modified files without content modification (sha1 checksum). ([@thibaudgg][] & [@netzpirat][])
|
31
58
|
- Fixed `Guard::Notifier` (when growl/libnotify not present). ([@thibaudgg][])
|
32
59
|
- Fixed Rubygems deprecation messages. ([@thibaudgg][])
|
33
60
|
|
@@ -115,8 +142,8 @@
|
|
115
142
|
|
116
143
|
### Bugs fixes:
|
117
144
|
|
118
|
-
- Pull request [#7](https://github.com/guard/guard/pull/7): Fixes for Linux support. ([@yannlugrin][])
|
119
|
-
- Pull request [#6](https://github.com/guard/guard/pull/6): Locate guard now chomp newline in result path. ([@yannlugrin][])
|
145
|
+
- Pull request [#7](https://github.com/guard/guard/pull/7): Fixes for Linux support. ([@yannlugrin][])
|
146
|
+
- Pull request [#6](https://github.com/guard/guard/pull/6): Locate guard now chomp newline in result path. ([@yannlugrin][])
|
120
147
|
|
121
148
|
|
122
149
|
## 0.2.0 - October 21, 2010
|
@@ -137,12 +164,19 @@
|
|
137
164
|
|
138
165
|
[@anithri]: https://github.com/anithri
|
139
166
|
[@brainopia]: https://github.com/brainopia
|
167
|
+
[@capotej]: https://github.com/capotej
|
168
|
+
[@chrisberkhout]: https://github.com/chrisberkhout
|
169
|
+
[@etehtsea]: https://github.com/etehtsea
|
170
|
+
[@fnichol]: https://github.com/fnichol
|
171
|
+
[@Gazer]: https://github.com/Gazer
|
140
172
|
[@gix]: https://github.com/gix
|
141
173
|
[@hashrocketeer]: https://github.com/hashrocketeer
|
142
174
|
[@indirect]: https://github.com/indirect
|
175
|
+
[@jeffutter]: https://github.com/jeffutter
|
143
176
|
[@johnbintz]: https://github.com/johnbintz
|
144
177
|
[@jrsacks]: https://github.com/jrsacks
|
145
178
|
[@koshigoe]: https://github.com/koshigoe
|
179
|
+
[@mcmire]: https://github.com/mcmire
|
146
180
|
[@mislav]: https://github.com/mislav
|
147
181
|
[@netzpirat]: https://github.com/netzpirat
|
148
182
|
[@nicksieger]: https://github.com/nicksieger
|
@@ -155,6 +189,7 @@
|
|
155
189
|
[@thibaudgg]: https://github.com/thibaudgg
|
156
190
|
[@thierryhenrio]: https://github.com/thierryhenrio
|
157
191
|
[@tinogomes]: https://github.com/tinogomes
|
192
|
+
[@tpope]: https://github.com/tpope
|
158
193
|
[@veged]: https://github.com/veged
|
159
194
|
[@wereHamster]: https://github.com/wereHamster
|
160
195
|
[@yannlugrin]: https://github.com/yannlugrin
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@ Guard [![Build Status](http://travis-ci.org/guard/guard.png)](http://travis-ci.o
|
|
3
3
|
|
4
4
|
Guard is a command line tool that easily handle events on files modifications.
|
5
5
|
|
6
|
-
If you have any questions
|
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
7
|
|
8
8
|
Features
|
9
9
|
--------
|
@@ -26,7 +26,7 @@ Install the gem:
|
|
26
26
|
$ gem install guard
|
27
27
|
```
|
28
28
|
|
29
|
-
Add it to your Gemfile (inside the `
|
29
|
+
Add it to your Gemfile (inside the `development` group):
|
30
30
|
|
31
31
|
``` ruby
|
32
32
|
gem 'guard'
|
@@ -38,7 +38,7 @@ Generate an empty Guardfile with:
|
|
38
38
|
$ guard init
|
39
39
|
```
|
40
40
|
|
41
|
-
You may optionally place
|
41
|
+
You may optionally place a .Guardfile in your home directory to use it across multiple projects.
|
42
42
|
|
43
43
|
Add the guards you need to your Guardfile (see the existing guards below).
|
44
44
|
|
@@ -117,22 +117,26 @@ $ guard [start]
|
|
117
117
|
or if you use Bundler, to run the Guard executable specific to your bundle:
|
118
118
|
|
119
119
|
``` bash
|
120
|
-
$ bundle exec guard
|
120
|
+
$ bundle exec guard [start]
|
121
121
|
```
|
122
122
|
|
123
|
-
Guard will look for a Guardfile in your current directory. If it does not find one, it will look in your `$HOME` directory for
|
123
|
+
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.
|
124
124
|
|
125
125
|
Command line options
|
126
126
|
--------------------
|
127
127
|
|
128
|
-
|
128
|
+
### `--clear` option
|
129
|
+
|
130
|
+
Shell can be cleared after each change:
|
129
131
|
|
130
132
|
``` bash
|
131
133
|
$ guard --clear
|
132
134
|
$ guard -c # shortcut
|
133
135
|
```
|
134
136
|
|
135
|
-
|
137
|
+
### `--notify` option
|
138
|
+
|
139
|
+
Notifications (growl/libnotify) can be disabled:
|
136
140
|
|
137
141
|
``` bash
|
138
142
|
$ guard --notify false
|
@@ -141,14 +145,25 @@ $ guard -n f # shortcut
|
|
141
145
|
|
142
146
|
Notifications can also be disabled globally by setting a `GUARD_NOTIFY` environment variable to `false`
|
143
147
|
|
144
|
-
|
148
|
+
### `--group` option
|
149
|
+
|
150
|
+
Only certain guards groups can be run (see the Guardfile DSL below for creating groups):
|
145
151
|
|
146
152
|
``` bash
|
147
153
|
$ guard --group group_name another_group_name
|
148
154
|
$ guard -g group_name another_group_name # shortcut
|
149
155
|
```
|
150
156
|
|
151
|
-
|
157
|
+
### `--debug` option
|
158
|
+
|
159
|
+
Guard can be run in debug mode:
|
160
|
+
|
161
|
+
``` bash
|
162
|
+
$ guard --debug
|
163
|
+
$ guard -d # shortcut
|
164
|
+
```
|
165
|
+
|
166
|
+
An exhaustive list of options is available with:
|
152
167
|
|
153
168
|
``` bash
|
154
169
|
$ guard help [TASK]
|
@@ -159,20 +174,20 @@ Signal handlers
|
|
159
174
|
|
160
175
|
Signal handlers are used to interact with Guard:
|
161
176
|
|
162
|
-
* `Ctrl-C` - Calls each guard's
|
163
|
-
* `Ctrl-\` - Calls each guard's
|
164
|
-
* `Ctrl-Z` - Calls each guard's
|
177
|
+
* `Ctrl-C` - Calls each guard's `#stop` method, in the same order they are declared in the Guardfile, and then quits Guard itself.
|
178
|
+
* `Ctrl-\` - Calls each guard's `#run_all` method, in the same order they are declared in the Guardfile.
|
179
|
+
* `Ctrl-Z` - Calls each guard's `#reload` method, in the same order they are declared in the Guardfile.
|
165
180
|
|
166
|
-
You can read more about [configure the signal keyboard shortcuts](https://github.com/guard/guard/wiki/Configure-keyboard-shortcuts)
|
181
|
+
You can read more about [configure the signal keyboard shortcuts](https://github.com/guard/guard/wiki/Configure-keyboard-shortcuts) in the wiki.
|
167
182
|
|
168
183
|
Available Guards
|
169
184
|
----------------
|
170
185
|
|
171
|
-
[
|
186
|
+
A list of the available guards is present [in the wiki](https://github.com/guard/guard/wiki/List-of-available-Guards).
|
172
187
|
|
173
188
|
### Add a guard to your Guardfile
|
174
189
|
|
175
|
-
Add it to your Gemfile (inside the `
|
190
|
+
Add it to your Gemfile (inside the `development` group):
|
176
191
|
|
177
192
|
``` ruby
|
178
193
|
gem '<guard-name>'
|
@@ -184,21 +199,21 @@ Insert default guard's definition to your Guardfile by running this command:
|
|
184
199
|
$ guard init <guard-name>
|
185
200
|
```
|
186
201
|
|
187
|
-
You are good to go
|
202
|
+
You are good to go, or you can modify your guards' definition to suit your needs.
|
188
203
|
|
189
204
|
Guardfile DSL
|
190
205
|
-------------
|
191
206
|
|
192
|
-
The Guardfile DSL consists of just three simple methods:
|
207
|
+
The Guardfile DSL consists of just three simple methods: `#guard`, `#watch` & `#group`.
|
193
208
|
|
194
209
|
Required:
|
195
210
|
|
196
|
-
* The
|
197
|
-
* The `watch` method allows you to define which files are supervised by this guard. An optional block can be added to overwrite the paths sent to the `run_on_change` guard method or to launch any arbitrary command.
|
211
|
+
* The `#guard` method allows you to add a guard with an optional hash of options.
|
198
212
|
|
199
213
|
Optional:
|
200
214
|
|
201
|
-
* The `
|
215
|
+
* 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.
|
216
|
+
* 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.
|
202
217
|
|
203
218
|
Example:
|
204
219
|
|
@@ -210,10 +225,10 @@ group 'backend' do
|
|
210
225
|
|
211
226
|
guard 'rspec', :cli => '--color --format doc' do
|
212
227
|
# Regexp watch patterns are matched with Regexp#match
|
213
|
-
watch(%r{^spec/.+_spec\.rb})
|
214
|
-
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
215
|
-
watch(%r{^spec/models/.+\.rb}) { ["spec/models", "spec/acceptance"] }
|
216
|
-
watch(%r{^spec/.+\.rb}) { `say hello` }
|
228
|
+
watch(%r{^spec/.+_spec\.rb$})
|
229
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
230
|
+
watch(%r{^spec/models/.+\.rb$}) { ["spec/models", "spec/acceptance"] }
|
231
|
+
watch(%r{^spec/.+\.rb$}) { `say hello` }
|
217
232
|
|
218
233
|
# String watch patterns are matched with simple '=='
|
219
234
|
watch('spec/spec_helper.rb') { "spec" }
|
@@ -222,22 +237,24 @@ end
|
|
222
237
|
|
223
238
|
group 'frontend' do
|
224
239
|
guard 'coffeescript', :output => 'public/javascripts/compiled' do
|
225
|
-
watch(%r{^app/coffeescripts/.+\.coffee})
|
240
|
+
watch(%r{^app/coffeescripts/.+\.coffee$})
|
226
241
|
end
|
227
242
|
|
228
243
|
guard 'livereload' do
|
229
|
-
watch(%r{^app/.+\.(erb|haml)})
|
244
|
+
watch(%r{^app/.+\.(erb|haml)$})
|
230
245
|
end
|
231
246
|
end
|
232
247
|
```
|
233
248
|
|
249
|
+
### Using a Guardfile without the `guard` binary
|
250
|
+
|
234
251
|
The Guardfile DSL can also be used in a programmatic fashion by calling directly `Guard::Dsl.evaluate_guardfile`.
|
235
252
|
Available options are as follow:
|
236
253
|
|
237
254
|
* `:guardfile` - The path to a valid Guardfile.
|
238
255
|
* `:guardfile_contents` - A string representing the content of a valid Guardfile
|
239
256
|
|
240
|
-
|
257
|
+
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.
|
241
258
|
|
242
259
|
For instance, you could use it as follow:
|
243
260
|
|
@@ -247,28 +264,57 @@ require 'guard'
|
|
247
264
|
|
248
265
|
Guard.setup
|
249
266
|
|
250
|
-
Guard::Dsl.evaluate_guardfile(:guardfile => '/
|
267
|
+
Guard::Dsl.evaluate_guardfile(:guardfile => '/your/custom/path/to/a/valid/Guardfile')
|
251
268
|
# or
|
252
269
|
Guard::Dsl.evaluate_guardfile(:guardfile_contents => "
|
253
270
|
guard 'rspec' do
|
254
|
-
watch(%r{^spec/.+_spec\.rb})
|
271
|
+
watch(%r{^spec/.+_spec\.rb$})
|
255
272
|
end
|
256
273
|
")
|
257
274
|
```
|
258
275
|
|
276
|
+
### Listing defined guards/groups for the current project
|
277
|
+
|
278
|
+
You can list the defined groups and guards for the current Guardfile from the command line using `guard show` or `guard -T`:
|
279
|
+
|
280
|
+
``` bash
|
281
|
+
# guard -T
|
282
|
+
|
283
|
+
(global):
|
284
|
+
shell
|
285
|
+
Group backend:
|
286
|
+
bundler
|
287
|
+
rspec: cli => "--color --format doc'
|
288
|
+
Group frontend:
|
289
|
+
coffeescript: output => "public/javascripts/compiled"
|
290
|
+
livereload
|
291
|
+
```
|
292
|
+
|
259
293
|
Create a new guard
|
260
294
|
------------------
|
261
295
|
|
262
296
|
Creating a new guard is very easy, just create a new gem (`bundle gem` if you use Bundler) with this basic structure:
|
263
297
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
298
|
+
```
|
299
|
+
.travis.yml # bonus point!
|
300
|
+
CHANGELOG.md # bonus point!
|
301
|
+
Gemfile
|
302
|
+
guard-name.gemspec
|
303
|
+
Guardfile
|
304
|
+
lib/
|
305
|
+
guard/
|
306
|
+
guard-name/
|
307
|
+
templates/
|
308
|
+
Guardfile # needed for `guard init <guard-name>`
|
309
|
+
version.rb
|
310
|
+
guard-name.rb
|
311
|
+
test/ # or spec/
|
312
|
+
README.md
|
313
|
+
```
|
314
|
+
|
315
|
+
`Guard::GuardName` (in `lib/guard/guard-name.rb`) must inherit from `Guard::Guard` and should overwrite at least one of the five basic `Guard::Guard` instance methods.
|
270
316
|
|
271
|
-
|
317
|
+
Here is an example scaffold for `lib/guard/guard-name.rb`:
|
272
318
|
|
273
319
|
``` ruby
|
274
320
|
require 'guard'
|
@@ -321,7 +367,7 @@ module Guard
|
|
321
367
|
end
|
322
368
|
```
|
323
369
|
|
324
|
-
Please take a look at the existing guards' source code
|
370
|
+
Please take a look at the [existing guards' source code](https://github.com/guard/guard/wiki/List-of-available-Guards) for more concrete example and inspiration.
|
325
371
|
|
326
372
|
Alternatively, a new guard can be added inline to a Guardfile with this basic structure:
|
327
373
|
|
@@ -341,14 +387,17 @@ module ::Guard
|
|
341
387
|
end
|
342
388
|
```
|
343
389
|
|
390
|
+
Here is a very cool example by [@avdi](https://github.com/avdi) : http://avdi.org/devblog/2011/06/15/a-guardfile-for-redis
|
391
|
+
|
344
392
|
Development
|
345
393
|
-----------
|
346
394
|
|
347
395
|
* Source hosted at [GitHub](https://github.com/guard/guard).
|
348
|
-
* Report
|
396
|
+
* Report issues and feature requests to [GitHub Issues](https://github.com/guard/guard/issues).
|
397
|
+
|
398
|
+
Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make. Please **do not change** the version in your pull-request.
|
349
399
|
|
350
|
-
|
351
|
-
you make. Please do not change the version in your pull-request.
|
400
|
+
For questions please join us on our [Google group](http://groups.google.com/group/guard-dev) or on `#guard` (irc.freenode.net).
|
352
401
|
|
353
402
|
Author
|
354
403
|
------
|
data/lib/guard.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
module Guard
|
2
2
|
|
3
|
-
autoload :UI,
|
4
|
-
autoload :Dsl,
|
5
|
-
autoload :
|
6
|
-
autoload :
|
7
|
-
autoload :
|
8
|
-
autoload :
|
3
|
+
autoload :UI, 'guard/ui'
|
4
|
+
autoload :Dsl, 'guard/dsl'
|
5
|
+
autoload :DslDescriber, 'guard/dsl_describer'
|
6
|
+
autoload :Interactor, 'guard/interactor'
|
7
|
+
autoload :Listener, 'guard/listener'
|
8
|
+
autoload :Watcher, 'guard/watcher'
|
9
|
+
autoload :Notifier, 'guard/notifier'
|
9
10
|
|
10
11
|
class << self
|
11
12
|
attr_accessor :options, :guards, :listener
|
@@ -22,22 +23,21 @@ module Guard
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def start(options = {})
|
26
|
+
UI.clear if options[:clear]
|
25
27
|
setup(options)
|
26
28
|
|
27
29
|
Interactor.init_signal_traps
|
28
30
|
Dsl.evaluate_guardfile(options)
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
else
|
33
|
-
listener.on_change do |files|
|
34
|
-
run { run_on_change_for_all_guards(files) } if Watcher.match_files?(guards, files)
|
35
|
-
end
|
32
|
+
listener.on_change do |files|
|
33
|
+
Dsl.revaluate_guardfile if Watcher.match_guardfile?(files)
|
36
34
|
|
37
|
-
|
38
|
-
guards.each { |guard| supervised_task(guard, :start) }
|
39
|
-
listener.start
|
35
|
+
run { run_on_change_for_all_guards(files) } if Watcher.match_files?(guards, files)
|
40
36
|
end
|
37
|
+
|
38
|
+
UI.info "Guard is now watching at '#{Dir.pwd}'"
|
39
|
+
guards.each { |guard| supervised_task(guard, :start) }
|
40
|
+
listener.start
|
41
41
|
end
|
42
42
|
|
43
43
|
def run_on_change_for_all_guards(files)
|
@@ -58,11 +58,12 @@ module Guard
|
|
58
58
|
# fire it if his work leads to a system failure
|
59
59
|
def supervised_task(guard, task_to_supervise, *args)
|
60
60
|
guard.send(task_to_supervise, *args)
|
61
|
-
rescue Exception
|
62
|
-
UI.error("#{guard.class.name}
|
61
|
+
rescue Exception => ex
|
62
|
+
UI.error("#{guard.class.name} failed to achieve its <#{task_to_supervise.to_s}>, exception was:" +
|
63
|
+
"\n#{ex.class}: #{ex.message}\n#{ex.backtrace.join("\n")}")
|
63
64
|
guards.delete guard
|
64
|
-
UI.info("
|
65
|
-
return
|
65
|
+
UI.info("\n#{guard.class.name} has just been fired")
|
66
|
+
return ex
|
66
67
|
end
|
67
68
|
|
68
69
|
def run
|
@@ -76,8 +77,12 @@ module Guard
|
|
76
77
|
end
|
77
78
|
|
78
79
|
def add_guard(name, watchers = [], options = {})
|
79
|
-
|
80
|
-
|
80
|
+
if name.downcase == 'ego'
|
81
|
+
UI.deprecation("Guard::Ego is now part of Guard you can removed it from your Guardfile.")
|
82
|
+
else
|
83
|
+
guard_class = get_guard_class(name)
|
84
|
+
@guards << guard_class.new(watchers, options)
|
85
|
+
end
|
81
86
|
end
|
82
87
|
|
83
88
|
def get_guard_class(name)
|
data/lib/guard/cli.rb
CHANGED
@@ -15,13 +15,13 @@ module Guard
|
|
15
15
|
::Guard.start(options)
|
16
16
|
end
|
17
17
|
|
18
|
-
desc "version", "Prints Guard's version
|
18
|
+
desc "version", "Prints Guard's version"
|
19
19
|
def version
|
20
20
|
::Guard::UI.info "Guard version #{Guard::VERSION}"
|
21
21
|
end
|
22
22
|
map %w(-v --version) => :version
|
23
23
|
|
24
|
-
desc "init [GUARD]", "Generates a Guardfile into the current working directory, or insert the given GUARD"
|
24
|
+
desc "init [GUARD]", "Generates a Guardfile into the current working directory, or insert the given GUARD in an existing Guardfile"
|
25
25
|
def init(guard_name = nil)
|
26
26
|
if !File.exist?("Guardfile")
|
27
27
|
puts "Writing new Guardfile to #{Dir.pwd}/Guardfile"
|
@@ -37,5 +37,31 @@ module Guard
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
desc "show", "Show all defined Guards and their options"
|
41
|
+
def show
|
42
|
+
::Guard::DslDescriber.evaluate_guardfile(options)
|
43
|
+
|
44
|
+
::Guard::DslDescriber.guardfile_structure.each do |group|
|
45
|
+
if !group[:guards].empty?
|
46
|
+
if group[:group]
|
47
|
+
::Guard::UI.info "Group #{group[:group]}:"
|
48
|
+
else
|
49
|
+
::Guard::UI.info "(global):"
|
50
|
+
end
|
51
|
+
|
52
|
+
group[:guards].each do |guard|
|
53
|
+
line = " #{guard[:name]}"
|
54
|
+
|
55
|
+
if !guard[:options].empty?
|
56
|
+
line += ": #{guard[:options].collect { |k, v| "#{k} => #{v.inspect}" }.join(", ")}"
|
57
|
+
end
|
58
|
+
::Guard::UI.info line
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
::Guard::UI.info ''
|
64
|
+
end
|
65
|
+
map %w(-T) => :show
|
40
66
|
end
|
41
|
-
end
|
67
|
+
end
|
data/lib/guard/dsl.rb
CHANGED
@@ -2,12 +2,22 @@ module Guard
|
|
2
2
|
class Dsl
|
3
3
|
class << self
|
4
4
|
@@options = nil
|
5
|
-
|
5
|
+
|
6
6
|
def evaluate_guardfile(options = {})
|
7
7
|
options.is_a?(Hash) or raise ArgumentError.new("evaluate_guardfile not passed a Hash!")
|
8
8
|
|
9
9
|
@@options = options.dup
|
10
10
|
instance_eval_guardfile(fetch_guardfile_contents)
|
11
|
+
|
12
|
+
UI.error "No guards found in Guardfile, please add at least one." if ::Guard.guards.empty?
|
13
|
+
end
|
14
|
+
|
15
|
+
def revaluate_guardfile
|
16
|
+
::Guard.guards.clear
|
17
|
+
Dsl.evaluate_guardfile(@@options)
|
18
|
+
msg = "Guardfile has been re-evaluated."
|
19
|
+
UI.info(msg)
|
20
|
+
Notifier.notify(msg)
|
11
21
|
end
|
12
22
|
|
13
23
|
def instance_eval_guardfile(contents)
|
@@ -69,6 +79,10 @@ module Guard
|
|
69
79
|
@@options ? @@options[:guardfile_contents] : ""
|
70
80
|
end
|
71
81
|
|
82
|
+
def guardfile_path
|
83
|
+
@@options ? @@options[:guardfile_path] : ""
|
84
|
+
end
|
85
|
+
|
72
86
|
def guardfile_contents_usable?
|
73
87
|
guardfile_contents && guardfile_contents.size >= 'guard :a'.size # smallest guard-definition
|
74
88
|
end
|
@@ -84,7 +98,7 @@ module Guard
|
|
84
98
|
end
|
85
99
|
|
86
100
|
def home_guardfile_path
|
87
|
-
File.expand_path(File.join("~", "Guardfile"))
|
101
|
+
File.expand_path(File.join("~", ".Guardfile"))
|
88
102
|
end
|
89
103
|
|
90
104
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'guard/dsl'
|
2
|
+
|
3
|
+
module Guard
|
4
|
+
class DslDescriber < Dsl
|
5
|
+
@@guardfile_structure = [ { :guards => [] } ]
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def guardfile_structure
|
9
|
+
@@guardfile_structure
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
def group(name, &guard_definition)
|
15
|
+
@@guardfile_structure << { :group => name.to_sym, :guards => [] }
|
16
|
+
|
17
|
+
@group = true
|
18
|
+
guard_definition.call
|
19
|
+
@group = false
|
20
|
+
end
|
21
|
+
|
22
|
+
def guard(name, options = {}, &watch_definition)
|
23
|
+
node = (@group ? @@guardfile_structure.last : @@guardfile_structure.first)
|
24
|
+
|
25
|
+
node[:guards] << { :name => name, :options => options }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
data/lib/guard/listener.rb
CHANGED
@@ -47,7 +47,7 @@ module Guard
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def modified_files(dirs, options = {})
|
50
|
-
files = potentially_modified_files(dirs, options).select { |path|
|
50
|
+
files = potentially_modified_files(dirs, options).select { |path| file_modified?(path) }
|
51
51
|
relativate_paths files
|
52
52
|
end
|
53
53
|
|
@@ -77,12 +77,11 @@ module Guard
|
|
77
77
|
!!@relativate_paths
|
78
78
|
end
|
79
79
|
|
80
|
-
|
81
80
|
private
|
82
81
|
|
83
82
|
def potentially_modified_files(dirs, options = {})
|
84
83
|
match = options[:all] ? "**/*" : "*"
|
85
|
-
Dir.glob(dirs.map { |dir| "#{dir}#{match}" })
|
84
|
+
Dir.glob(dirs.map { |dir| "#{dir}#{match}" }, File::FNM_DOTMATCH).select { |file| File.file?(file) }
|
86
85
|
end
|
87
86
|
|
88
87
|
# Depending on the filesystem, mtime is probably only precise to the second, so round
|
@@ -116,15 +115,15 @@ module Guard
|
|
116
115
|
end
|
117
116
|
|
118
117
|
def self.mac?
|
119
|
-
|
118
|
+
RbConfig::CONFIG['target_os'] =~ /darwin/i
|
120
119
|
end
|
121
120
|
|
122
121
|
def self.linux?
|
123
|
-
|
122
|
+
RbConfig::CONFIG['target_os'] =~ /linux/i
|
124
123
|
end
|
125
124
|
|
126
125
|
def self.windows?
|
127
|
-
|
126
|
+
RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
|
128
127
|
end
|
129
128
|
|
130
129
|
end
|
@@ -47,7 +47,8 @@ module Guard
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def watch(directory)
|
50
|
-
|
50
|
+
# The event selection is based on https://github.com/guard/guard/wiki/Analysis-of-inotify-events-for-different-editors
|
51
|
+
worker.watch(directory, :recursive, :create, :move_self, :close_write) do |event|
|
51
52
|
unless event.name == "" # Event on root directory
|
52
53
|
@files << event.absolute_name
|
53
54
|
end
|
@@ -58,18 +59,15 @@ module Guard
|
|
58
59
|
def watch_change
|
59
60
|
@watch_change = true
|
60
61
|
until @stop
|
61
|
-
if
|
62
|
+
if RbConfig::CONFIG['build'] =~ /java/ || IO.select([inotify.to_io], [], [], latency)
|
62
63
|
break if @stop
|
63
64
|
|
64
65
|
sleep latency
|
65
66
|
inotify.process
|
66
|
-
update_last_event
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
files.clear
|
72
|
-
end
|
68
|
+
modified_files = modified_files(files.shift(files.size).map{|f| File.dirname(f) + '/' }.uniq)
|
69
|
+
update_last_event
|
70
|
+
callback.call(modified_files) unless modified_files.empty?
|
73
71
|
end
|
74
72
|
end
|
75
73
|
@watch_change = false
|
data/lib/guard/notifier.rb
CHANGED
@@ -11,7 +11,7 @@ module Guard
|
|
11
11
|
|
12
12
|
def self.turn_on
|
13
13
|
ENV["GUARD_NOTIFY"] = 'true'
|
14
|
-
case
|
14
|
+
case RbConfig::CONFIG['target_os']
|
15
15
|
when /darwin/i
|
16
16
|
require_growl
|
17
17
|
when /linux/i
|
@@ -26,7 +26,7 @@ module Guard
|
|
26
26
|
image = options.delete(:image) || :success
|
27
27
|
title = options.delete(:title) || "Guard"
|
28
28
|
|
29
|
-
case
|
29
|
+
case RbConfig::CONFIG['target_os']
|
30
30
|
when /darwin/i
|
31
31
|
notify_mac(title, message, image, options)
|
32
32
|
when /linux/i
|
data/lib/guard/ui.rb
CHANGED
@@ -12,7 +12,14 @@ module Guard
|
|
12
12
|
def error(message, options = {})
|
13
13
|
unless ENV["GUARD_ENV"] == "test"
|
14
14
|
reset_line if options[:reset]
|
15
|
-
puts "ERROR: #{message}"
|
15
|
+
puts "#{color('ERROR:', ';31')} #{message}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def deprecation(message, options = {})
|
20
|
+
unless ENV["GUARD_ENV"] == "test"
|
21
|
+
reset_line if options[:reset]
|
22
|
+
puts "#{color('DEPRECATION:', ';31')} #{message}"
|
16
23
|
end
|
17
24
|
end
|
18
25
|
|
@@ -24,11 +31,7 @@ module Guard
|
|
24
31
|
end
|
25
32
|
|
26
33
|
def reset_line
|
27
|
-
|
28
|
-
print "\r\e[0m"
|
29
|
-
else
|
30
|
-
print "\r\n"
|
31
|
-
end
|
34
|
+
print(color_enabled? ? "\r\e[0m" : "\r\n")
|
32
35
|
end
|
33
36
|
|
34
37
|
def clear
|
@@ -38,24 +41,21 @@ module Guard
|
|
38
41
|
private
|
39
42
|
|
40
43
|
def reset_color(text)
|
41
|
-
color(text, "
|
44
|
+
color(text, "")
|
42
45
|
end
|
43
46
|
|
44
47
|
def color(text, color_code)
|
45
|
-
|
46
|
-
return "#{color_code}#{text}\e[0m"
|
47
|
-
else
|
48
|
-
return text
|
49
|
-
end
|
48
|
+
color_enabled? ? "\e[0#{color_code}m#{text}\e[0m" : text
|
50
49
|
end
|
51
50
|
|
52
51
|
def color_enabled?
|
53
|
-
@color_enabled ||= if
|
52
|
+
@color_enabled ||= if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
|
54
53
|
unless ENV['ANSICON']
|
55
54
|
begin
|
56
55
|
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
57
56
|
require 'Win32/Console/ANSI'
|
58
57
|
rescue LoadError
|
58
|
+
@color_enabled = false
|
59
59
|
info "You must 'gem install win32console' to use color on Windows"
|
60
60
|
false
|
61
61
|
end
|
data/lib/guard/version.rb
CHANGED
data/lib/guard/watcher.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Guard
|
2
2
|
class Watcher
|
3
3
|
attr_accessor :pattern, :action
|
4
|
-
|
4
|
+
|
5
5
|
def initialize(pattern, action = nil)
|
6
6
|
@pattern, @action = pattern, action
|
7
7
|
@@warning_printed ||= false
|
8
|
-
|
8
|
+
|
9
9
|
# deprecation warning
|
10
10
|
if @pattern.is_a?(String) && @pattern =~ /(^(\^))|(>?(\\\.)|(\.\*))|(\(.*\))|(\[.*\])|(\$$)/
|
11
11
|
unless @@warning_printed
|
@@ -17,7 +17,7 @@ module Guard
|
|
17
17
|
@pattern = Regexp.new(@pattern)
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def self.match_files(guard, files)
|
22
22
|
guard.watchers.inject([]) do |paths, watcher|
|
23
23
|
files.each do |file|
|
@@ -33,7 +33,7 @@ module Guard
|
|
33
33
|
paths.flatten.map { |p| p.to_s }
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def self.match_files?(guards, files)
|
38
38
|
guards.any? do |guard|
|
39
39
|
guard.watchers.any? do |watcher|
|
@@ -41,7 +41,7 @@ module Guard
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
def match_file?(file)
|
46
46
|
if @pattern.is_a?(Regexp)
|
47
47
|
file.match(@pattern)
|
@@ -49,14 +49,18 @@ module Guard
|
|
49
49
|
file == @pattern ? [file] : nil
|
50
50
|
end
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
|
+
def self.match_guardfile?(files)
|
54
|
+
files.any? { |file| "#{Dir.pwd}/#{file}" == Dsl.guardfile_path }
|
55
|
+
end
|
56
|
+
|
53
57
|
def call_action(matches)
|
54
58
|
begin
|
55
59
|
@action.arity > 0 ? @action.call(matches) : @action.call
|
56
|
-
rescue
|
57
|
-
UI.error "Problem with watch action
|
60
|
+
rescue Exception => e
|
61
|
+
UI.error "Problem with watch action!\n#{e.message}\n\n#{e.backtrace.join("\n")}"
|
58
62
|
end
|
59
63
|
end
|
60
|
-
|
64
|
+
|
61
65
|
end
|
62
66
|
end
|
data/man/guard.1
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
|
+
.
|
4
|
+
.TH "GUARD" "1" "June 2011" "" ""
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBguard\fR \- Guard keeps an eye on your file modifications\.
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
guard \fIcommand\fR \fIoptions\fR
|
11
|
+
.
|
12
|
+
.SH "DESCRIPTION"
|
13
|
+
Guard is a command line tool that easily handle events on files modifications\.
|
14
|
+
.
|
15
|
+
.SH "HOMEPAGE"
|
16
|
+
https://github\.com/guard/guard
|
17
|
+
.
|
18
|
+
.SH "OPTIONS"
|
19
|
+
.
|
20
|
+
.TP
|
21
|
+
\fB\-c\fR, \fB\-\-clear\fR
|
22
|
+
Clears the Shell after each change\.
|
23
|
+
.
|
24
|
+
.TP
|
25
|
+
\fB\-n\fR \fIflag\fR, \fB\-\-notify\fR \fIflag\fR
|
26
|
+
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 \fIflag\fR part can be passed to guard using true/false or t/f\.
|
27
|
+
.
|
28
|
+
.TP
|
29
|
+
\fB\-g\fR \fIgroup\fR \.\.\., \fB\-\-group\fR \fIgroup\fR \.\.\.
|
30
|
+
Runs only the groups specified\.
|
31
|
+
.
|
32
|
+
.TP
|
33
|
+
\fB\-d\fR, \fB\-\-debug\fR
|
34
|
+
Runs Guard in debug mode\.
|
35
|
+
.
|
36
|
+
.TP
|
37
|
+
\fB\-h\fR
|
38
|
+
List all of Guard\'s available commands\.
|
39
|
+
.
|
40
|
+
.SH "COMMANDS"
|
41
|
+
.
|
42
|
+
.TP
|
43
|
+
\fBstart\fR
|
44
|
+
Starts Guard\. This is the default command if none is provided\.
|
45
|
+
.
|
46
|
+
.TP
|
47
|
+
\fBinit\fR [guard]
|
48
|
+
Add the requested guard\'s default Guardfile configuration to the current Guardfile\.
|
49
|
+
.
|
50
|
+
.TP
|
51
|
+
\fBshow\fR, \fB\-T\fR
|
52
|
+
List defined groups and guards for the current Guardfile\.
|
53
|
+
.
|
54
|
+
.SH "EXAMPLES"
|
55
|
+
\fB[bundle exec] guard \-\-clear \-\-group backend frontend \-\-notify false \-\-debug\fR
|
56
|
+
.
|
57
|
+
.P
|
58
|
+
or in a more concise way:
|
59
|
+
.
|
60
|
+
.P
|
61
|
+
\fB[bundle exec] guard \-c \-g backend frontend \-n f \-d\fR
|
62
|
+
.
|
63
|
+
.SH "AUTHORS / CONTRIBUTORS"
|
64
|
+
Thibaud Guillaume\-Gentil is the main author\.
|
65
|
+
.
|
66
|
+
.P
|
67
|
+
A list of contributors based on all commits can be found here: https://github\.com/guard/guard/contributors
|
68
|
+
.
|
69
|
+
.P
|
70
|
+
For an exhaustive list of all the contributors, please see the CHANGELOG: https://github\.com/guard/guard/blob/master/CHANGELOG\.md
|
data/man/guard.1.html
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv='content-type' value='text/html;charset=utf8'>
|
5
|
+
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
|
6
|
+
<title>guard(1) - Guard keeps an eye on your file modifications.</title>
|
7
|
+
<style type='text/css' media='all'>
|
8
|
+
/* style: man */
|
9
|
+
body#manpage {margin:0}
|
10
|
+
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
11
|
+
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
12
|
+
.mp h2 {margin:10px 0 0 0}
|
13
|
+
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
14
|
+
.mp h3 {margin:0 0 0 4ex}
|
15
|
+
.mp dt {margin:0;clear:left}
|
16
|
+
.mp dt.flush {float:left;width:8ex}
|
17
|
+
.mp dd {margin:0 0 0 9ex}
|
18
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
19
|
+
.mp pre {margin-bottom:20px}
|
20
|
+
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
21
|
+
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
22
|
+
.mp img {display:block;margin:auto}
|
23
|
+
.mp h1.man-title {display:none}
|
24
|
+
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
25
|
+
.mp h2 {font-size:16px;line-height:1.25}
|
26
|
+
.mp h1 {font-size:20px;line-height:2}
|
27
|
+
.mp {text-align:justify;background:#fff}
|
28
|
+
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
29
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
30
|
+
.mp u {text-decoration:underline}
|
31
|
+
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
32
|
+
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
33
|
+
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
34
|
+
.mp b.man-ref {font-weight:normal;color:#434241}
|
35
|
+
.mp pre {padding:0 4ex}
|
36
|
+
.mp pre code {font-weight:normal;color:#434241}
|
37
|
+
.mp h2+pre,h3+pre {padding-left:0}
|
38
|
+
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
39
|
+
ol.man-decor {width:100%}
|
40
|
+
ol.man-decor li.tl {text-align:left}
|
41
|
+
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
42
|
+
ol.man-decor li.tr {text-align:right;float:right}
|
43
|
+
</style>
|
44
|
+
</head>
|
45
|
+
<!--
|
46
|
+
The following styles are deprecated and will be removed at some point:
|
47
|
+
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
48
|
+
|
49
|
+
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
50
|
+
.man-navigation should be used instead.
|
51
|
+
-->
|
52
|
+
<body id='manpage'>
|
53
|
+
<div class='mp' id='man'>
|
54
|
+
|
55
|
+
<div class='man-navigation' style='display:none'>
|
56
|
+
<a href="#NAME">NAME</a>
|
57
|
+
<a href="#SYNOPSIS">SYNOPSIS</a>
|
58
|
+
<a href="#DESCRIPTION">DESCRIPTION</a>
|
59
|
+
<a href="#HOMEPAGE">HOMEPAGE</a>
|
60
|
+
<a href="#OPTIONS">OPTIONS</a>
|
61
|
+
<a href="#COMMANDS">COMMANDS</a>
|
62
|
+
<a href="#EXAMPLES">EXAMPLES</a>
|
63
|
+
<a href="#AUTHORS-CONTRIBUTORS">AUTHORS / CONTRIBUTORS</a>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<ol class='man-decor man-head man head'>
|
67
|
+
<li class='tl'>guard(1)</li>
|
68
|
+
<li class='tc'></li>
|
69
|
+
<li class='tr'>guard(1)</li>
|
70
|
+
</ol>
|
71
|
+
|
72
|
+
<h2 id="NAME">NAME</h2>
|
73
|
+
<p class="man-name">
|
74
|
+
<code>guard</code> - <span class="man-whatis">Guard keeps an eye on your file modifications.</span>
|
75
|
+
</p>
|
76
|
+
|
77
|
+
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
78
|
+
|
79
|
+
<p>guard <var>command</var> <var>options</var></p>
|
80
|
+
|
81
|
+
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
82
|
+
|
83
|
+
<p>Guard is a command line tool that easily handle events on files modifications.</p>
|
84
|
+
|
85
|
+
<h2 id="HOMEPAGE">HOMEPAGE</h2>
|
86
|
+
|
87
|
+
<p>https://github.com/guard/guard</p>
|
88
|
+
|
89
|
+
<h2 id="OPTIONS">OPTIONS</h2>
|
90
|
+
|
91
|
+
<dl>
|
92
|
+
<dt><code>-c</code>, <code>--clear</code></dt><dd><p>Clears the Shell after each change.</p></dd>
|
93
|
+
<dt><code>-n</code> <var>flag</var>, <code>--notify</code> <var>flag</var></dt><dd><p>Disable notifications (Growl or Libnotify depending on your system).
|
94
|
+
Note that notifications can also be disabled globally by setting a GUARD_NOTIFY environment variable to false.
|
95
|
+
The <var>flag</var> part can be passed to guard using true/false or t/f.</p></dd>
|
96
|
+
<dt><code>-g</code> <var>group</var> ..., <code>--group</code> <var>group</var> ...</dt><dd><p>Runs only the groups specified.</p></dd>
|
97
|
+
<dt><code>-d</code>, <code>--debug</code></dt><dd><p>Runs Guard in debug mode.</p></dd>
|
98
|
+
<dt class="flush"><code>-h</code></dt><dd><p>List all of Guard's available commands.</p></dd>
|
99
|
+
</dl>
|
100
|
+
|
101
|
+
|
102
|
+
<h2 id="COMMANDS">COMMANDS</h2>
|
103
|
+
|
104
|
+
<dl>
|
105
|
+
<dt class="flush"><code>start</code></dt><dd><p>Starts Guard. This is the default command if none is provided.</p></dd>
|
106
|
+
<dt><code>init</code> [guard]</dt><dd><p>Add the requested guard's default Guardfile configuration to the current Guardfile.</p></dd>
|
107
|
+
<dt><code>show</code>, <code>-T</code></dt><dd><p>List defined groups and guards for the current Guardfile.</p></dd>
|
108
|
+
</dl>
|
109
|
+
|
110
|
+
|
111
|
+
<h2 id="EXAMPLES">EXAMPLES</h2>
|
112
|
+
|
113
|
+
<p><code>[bundle exec] guard --clear --group backend frontend --notify false --debug</code></p>
|
114
|
+
|
115
|
+
<p>or in a more concise way:</p>
|
116
|
+
|
117
|
+
<p><code>[bundle exec] guard -c -g backend frontend -n f -d</code></p>
|
118
|
+
|
119
|
+
<h2 id="AUTHORS-CONTRIBUTORS">AUTHORS / CONTRIBUTORS</h2>
|
120
|
+
|
121
|
+
<p>Thibaud Guillaume-Gentil is the main author.</p>
|
122
|
+
|
123
|
+
<p>A list of contributors based on all commits can be found here:
|
124
|
+
https://github.com/guard/guard/contributors</p>
|
125
|
+
|
126
|
+
<p>For an exhaustive list of all the contributors, please see the CHANGELOG:
|
127
|
+
https://github.com/guard/guard/blob/master/CHANGELOG.md</p>
|
128
|
+
|
129
|
+
|
130
|
+
<ol class='man-decor man-foot man foot'>
|
131
|
+
<li class='tl'></li>
|
132
|
+
<li class='tc'>June 2011</li>
|
133
|
+
<li class='tr'>guard(1)</li>
|
134
|
+
</ol>
|
135
|
+
|
136
|
+
</div>
|
137
|
+
</body>
|
138
|
+
</html>
|
metadata
CHANGED
@@ -1,101 +1,76 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
- 2
|
10
|
-
version: 0.4.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Thibaud Guillaume-Gentil
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-06-08 00:00:00 +02:00
|
12
|
+
date: 2011-07-02 00:00:00.000000000 +02:00
|
19
13
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: bundler
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &2164408000 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
33
23
|
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rspec
|
37
24
|
prerelease: false
|
38
|
-
|
25
|
+
version_requirements: *2164408000
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec
|
28
|
+
requirement: &2164407200 !ruby/object:Gem::Requirement
|
39
29
|
none: false
|
40
|
-
requirements:
|
30
|
+
requirements:
|
41
31
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 23
|
44
|
-
segments:
|
45
|
-
- 2
|
46
|
-
- 6
|
47
|
-
- 0
|
32
|
+
- !ruby/object:Gem::Version
|
48
33
|
version: 2.6.0
|
49
34
|
type: :development
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: guard-rspec
|
53
35
|
prerelease: false
|
54
|
-
|
36
|
+
version_requirements: *2164407200
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: guard-rspec
|
39
|
+
requirement: &2164406640 !ruby/object:Gem::Requirement
|
55
40
|
none: false
|
56
|
-
requirements:
|
41
|
+
requirements:
|
57
42
|
- - ~>
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
hash: 17
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
- 3
|
63
|
-
- 1
|
43
|
+
- !ruby/object:Gem::Version
|
64
44
|
version: 0.3.1
|
65
45
|
type: :development
|
66
|
-
version_requirements: *id003
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
name: thor
|
69
46
|
prerelease: false
|
70
|
-
|
47
|
+
version_requirements: *2164406640
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: thor
|
50
|
+
requirement: &2164406140 !ruby/object:Gem::Requirement
|
71
51
|
none: false
|
72
|
-
requirements:
|
52
|
+
requirements:
|
73
53
|
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
hash: 43
|
76
|
-
segments:
|
77
|
-
- 0
|
78
|
-
- 14
|
79
|
-
- 6
|
54
|
+
- !ruby/object:Gem::Version
|
80
55
|
version: 0.14.6
|
81
56
|
type: :runtime
|
82
|
-
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *2164406140
|
83
59
|
description: Guard is a command line tool to easily handle events on file system modifications.
|
84
|
-
email:
|
60
|
+
email:
|
85
61
|
- thibaud@thibaud.me
|
86
|
-
executables:
|
62
|
+
executables:
|
87
63
|
- guard
|
88
64
|
extensions: []
|
89
|
-
|
90
65
|
extra_rdoc_files: []
|
91
|
-
|
92
|
-
files:
|
66
|
+
files:
|
93
67
|
- bin/guard
|
94
68
|
- images/failed.png
|
95
69
|
- images/pending.png
|
96
70
|
- images/success.png
|
97
71
|
- lib/guard/cli.rb
|
98
72
|
- lib/guard/dsl.rb
|
73
|
+
- lib/guard/dsl_describer.rb
|
99
74
|
- lib/guard/guard.rb
|
100
75
|
- lib/guard/interactor.rb
|
101
76
|
- lib/guard/listener.rb
|
@@ -109,44 +84,34 @@ files:
|
|
109
84
|
- lib/guard/version.rb
|
110
85
|
- lib/guard/watcher.rb
|
111
86
|
- lib/guard.rb
|
87
|
+
- CHANGELOG.md
|
112
88
|
- LICENSE
|
89
|
+
- man/guard.1
|
90
|
+
- man/guard.1.html
|
113
91
|
- README.md
|
114
|
-
- CHANGELOG.md
|
115
92
|
has_rdoc: true
|
116
93
|
homepage: https://github.com/guard/guard
|
117
94
|
licenses: []
|
118
|
-
|
119
95
|
post_install_message:
|
120
96
|
rdoc_options: []
|
121
|
-
|
122
|
-
require_paths:
|
97
|
+
require_paths:
|
123
98
|
- lib
|
124
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
100
|
none: false
|
126
|
-
requirements:
|
127
|
-
- -
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
|
130
|
-
|
131
|
-
- 0
|
132
|
-
version: "0"
|
133
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
106
|
none: false
|
135
|
-
requirements:
|
136
|
-
- -
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
hash: 23
|
139
|
-
segments:
|
140
|
-
- 1
|
141
|
-
- 3
|
142
|
-
- 6
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
143
110
|
version: 1.3.6
|
144
111
|
requirements: []
|
145
|
-
|
146
112
|
rubyforge_project: guard
|
147
113
|
rubygems_version: 1.6.2
|
148
114
|
signing_key:
|
149
115
|
specification_version: 3
|
150
116
|
summary: Guard keeps an eye on your file modifications
|
151
117
|
test_files: []
|
152
|
-
|