guard 2.10.4 → 2.10.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -665
- data/lib/guard/internals/session.rb +9 -2
- data/lib/guard/templates/Guardfile +5 -11
- data/lib/guard/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df6dd8c3a8afddbe828bc11ed09f1586ebd6a5fa
|
4
|
+
data.tar.gz: 64d5137c8119bdc11273ba20aa3592e228dbaf3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19e7f4548e9b3d36560ce126b8bc3df6a95ac789d82a9bf811c00f88f9fae2f9b2c7dff248b73a8f70a1785471fde1dd28932486e13497cc9715270412431a25
|
7
|
+
data.tar.gz: 5893cb11c600e01bb7e999255696ce081a62389abd2d20ac5031131f03aa82f7d990e837c5dd3676d699391c99e6791a2bff7f03f0c153713e1926e45ae01972
|
data/README.md
CHANGED
@@ -120,63 +120,7 @@ Usage
|
|
120
120
|
|
121
121
|
Guard is run from the command line. Please open your terminal and go to your project work directory.
|
122
122
|
|
123
|
-
|
124
|
-
|
125
|
-
You can always get help on the available tasks with the `help` task:
|
126
|
-
|
127
|
-
```bash
|
128
|
-
$ bundle exec guard help
|
129
|
-
```
|
130
|
-
|
131
|
-
Requesting more detailed help on a specific task is simple: just append the task name to the help task.
|
132
|
-
For example, to get help for the `start` task, simply run:
|
133
|
-
|
134
|
-
```bash
|
135
|
-
$ bundle exec guard help start
|
136
|
-
```
|
137
|
-
|
138
|
-
### Init
|
139
|
-
|
140
|
-
You can generate a Guardfile and have all installed plugins be automatically added into
|
141
|
-
it by running the `init` task without any option:
|
142
|
-
|
143
|
-
```bash
|
144
|
-
$ bundle exec guard init
|
145
|
-
```
|
146
|
-
|
147
|
-
You can also specify the name of an installed plugin to only get that plugin template
|
148
|
-
in the generated Guardfile:
|
149
|
-
|
150
|
-
```bash
|
151
|
-
$ bundle exec guard init <guard-name>
|
152
|
-
```
|
153
|
-
|
154
|
-
You can also specify the names of multiple plugins to only get those plugin templates
|
155
|
-
in the generated Guardfile:
|
156
|
-
|
157
|
-
```bash
|
158
|
-
$ bundle exec guard init <guard1-name> <guard2-name>
|
159
|
-
```
|
160
|
-
|
161
|
-
You can also define your own templates in `~/.guard/templates/` which can be appended in the same way to your existing
|
162
|
-
`Guardfile`:
|
163
|
-
|
164
|
-
```bash
|
165
|
-
$ bundle exec guard init <template-name>
|
166
|
-
```
|
167
|
-
|
168
|
-
**Note**: If you already have a `Guardfile` in the current directory, the `init` task can be used
|
169
|
-
to append a supplied template from an installed plugin to your existing `Guardfile`.
|
170
|
-
|
171
|
-
#### `-b`/`--bare` option
|
172
|
-
|
173
|
-
You can generate an empty `Guardfile` by running the `init` task with the bare
|
174
|
-
option:
|
175
|
-
|
176
|
-
```bash
|
177
|
-
$ bundle exec guard init --bare
|
178
|
-
$ bundle exec guard init -b # shortcut
|
179
|
-
```
|
123
|
+
Look here for a full [list of Guard commands](https://github.com/guard/guard/wiki/List-of-Guard-Commands)
|
180
124
|
|
181
125
|
### Start
|
182
126
|
|
@@ -189,621 +133,16 @@ $ bundle exec guard
|
|
189
133
|
Guard will look for a `Guardfile` in your current directory. If it does not find one, it will look in your `$HOME`
|
190
134
|
directory for a `.Guardfile`.
|
191
135
|
|
192
|
-
|
193
|
-
|
194
|
-
The shell can be cleared after each change:
|
195
|
-
|
196
|
-
```bash
|
197
|
-
$ bundle exec guard --clear
|
198
|
-
$ bundle exec guard -c # shortcut
|
199
|
-
```
|
200
|
-
|
201
|
-
You may prefer to enable clearing in all projects by addin the `clearing`
|
202
|
-
statement (described below) in you `~/.guardrc` instead:
|
203
|
-
|
204
|
-
```ruby
|
205
|
-
clearing :on
|
206
|
-
```
|
207
|
-
|
208
|
-
#### `-n`/`--notify` option
|
209
|
-
|
210
|
-
System notifications can be disabled:
|
211
|
-
|
212
|
-
```bash
|
213
|
-
$ bundle exec guard --notify false
|
214
|
-
$ bundle exec guard -n f # shortcut
|
215
|
-
```
|
216
|
-
|
217
|
-
Notifications can also be disabled globally by setting a `GUARD_NOTIFY` environment variable to `false`.
|
218
|
-
|
219
|
-
#### `-g`/`--group` option
|
220
|
-
|
221
|
-
Scope Guard to certain plugin groups on start:
|
222
|
-
|
223
|
-
```bash
|
224
|
-
$ bundle exec guard --group group_name another_group_name
|
225
|
-
$ bundle exec guard -g group_name another_group_name # shortcut
|
226
|
-
```
|
227
|
-
|
228
|
-
See the Guardfile DSL below for creating groups.
|
229
|
-
|
230
|
-
#### `-P`/`--plugin` option
|
231
|
-
|
232
|
-
Scope Guard to certain plugins on start:
|
233
|
-
|
234
|
-
```bash
|
235
|
-
$ bundle exec guard --plugin plugin_name another_plugin_name
|
236
|
-
$ bundle exec guard -P plugin_name another_plugin_name # shortcut
|
237
|
-
```
|
238
|
-
|
239
|
-
#### `-d`/`--debug` option
|
240
|
-
|
241
|
-
Guard can display debug information (useful for plugin
|
242
|
-
developers) with:
|
243
|
-
|
244
|
-
```bash
|
245
|
-
$ bundle exec guard --debug
|
246
|
-
$ bundle exec guard -d # shortcut
|
247
|
-
```
|
248
|
-
|
249
|
-
#### `-w`/`--watchdir` option
|
250
|
-
|
251
|
-
Guard can watch any number of directories instead of only the current directory:
|
252
|
-
|
253
|
-
```bash
|
254
|
-
$ bundle exec guard --watchdir source/files # watch a subdirectory of your project
|
255
|
-
$ bundle exec guard -w source/files # shortcut
|
256
|
-
$ bundle exec guard -w sources/foo assets/foo ./config # multiple directories
|
257
|
-
|
258
|
-
$ bundle exec guard -w /fancy/project # path outside project - watch out! (see below)
|
259
|
-
```
|
260
|
-
*NOTE: this option is only meant for ignoring subdirectories in the CURRENT
|
261
|
-
directory - by selecting which ones to actually track.*
|
262
|
-
|
263
|
-
If your watched directories are outside the current one, or if `--watchdirs` isn't working
|
264
|
-
as you expect, be sure to read: [Correctly using watchdirs](https://github.com/guard/guard/wiki/Correctly-using-the---watchdir-option)
|
265
|
-
|
266
|
-
You may find it more convenient to use the `directories` statement (described
|
267
|
-
below) in your Guardfile
|
268
|
-
|
269
|
-
|
270
|
-
#### `-G`/`--guardfile` option
|
271
|
-
|
272
|
-
Guard can use a `Guardfile` not located in the current directory:
|
273
|
-
|
274
|
-
```bash
|
275
|
-
$ bundle exec guard --guardfile ~/.your_global_guardfile
|
276
|
-
$ bundle exec guard -G ~/.your_global_guardfile # shortcut
|
277
|
-
```
|
278
|
-
*TIP: set `BUNDLER_GEMFILE` environment variable to point to your Gemfile if it isn't in the current directory or the current Gemfile doesn't include all your favorite plugins*
|
279
|
-
|
280
|
-
#### `-i`/`--no-interactions` option
|
281
|
-
|
282
|
-
Turn off completely any Guard terminal interactions with:
|
283
|
-
|
284
|
-
```bash
|
285
|
-
$ bundle exec guard start -i
|
286
|
-
$ bundle exec guard start --no-interactions
|
287
|
-
```
|
288
|
-
|
289
|
-
#### `-B`/`--no-bundler-warning` option
|
290
|
-
|
291
|
-
Skip Bundler warning when a Gemfile exists in the project directory but Guard is not run with Bundler.
|
292
|
-
|
293
|
-
```bash
|
294
|
-
$ bundle exec guard start -B
|
295
|
-
$ bundle exec guard start --no-bundler-warning
|
296
|
-
```
|
297
|
-
|
298
|
-
#### `-l`/`--latency` option
|
299
|
-
|
300
|
-
Overwrite Listen's default latency, useful when your hard-drive / system is slow.
|
301
|
-
|
302
|
-
```bash
|
303
|
-
$ bundle exec guard start -l 1.5
|
304
|
-
$ bundle exec guard start --latency 1.5
|
305
|
-
```
|
306
|
-
|
307
|
-
*NOTE: this option is OS specific: while higher values may reduce CPU usage
|
308
|
-
(and lower values may increase responsiveness) when in polling mode , it has no
|
309
|
-
effect for optimized backends (except on Mac OS). If guard is not behaving as
|
310
|
-
you want, you'll likely instead want to tweak the `--wait-for-delay` option
|
311
|
-
below or use the `--watchdirs` option.*
|
312
|
-
|
313
|
-
|
314
|
-
#### `-p`/`--force-polling` option
|
315
|
-
|
316
|
-
Force Listen polling listener usage.
|
317
|
-
|
318
|
-
```bash
|
319
|
-
$ bundle exec guard start -p
|
320
|
-
$ bundle exec guard start --force-polling
|
321
|
-
```
|
322
|
-
|
323
|
-
#### `-y`/`--wait-for-delay` option
|
324
|
-
|
325
|
-
Overwrite Listen's default wait_for_delay, useful for kate-like editors through
|
326
|
-
ssh access or when guard is annoyingly running tasks multiple times.
|
327
|
-
|
328
|
-
```bash
|
329
|
-
$ bundle exec guard start -y 1
|
330
|
-
$ bundle exec guard start --wait-for-delay 1
|
331
|
-
```
|
332
|
-
|
333
|
-
#### `-o`/`--listen-on` option
|
334
|
-
|
335
|
-
Use Listen's network functionality to receive file change events from the network. This is most useful for virtual machines (e.g. Vagrant) which have problems firing native filesystem events on the guest OS.
|
336
|
-
|
337
|
-
##### Suggested use:
|
338
|
-
|
339
|
-
On the host OS, you need to listen to filesystem events and forward them to your VM using the `listen` script:
|
340
|
-
|
341
|
-
```bash
|
342
|
-
$ listen -f 127.0.0.1:4000
|
343
|
-
```
|
344
|
-
|
345
|
-
Remember to configure your VM to forward the appropriate ports, e.g. in Vagrantfile:
|
346
|
-
|
347
|
-
```ruby
|
348
|
-
config.vm.network :forwarded_port, guest: 4000, host: 4000
|
349
|
-
```
|
350
|
-
|
351
|
-
Then, on your guest OS, listen to the network events but ensure you specify the *host* path
|
352
|
-
|
353
|
-
```bash
|
354
|
-
$ bundle exec guard -o '10.0.2.2:4000' -w '/projects/myproject'
|
355
|
-
```
|
356
|
-
|
357
|
-
### List
|
358
|
-
|
359
|
-
You can list the available plugins with the `list` task:
|
360
|
-
|
361
|
-
```bash
|
362
|
-
$ bundle exec guard list
|
363
|
-
+----------+--------------+
|
364
|
-
| Plugin | In Guardfile |
|
365
|
-
+----------+--------------+
|
366
|
-
| Compass | ✘ |
|
367
|
-
| Cucumber | ✘ |
|
368
|
-
| Jammit | ✘ |
|
369
|
-
| Ronn | ✔ |
|
370
|
-
| Rspec | ✔ |
|
371
|
-
| Spork | ✘ |
|
372
|
-
| Yard | ✘ |
|
373
|
-
+----------+--------------+
|
374
|
-
```
|
375
|
-
|
376
|
-
### Show
|
377
|
-
|
378
|
-
You can show the structure of the groups and their plugins with the `show` task:
|
379
|
-
|
380
|
-
```bash
|
381
|
-
$ bundle exec guard show
|
382
|
-
+---------+--------+-----------------+----------------------------+
|
383
|
-
| Group | Plugin | Option | Value |
|
384
|
-
+---------+--------+-----------------+----------------------------+
|
385
|
-
| Specs | Rspec | all_after_pass | true |
|
386
|
-
| | | all_on_start | true |
|
387
|
-
| | | cli | "--fail-fast --format doc" |
|
388
|
-
| | | focus_on_failed | false |
|
389
|
-
| | | keep_failed | true |
|
390
|
-
| | | run_all | {} |
|
391
|
-
| | | spec_paths | ["spec"] |
|
392
|
-
+---------+--------+-----------------+----------------------------+
|
393
|
-
| Docs | Ronn | | |
|
394
|
-
+---------+--------+-----------------+----------------------------+
|
395
|
-
```
|
396
|
-
|
397
|
-
This shows the internal structure of the evaluated `Guardfile` or `.Guardfile`, with the `.guard.rb` file. You can
|
398
|
-
read more about these files in the [shared configuration section](https://github.com/guard/guard/wiki/Shared-configurations).
|
399
|
-
|
400
|
-
### Notifiers
|
401
|
-
|
402
|
-
You can show the notifiers, their availablity and options with the `notifier` task:
|
403
|
-
|
404
|
-
```bash
|
405
|
-
$ bundle exec guard notifiers
|
406
|
-
+-------------------+-----------+------+------------------------+-------------------+
|
407
|
-
| Name | Available | Used | Option | Value |
|
408
|
-
+-------------------+-----------+------+------------------------+-------------------+
|
409
|
-
| gntp | ✔ | ✘ | sticky | false |
|
410
|
-
+-------------------+-----------+------+------------------------+-------------------+
|
411
|
-
| growl | ✘ | ✘ | sticky | false |
|
412
|
-
| | | | priority | 0 |
|
413
|
-
+-------------------+-----------+------+------------------------+-------------------+
|
414
|
-
```
|
415
|
-
|
416
|
-
This shows if a notifier is available on the current system, if it's being used and the
|
417
|
-
current options (which reflects your custom options merged into the default options).
|
136
|
+
Please look here to see all the [command line options for Guard](https://github.com/guard/guard/wiki/Command-line-options-for-Guard)
|
418
137
|
|
419
138
|
Interactions
|
420
139
|
------------
|
140
|
+
Please read how to [interact with Guard](https://github.com/guard/guard/wiki/Interacting-with-Guard) on the console and which [signals](https://github.com/guard/guard/wiki/Interacting-with-Guard#guard-signals) Guard accepts
|
421
141
|
|
422
|
-
Guard shows a [Pry](http://pryrepl.org/) console whenever it has nothing to do and comes with some Guard specific Pry
|
423
|
-
commands:
|
424
|
-
|
425
|
-
* `↩`, `a`, `all`: Run all plugins.
|
426
|
-
* `h`, `help`: Show help for all interactor commands.
|
427
|
-
* `c`, `change`: Trigger a file change.
|
428
|
-
* `n`, `notification`: Toggles the notifications.
|
429
|
-
* `p`, `pause`: Toggles the file listener.
|
430
|
-
* `r`, `reload`: Reload all plugins.
|
431
|
-
* `o`, `scope`: Scope Guard actions to plugins or groups.
|
432
|
-
* `s`, `show`: Show all Guard plugins.
|
433
|
-
* `e`, `exit`: Stop all plugins and quit Guard
|
434
|
-
|
435
|
-
The `all` and `reload` commands supports an optional scope, so you limit the Guard action to either a Guard plugin or
|
436
|
-
a Guard group like:
|
437
|
-
|
438
|
-
```bash
|
439
|
-
[1] guard(main)> all rspec
|
440
|
-
[2] guard(main)> all frontend
|
441
|
-
```
|
442
|
-
|
443
|
-
Remember, you can always use `help` on the Pry command line to see all available commands and `help <command>` for
|
444
|
-
more detailed information. `help guard` will show all Guard related commands available
|
445
|
-
|
446
|
-
Pry supports the Ruby built-in Readline, [rb-readline](https://github.com/luislavena/rb-readline) and
|
447
|
-
[Coolline](https://github.com/Mon-Ouie/coolline). Just install the readline implementation of your choice by adding it
|
448
|
-
to your `Gemfile`.
|
449
|
-
|
450
|
-
You can also disable the interactions completely by running Guard with the `--no-interactions` option.
|
451
|
-
|
452
|
-
### Customizations
|
453
|
-
|
454
|
-
Further Guard specific customizations can be made in `~/.guardrc` that will be evaluated prior the Pry session is
|
455
|
-
started (`~/.pryrc` is ignored). This allows you to make use of the Pry plugin architecture to provide custom commands
|
456
|
-
and extend Guard for your own needs and distribute as a gem. Please have a look at the
|
457
|
-
[Pry Wiki](https://github.com/pry/pry/wiki) for more information.
|
458
|
-
|
459
|
-
### Signals
|
460
|
-
|
461
|
-
You can also interact with Guard by sending POSIX signals to the Guard process (all but Windows and JRuby).
|
462
|
-
|
463
|
-
If the Pry interactor is used, then `Ctrl-C` is delegated to Pry to exit continuation and `Ctrl-D` to exit Guard.
|
464
|
-
Without interactor, `Ctrl-C` exits Guard and `Ctrl-D` is ignored.
|
465
|
-
|
466
|
-
#### Pause watching
|
467
|
-
|
468
|
-
```bash
|
469
|
-
$ kill -USR1 <guard_pid>
|
470
|
-
```
|
471
|
-
|
472
|
-
#### Continue watching
|
473
|
-
|
474
|
-
```bash
|
475
|
-
$ kill -USR2 <guard_pid>
|
476
|
-
```
|
477
142
|
|
478
143
|
Guardfile DSL
|
479
144
|
-------------
|
480
|
-
|
481
|
-
The Guardfile DSL is evaluated as plain Ruby, so you can use normal Ruby code in your `Guardfile`.
|
482
|
-
Guard itself provides the following DSL methods that can be used for configuration:
|
483
|
-
|
484
|
-
### guard
|
485
|
-
|
486
|
-
The `guard` method allows you to add a Guard plugin to your toolchain and configure it by passing the
|
487
|
-
options after the name of the plugin:
|
488
|
-
|
489
|
-
```ruby
|
490
|
-
guard :coffeescript, input: 'coffeescripts', output: 'javascripts'
|
491
|
-
```
|
492
|
-
|
493
|
-
You can define the same plugin more than once:
|
494
|
-
|
495
|
-
```ruby
|
496
|
-
guard :coffeescript, input: 'coffeescripts', output: 'javascripts'
|
497
|
-
guard :coffeescript, input: 'specs', output: 'specs'
|
498
|
-
```
|
499
|
-
|
500
|
-
### watch
|
501
|
-
|
502
|
-
The `watch` method allows you to define which files are watched by a Guard:
|
503
|
-
|
504
|
-
```ruby
|
505
|
-
guard :bundler do
|
506
|
-
watch('Gemfile')
|
507
|
-
end
|
508
|
-
```
|
509
|
-
|
510
|
-
String watch patterns are matched with [String#==](http://www.ruby-doc.org/core-1.9.3/String.html#method-i-3D-3D).
|
511
|
-
You can also pass a regular expression to the watch method:
|
512
|
-
|
513
|
-
```ruby
|
514
|
-
guard :jessie do
|
515
|
-
watch(%r{^spec/.+(_spec|Spec)\.(js|coffee)})
|
516
|
-
end
|
517
|
-
```
|
518
|
-
|
519
|
-
This instructs the jessie plugin to watch for file changes in the `spec` folder,
|
520
|
-
but only for file names that ends with `_spec` or `Spec` and have a file type of `js` or `coffee`.
|
521
|
-
|
522
|
-
You can easily test your watcher regular expressions with [Rubular](http://rubular.com/).
|
523
|
-
|
524
|
-
When you add a block to the watch expression, you can modify the file name that has been
|
525
|
-
detected before sending it to the plugin for processing:
|
526
|
-
|
527
|
-
```ruby
|
528
|
-
guard :rspec do
|
529
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
530
|
-
end
|
531
|
-
```
|
532
|
-
|
533
|
-
In this example the regular expression capture group `(.+)` is used to transform a file change
|
534
|
-
in the `lib` folder to its test case in the `spec` folder. Regular expression watch patterns
|
535
|
-
are matched with [Regexp#match](http://www.ruby-doc.org/core-1.9.3/Regexp.html#method-i-match).
|
536
|
-
|
537
|
-
You can also launch any arbitrary command in the supplied block:
|
538
|
-
|
539
|
-
```ruby
|
540
|
-
guard :shell do
|
541
|
-
watch(/.*/) { `git status` }
|
542
|
-
end
|
543
|
-
```
|
544
|
-
|
545
|
-
*NOTE: Normally, most plugins expect the block to return a path or array of
|
546
|
-
paths - i.e. other plugins would think the `git status` output here is a
|
547
|
-
file path (which would cause an error), so this trick of returning the command
|
548
|
-
output only works for `guard-shell` plugin and other plugins that support
|
549
|
-
arbitrary results.*
|
550
|
-
|
551
|
-
You can also define `watch`es outside of a `guard` plugin. This is useful to
|
552
|
-
perform arbitrary Ruby logic (i.e. something project-specific).
|
553
|
-
|
554
|
-
```ruby
|
555
|
-
watch(/.*/) { |m| puts "#{m[0]} changed." }
|
556
|
-
```
|
557
|
-
|
558
|
-
### group
|
559
|
-
|
560
|
-
The `group` method allows you to group several plugins together. This comes in handy especially when you
|
561
|
-
have a huge `Guardfile` and want to focus your development on a certain part.
|
562
|
-
|
563
|
-
```ruby
|
564
|
-
group :specs do
|
565
|
-
guard :rspec do
|
566
|
-
watch(%r{^spec/.+_spec\.rb$})
|
567
|
-
end
|
568
|
-
end
|
569
|
-
|
570
|
-
group :docs do
|
571
|
-
guard :ronn do
|
572
|
-
watch(%r{^man/.+\.ronn?$})
|
573
|
-
end
|
574
|
-
end
|
575
|
-
```
|
576
|
-
|
577
|
-
Groups can be nested, reopened and can take multiple names to assign its plugin to multiple groups:
|
578
|
-
|
579
|
-
```ruby
|
580
|
-
group :desktop do
|
581
|
-
guard 'livereload' do
|
582
|
-
watch(%r{desktop/.+\.html})
|
583
|
-
end
|
584
|
-
|
585
|
-
group :mobile do
|
586
|
-
guard 'livereload' do
|
587
|
-
watch(%r{mobile/.+\.html})
|
588
|
-
end
|
589
|
-
end
|
590
|
-
end
|
591
|
-
|
592
|
-
group :mobile, :desktop do
|
593
|
-
guard 'livereload' do
|
594
|
-
watch(%r{both/.+\.html})
|
595
|
-
end
|
596
|
-
end
|
597
|
-
```
|
598
|
-
|
599
|
-
Groups to be run can be specified with the Guard DSL option `--group` (or `-g`):
|
600
|
-
|
601
|
-
```bash
|
602
|
-
$ bundle exec guard -g specs
|
603
|
-
```
|
604
|
-
|
605
|
-
Plugins that don't belong to a group are part of the `default` group.
|
606
|
-
|
607
|
-
Another neat use of groups is to group dependent plugins and stop processing if one fails. In order
|
608
|
-
to make this work, the group needs to have the `halt_on_fail` option enabled and the Guard plugin
|
609
|
-
needs to throw `:task_has_failed` to indicate that the action was not successful.
|
610
|
-
|
611
|
-
```ruby
|
612
|
-
group :specs, halt_on_fail: true do
|
613
|
-
guard :rspec do
|
614
|
-
watch(/.../)
|
615
|
-
end
|
616
|
-
|
617
|
-
guard :cucumber do
|
618
|
-
watch(/.../)
|
619
|
-
end
|
620
|
-
end
|
621
|
-
```
|
622
|
-
|
623
|
-
### scope
|
624
|
-
|
625
|
-
The `scope` method allows you to define the default plugin or group scope for Guard, if not
|
626
|
-
specified as command line option. Thus command line group and plugin scope takes precedence over
|
627
|
-
the DSL scope configuration.
|
628
|
-
|
629
|
-
You can define either a single plugin or group:
|
630
|
-
|
631
|
-
```ruby
|
632
|
-
scope plugin: :rspec
|
633
|
-
scope group: :docs
|
634
|
-
```
|
635
|
-
|
636
|
-
or specify multiple plugins or groups.
|
637
|
-
|
638
|
-
```ruby
|
639
|
-
scope plugins: [:test, :jasmine]
|
640
|
-
scope groups: [:docs, :frontend]
|
641
|
-
```
|
642
|
-
|
643
|
-
If you define both the plugin and group scope, the plugin scope has precedence. If you use both the
|
644
|
-
plural and the singular option, the plural has precedence.
|
645
|
-
|
646
|
-
**Please be sure to call the `scope` method after you've declared your Guard plugins!**
|
647
|
-
|
648
|
-
### directories
|
649
|
-
|
650
|
-
This option limits the directories watch to those given, which can improve
|
651
|
-
responsiveness, performance and help reduce resource usage (CPU, memory) on
|
652
|
-
larger projects.
|
653
|
-
|
654
|
-
```ruby
|
655
|
-
directories %w(app config lib spec features)
|
656
|
-
```
|
657
|
-
|
658
|
-
Note: The `--watchdir` option overrides this. (see `--watchdir` above for extra
|
659
|
-
info).
|
660
|
-
|
661
|
-
Note: Since recursion cannot be diabled on OSX, all other backends were made
|
662
|
-
recursive - so if you want to watch selected directories AND files in the root
|
663
|
-
directory of your project, move them to another directory and create symlinks
|
664
|
-
back, e.g.
|
665
|
-
|
666
|
-
```
|
667
|
-
mkdir config
|
668
|
-
mv Gemfile config
|
669
|
-
ln -s config/Gemfile Gemfile
|
670
|
-
```
|
671
|
-
|
672
|
-
### clearing
|
673
|
-
|
674
|
-
Guard can clear the screen before every action (which some people prefer).
|
675
|
-
|
676
|
-
The this clearing behavior can be set to `:on` or `:off`:
|
677
|
-
|
678
|
-
```ruby
|
679
|
-
clearing :on
|
680
|
-
```
|
681
|
-
|
682
|
-
### notification
|
683
|
-
|
684
|
-
If you don't specify any notification configuration in your `Guardfile`, Guard goes through the list of available
|
685
|
-
notifiers and enables all that are available. If you specify your preferred library, auto detection will not take
|
686
|
-
place:
|
687
|
-
|
688
|
-
```ruby
|
689
|
-
notification :growl
|
690
|
-
```
|
691
|
-
|
692
|
-
will select the `growl` gem for notifications. You can also set options for a notifier:
|
693
|
-
|
694
|
-
```ruby
|
695
|
-
notification :growl, sticky: true
|
696
|
-
```
|
697
|
-
|
698
|
-
Each notifier has a slightly different set of supported options:
|
699
|
-
|
700
|
-
```ruby
|
701
|
-
notification :growl, sticky: true, host: '192.168.1.5', password: 'secret'
|
702
|
-
notification :gntp, sticky: true, host: '192.168.1.5', password: 'secret'
|
703
|
-
notification :libnotify, timeout: 5, transient: true, append: false, urgency: :critical
|
704
|
-
notification :notifu, time: 5, nosound: true, xp: true
|
705
|
-
notification :emacs
|
706
|
-
```
|
707
|
-
|
708
|
-
It's possible to use more than one notifier. This allows you to configure different notifiers for different OS if your
|
709
|
-
project is developed cross-platform or if you like to have local and remote notifications.
|
710
|
-
|
711
|
-
Notifications can also be turned off in the `Guardfile`, in addition to setting the environment variable `GUARD_NOTIFY`
|
712
|
-
or using the cli switch `-n`:
|
713
|
-
|
714
|
-
```ruby
|
715
|
-
notification :off
|
716
|
-
```
|
717
|
-
|
718
|
-
### interactor
|
719
|
-
|
720
|
-
You can customize the Pry interactor history and RC file like:
|
721
|
-
|
722
|
-
```ruby
|
723
|
-
interactor guard_rc: '~/.my_guard-rc', history_file: '~/.my_guard_history_file'
|
724
|
-
```
|
725
|
-
|
726
|
-
If you do not need the Pry interactions with Guard at all, you can turn it off:
|
727
|
-
|
728
|
-
```ruby
|
729
|
-
interactor :off
|
730
|
-
```
|
731
|
-
|
732
|
-
### callback
|
733
|
-
|
734
|
-
The `callback` method allows you to execute arbitrary code before or after any of the `start`, `stop`, `reload`,
|
735
|
-
`run_all`, `run_on_changes`, `run_on_additions`, `run_on_modifications` and `run_on_removals` Guard plugins method.
|
736
|
-
You can even insert more hooks inside these methods.
|
737
|
-
|
738
|
-
```ruby
|
739
|
-
guard :rspec do
|
740
|
-
watch(%r{^spec/.+_spec\.rb$})
|
741
|
-
|
742
|
-
callback(:start_begin) { `mate .` }
|
743
|
-
end
|
744
|
-
```
|
745
|
-
|
746
|
-
Please see the [hooks and callbacks](https://github.com/guard/guard/wiki/Hooks-and-callbacks) page in the Guard wiki for
|
747
|
-
more details.
|
748
|
-
|
749
|
-
### ignore
|
750
|
-
|
751
|
-
The `ignore` method can be used to exclude files and directories from the set of files being watched. Let's say you have
|
752
|
-
used the `watch` method to monitor a directory, but you are not interested in changes happening to images, you could use
|
753
|
-
the ignore method to exclude them.
|
754
|
-
|
755
|
-
This comes in handy when you have large amounts of non-source data in you project. By default
|
756
|
-
[`.rbx`, `.bundle`, `.DS_Store`, `.git`, `.hg` ,`.svn`, `bundle`, `log`, `tmp`, `vendor/bundle`](https://github.com/guard/listen/blob/master/lib/listen/silencer.rb#L5-L9)
|
757
|
-
are ignored.
|
758
|
-
|
759
|
-
*NOTE: this option mostly helps when irrelevant changes are triggering guard tasks (e.g. a task starts before the editor finished saving all the files). Also, while it can reduce CPU time and increase responsiveness when using polling, instead, using `--watchdirs` is recommended for such "tuning" (e.g. large projects)*
|
760
|
-
|
761
|
-
Please note that method only accept regexps. See [Listen README](https://github.com/guard/listen#ignore--ignore).
|
762
|
-
|
763
|
-
To append to the default ignored files and directories, use the `ignore` method:
|
764
|
-
|
765
|
-
```ruby
|
766
|
-
ignore %r{^ignored/path/}, /public/
|
767
|
-
```
|
768
|
-
|
769
|
-
To _replace_ any existing ignored files and directories, use the `ignore!` method:
|
770
|
-
|
771
|
-
```ruby
|
772
|
-
ignore! /data/
|
773
|
-
```
|
774
|
-
|
775
|
-
### filter
|
776
|
-
|
777
|
-
Alias of the [ignore](https://github.com/guard/guard#ignore) method.
|
778
|
-
|
779
|
-
### logger
|
780
|
-
|
781
|
-
The `logger` method allows you to customize the [Lumberjack](https://github.com/bdurand/lumberjack) log output to your
|
782
|
-
needs by specifying one or more options like:
|
783
|
-
|
784
|
-
```ruby
|
785
|
-
logger level: :warn,
|
786
|
-
template: '[:severity - :time - :progname] :message',
|
787
|
-
time_format: 'at %I:%M%p',
|
788
|
-
only: [:rspec, :jasmine, 'coffeescript'],
|
789
|
-
except: :jammit,
|
790
|
-
device: 'guard.log'
|
791
|
-
```
|
792
|
-
|
793
|
-
Log `:level` option must be either `:debug`, `:info`, `:warn` or `:error`. If Guard is started in debug mode, the log
|
794
|
-
level will be automatically set to `:debug`.
|
795
|
-
|
796
|
-
The `:template` option is a string which can have one or more of the following placeholders: `:time`, `:severity`,
|
797
|
-
`:progname`, `:pid`, `:unit_of_work_id` and `:message`. A unit of work is assigned for each action Guard performs on
|
798
|
-
multiple Guard plugin.
|
799
|
-
|
800
|
-
The `:time_format` option directives are the same as Time#strftime or can be `:milliseconds`
|
801
|
-
|
802
|
-
The `:only` and `:except` are either a string or a symbol, or an array of strings or symbols that matches the name of
|
803
|
-
the Guard plugin name that sends the log message. They cannot be specified at the same time.
|
804
|
-
|
805
|
-
By default the logger uses `$stderr` as device, but you can override this by supplying the `:device` option and set
|
806
|
-
either an IO stream or a filename.
|
145
|
+
For details on extending your `Guardfile` look at [Guardfile examples](https://github.com/guard/guard/wiki/Guardfile-examples) or look at a list of commands [Guardfile-DSL / Configuring-Guard](https://github.com/guard/guard/wiki/Guardfile-DSL---Configuring-Guard)
|
807
146
|
|
808
147
|
Issues
|
809
148
|
------
|
@@ -72,8 +72,15 @@ module Guard
|
|
72
72
|
|
73
73
|
def guardfile_scope(scope)
|
74
74
|
opts = scope.dup
|
75
|
-
|
76
|
-
|
75
|
+
|
76
|
+
groups = Array(opts.delete(:groups))
|
77
|
+
group = Array(opts.delete(:group))
|
78
|
+
@guardfile_group_scope = Array(groups) + Array(group)
|
79
|
+
|
80
|
+
plugins = Array(opts.delete(:plugins))
|
81
|
+
plugin = Array(opts.delete(:plugin))
|
82
|
+
@guardfile_plugin_scope = Array(plugins) + Array(plugin)
|
83
|
+
|
77
84
|
fail "Unknown options: #{opts.inspect}" unless opts.empty?
|
78
85
|
end
|
79
86
|
|
@@ -7,13 +7,12 @@
|
|
7
7
|
## Uncomment to clear the screen before every task
|
8
8
|
# clearing :on
|
9
9
|
|
10
|
-
##
|
11
|
-
|
12
|
-
## Note: if you want Guard to automatically start up again, run guard in a
|
10
|
+
## Guard internally checks for changes in the Guardfile and exits.
|
11
|
+
## If you want Guard to automatically start up again, run guard in a
|
13
12
|
## shell loop, e.g.:
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
##
|
14
|
+
## $ while bundle exec guard; do echo "Restarting Guard..."; done
|
15
|
+
##
|
17
16
|
## Note: if you are using the `directories` clause above and you are not
|
18
17
|
## watching the project directory ('.'), the you will want to move the Guardfile
|
19
18
|
## to a watched dir and symlink it back, e.g.
|
@@ -23,8 +22,3 @@
|
|
23
22
|
# $ ln -s config/Guardfile .
|
24
23
|
#
|
25
24
|
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
26
|
-
#
|
27
|
-
watch ("Guardfile") do
|
28
|
-
UI.info "Exiting because Guard must be restarted for changes to take effect"
|
29
|
-
exit 0
|
30
|
-
end
|
data/lib/guard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.10.
|
4
|
+
version: 2.10.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibaud Guillaume-Gentil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
197
|
version: '0'
|
198
198
|
requirements: []
|
199
199
|
rubyforge_project:
|
200
|
-
rubygems_version: 2.
|
200
|
+
rubygems_version: 2.4.3
|
201
201
|
signing_key:
|
202
202
|
specification_version: 4
|
203
203
|
summary: Guard keeps an eye on your file modifications
|