guard 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +10 -4
- data/README.md +38 -35
- data/lib/guard.rb +35 -31
- data/lib/guard/cli.rb +13 -8
- data/lib/guard/dsl.rb +15 -13
- data/lib/guard/dsl_describer.rb +2 -2
- data/lib/guard/group.rb +2 -2
- data/lib/guard/guard.rb +36 -36
- data/lib/guard/hook.rb +2 -2
- data/lib/guard/interactor.rb +3 -3
- data/lib/guard/runner.rb +8 -9
- data/lib/guard/ui.rb +1 -1
- data/lib/guard/version.rb +1 -1
- data/lib/guard/version.rbc +9 -63
- data/lib/guard/watcher.rb +5 -5
- data/man/guard.1 +17 -8
- data/man/guard.1.html +18 -9
- metadata +3 -51
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## Master
|
2
2
|
|
3
|
+
### 1.2.2 - 2 Juli, 2012
|
4
|
+
|
5
|
+
### Bug fix
|
6
|
+
|
7
|
+
- [#298][] Deprecations must be explicit enabled. ([@netzpirat][])
|
8
|
+
|
3
9
|
### 1.2.1 - 20 June, 2012
|
4
10
|
|
5
11
|
### Bug fix
|
@@ -31,7 +37,7 @@
|
|
31
37
|
- New `--force-polling`/`-p` option to force usage of the Listen polling listener.
|
32
38
|
- `--watch-all-modifications`/`-A` option is removed and is now always on.
|
33
39
|
- `--no-vendor`/`-I` option is removed because the monitoring gems are now part of the [Listen gem](https://github.com/guard/listen). You can specify a custom version of any monitoring gem directly in your Gemfile if you want to overwrite Listen's default monitoring gems.
|
34
|
-
-
|
40
|
+
- Guard plugins must now implement `run_on_additions`, `run_on_modifications`, `run_on_removals` and / or `run_on_changes`. The `run_on_change` and `run_on_deletion` methods are deprecated and should be removed as soon as possible. See the [Upgrade guide for existing guards to Guard v1.1](https://github.com/guard/guard/wiki/Upgrade-guide-for-existing-guards-to-Guard-v1.1) for more info.
|
35
41
|
|
36
42
|
The Listen integration has been supervised by [@thibaudgg][] and executed by [@Maher4Ever][], [@rymai][] and [@thibaudgg][].
|
37
43
|
|
@@ -219,7 +225,7 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
|
|
219
225
|
|
220
226
|
- [#136][] New CLI `:watch_all_modifications`/`-A` option to watch for deleted and moved files too. ([@limeyd][] and [@netzpirat][])
|
221
227
|
- [#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][])
|
222
|
-
- [#121][] `Guard.guards` and `Guard.groups` are now smart accessors. Filters can be passed to find a specific Guard/group or several
|
228
|
+
- [#121][] `Guard.guards` and `Guard.groups` are now smart accessors. Filters can be passed to find a specific Guard/group or several Guard plugins/groups that match (see YARDoc). ([@rymai][] and [@ches][])
|
223
229
|
- New `Guard::Group` class to store groups defined in Guardfile (with `Guard::Dsl#group`). ([@rymai][])
|
224
230
|
|
225
231
|
### Improvements
|
@@ -262,7 +268,7 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
|
|
262
268
|
### New features
|
263
269
|
|
264
270
|
- Groups are now stored in a `groups` instance variable (will be used for future features). ([@rymai][])
|
265
|
-
-
|
271
|
+
- Guard plugins will now receive their group in the options hash at initialization (will be used for future features). ([@rymai][])
|
266
272
|
|
267
273
|
### Improvement
|
268
274
|
|
@@ -308,7 +314,7 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
|
|
308
314
|
### New features
|
309
315
|
|
310
316
|
- Guard::Ego is now part of Guard, so Guardfile is automagically re-evaluated when modified. ([@thibaudgg][])
|
311
|
-
- [#91][] Show
|
317
|
+
- [#91][] Show Guard plugins in Guardfile with the `guard -T`. ([@johnbintz][])
|
312
318
|
|
313
319
|
### Improvements
|
314
320
|
|
data/README.md
CHANGED
@@ -7,6 +7,9 @@ This document contains a lot of information, please take your time and read thes
|
|
7
7
|
any questions, ask them in our [Google group](http://groups.google.com/group/guard-dev) or on `#guard`
|
8
8
|
(irc.freenode.net).
|
9
9
|
|
10
|
+
Information on advanced topics like create your own Guard plugin, programatic use of Guard, hooks and callbacks and
|
11
|
+
more can be found in the [Guard wiki](https://github.com/guard/guard/wiki).
|
12
|
+
|
10
13
|
Before you file an issue, make sure you have read the _[file an issue](#file-an-issue)_ section that contains some
|
11
14
|
important information.
|
12
15
|
|
@@ -15,7 +18,7 @@ Features
|
|
15
18
|
|
16
19
|
* File system changes handled by our awesome [Listen](https://github.com/guard/listen) gem.
|
17
20
|
* Support for visual system notifications.
|
18
|
-
* Huge
|
21
|
+
* Huge eco-system with [more than 130](https://rubygems.org/search?query=guard-) guard plugins.
|
19
22
|
* Tested against Ruby 1.8.7, 1.9.2, 1.9.3, REE and the latest versions of JRuby & Rubinius.
|
20
23
|
|
21
24
|
Screencast
|
@@ -168,22 +171,22 @@ group :development do
|
|
168
171
|
end
|
169
172
|
```
|
170
173
|
|
171
|
-
Add
|
172
|
-
|
174
|
+
Add Guard plugins
|
175
|
+
-----------------
|
173
176
|
|
174
|
-
Guard is now ready to use and you should add some
|
175
|
-
available by browsing the [Guard organization](https://github.com/guard) on GitHub or by searching for `guard-`
|
176
|
-
[RubyGems](https://rubygems.org/search?utf8=%E2%9C%93&query=guard-).
|
177
|
+
Guard is now ready to use and you should add some Guard plugins for your specific use. Start exploring the many Guard
|
178
|
+
plugins available by browsing the [Guard organization](https://github.com/guard) on GitHub or by searching for `guard-`
|
179
|
+
on [RubyGems](https://rubygems.org/search?utf8=%E2%9C%93&query=guard-).
|
177
180
|
|
178
|
-
When you have found a Guard of your interest, add it to your `Gemfile`:
|
181
|
+
When you have found a Guard plugin of your interest, add it to your `Gemfile`:
|
179
182
|
|
180
183
|
```ruby
|
181
184
|
group :development do
|
182
|
-
gem '<guard-name>'
|
185
|
+
gem '<guard-plugin-name>'
|
183
186
|
end
|
184
187
|
```
|
185
188
|
|
186
|
-
See the init section of the Guard usage below to see how to install the supplied
|
189
|
+
See the init section of the Guard usage below to see how to install the supplied plugin template that you can install and
|
187
190
|
to suit your needs.
|
188
191
|
|
189
192
|
Usage
|
@@ -208,14 +211,14 @@ $ guard help start
|
|
208
211
|
|
209
212
|
### Init
|
210
213
|
|
211
|
-
You can generate a Guardfile and have all installed
|
214
|
+
You can generate a Guardfile and have all installed plugins be automatically added into
|
212
215
|
it by running the `init` task without any option:
|
213
216
|
|
214
217
|
```bash
|
215
218
|
$ guard init
|
216
219
|
```
|
217
220
|
|
218
|
-
You can also specify the name of an installed
|
221
|
+
You can also specify the name of an installed plugin to only get that plugin template
|
219
222
|
in the generated Guardfile:
|
220
223
|
|
221
224
|
```bash
|
@@ -230,8 +233,7 @@ $ guard init <template-name>
|
|
230
233
|
```
|
231
234
|
|
232
235
|
**Note**: If you already have a `Guardfile` in the current directory, the `init` task can be used
|
233
|
-
to append a supplied
|
234
|
-
`Guardfile`.
|
236
|
+
to append a supplied template from an installed plugin to your existing `Guardfile`.
|
235
237
|
|
236
238
|
#### `-b`/`--bare` option
|
237
239
|
|
@@ -276,7 +278,7 @@ Notifications can also be disabled globally by setting a `GUARD_NOTIFY` environm
|
|
276
278
|
|
277
279
|
#### `-g`/`--group` option
|
278
280
|
|
279
|
-
Only certain
|
281
|
+
Only certain plugin groups can be run:
|
280
282
|
|
281
283
|
```bash
|
282
284
|
$ guard --group group_name another_group_name
|
@@ -297,7 +299,7 @@ $ guard -d # shortcut
|
|
297
299
|
|
298
300
|
#### `-w`/`--watchdir` option
|
299
301
|
|
300
|
-
Guard can watch
|
302
|
+
Guard can watch any directory instead of the current directory:
|
301
303
|
|
302
304
|
```bash
|
303
305
|
$ guard --watchdir ~/your/fancy/project
|
@@ -351,7 +353,7 @@ $ guard start --force-polling
|
|
351
353
|
|
352
354
|
### List
|
353
355
|
|
354
|
-
You can list the available
|
356
|
+
You can list the available plugins with the `list` task:
|
355
357
|
|
356
358
|
```bash
|
357
359
|
$ guard list
|
@@ -371,7 +373,7 @@ See also https://github.com/guard/guard/wiki/List-of-available-Guards
|
|
371
373
|
|
372
374
|
### Show
|
373
375
|
|
374
|
-
You can show the structure of the groups and their
|
376
|
+
You can show the structure of the groups and their plugins with the `show` task:
|
375
377
|
|
376
378
|
```bash
|
377
379
|
$ guard show
|
@@ -394,41 +396,41 @@ Interactions
|
|
394
396
|
|
395
397
|
You can interact with Guard and enter commands when Guard has nothing to do. Guard understands the following commands:
|
396
398
|
|
397
|
-
* `↩`: Run all
|
399
|
+
* `↩`: Run all plugins.
|
398
400
|
* `h`, `help`: Show a help of the available interactor commands.
|
399
|
-
* `r`, `reload`: Reload all
|
401
|
+
* `r`, `reload`: Reload all plugins.
|
400
402
|
* `c`, `change`: Show a help of the available interactor commands.
|
401
|
-
* `s`, `show`: Show
|
403
|
+
* `s`, `show`: Show the plugin configurations.
|
402
404
|
* `n`, `notification`: Toggle system notifications on and off.
|
403
405
|
* `p`, `pause`: Toggles the file modification listener. The prompt will change to `p>` when paused.
|
404
406
|
This is useful when switching Git branches, rebase Git or change whitespace.
|
405
|
-
* `e`, `exit`: Stop all
|
407
|
+
* `e`, `exit`: Stop all plugins and quit Guard.
|
406
408
|
|
407
|
-
Instead of running all
|
409
|
+
Instead of running all plugins with the `↩` key, you can also run a single plugin by entering its name:
|
408
410
|
|
409
411
|
```bash
|
410
412
|
> rspec
|
411
413
|
```
|
412
414
|
|
413
|
-
It's also possible to run all
|
415
|
+
It's also possible to run all plugins within a group by entering the group name:
|
414
416
|
|
415
417
|
```bash
|
416
418
|
> frontend
|
417
419
|
```
|
418
420
|
|
419
|
-
The same applies to
|
421
|
+
The same applies to reloading. You can reload a plugin with the following command:
|
420
422
|
|
421
423
|
```bash
|
422
424
|
> ronn reload
|
423
425
|
```
|
424
426
|
|
425
|
-
This will reload only the Ronn
|
427
|
+
This will reload only the Ronn plugin. You can also reload all plugins within a group:
|
426
428
|
|
427
429
|
```bash
|
428
430
|
> backend reload
|
429
431
|
```
|
430
432
|
|
431
|
-
The action and plugin
|
433
|
+
The action and plugin/group name can have any order, so you can also write:
|
432
434
|
|
433
435
|
```bash
|
434
436
|
> reload backend
|
@@ -493,14 +495,14 @@ Guard itself provides the following DSL methods that can be used for configurati
|
|
493
495
|
|
494
496
|
### guard
|
495
497
|
|
496
|
-
The `guard` method allows you to add a Guard to your toolchain and configure it by passing the
|
497
|
-
options after the name of the
|
498
|
+
The `guard` method allows you to add a Guard plugin to your toolchain and configure it by passing the
|
499
|
+
options after the name of the plugin:
|
498
500
|
|
499
501
|
```ruby
|
500
502
|
guard :coffeescript, :input => 'coffeescripts', :output => 'javascripts'
|
501
503
|
```
|
502
504
|
|
503
|
-
You can define the same
|
505
|
+
You can define the same plugin more than once:
|
504
506
|
|
505
507
|
```ruby
|
506
508
|
guard :coffeescript, :input => 'coffeescripts', :output => 'javascripts'
|
@@ -526,13 +528,13 @@ guard :jessie do
|
|
526
528
|
end
|
527
529
|
```
|
528
530
|
|
529
|
-
This instructs the jessie
|
531
|
+
This instructs the jessie plugin to watch for file changes in the `spec` folder,
|
530
532
|
but only for file names that ends with `_spec` or `Spec` and have a file type of `js` or `coffee`.
|
531
533
|
|
532
534
|
You can easily test your watcher regular expressions with [Rubular](http://rubular.com/).
|
533
535
|
|
534
536
|
When you add a block to the watch expression, you can modify the file name that has been
|
535
|
-
detected before sending it to the
|
537
|
+
detected before sending it to the plugin for processing:
|
536
538
|
|
537
539
|
```ruby
|
538
540
|
guard :rspec do
|
@@ -554,7 +556,7 @@ end
|
|
554
556
|
|
555
557
|
### group
|
556
558
|
|
557
|
-
The `group` method allows you to group several
|
559
|
+
The `group` method allows you to group several plugins together. This comes in handy especially when you
|
558
560
|
have a huge `Guardfile` and want to focus your development on a certain part.
|
559
561
|
|
560
562
|
```ruby
|
@@ -577,7 +579,7 @@ Groups to be run can be specified with the Guard DSL option `--group` (or `-g`):
|
|
577
579
|
$ guard -g specs
|
578
580
|
```
|
579
581
|
|
580
|
-
|
582
|
+
Guard plugins that don't belong to a group are considered global and are always run.
|
581
583
|
|
582
584
|
### notification
|
583
585
|
|
@@ -634,7 +636,8 @@ interactor :off
|
|
634
636
|
### callback
|
635
637
|
|
636
638
|
The `callback` method allows you to execute arbitrary code before or after any of the `start`, `stop`, `reload`,
|
637
|
-
`run_all`
|
639
|
+
`run_all`, `run_on_changes`, `run_on_additions`, `run_on_modifications` and `run_on_removals` Guard plugins method.
|
640
|
+
You can even insert more hooks inside these methods.
|
638
641
|
|
639
642
|
```ruby
|
640
643
|
guard :rspec do
|
@@ -725,7 +728,7 @@ You can report bugs and feature requests to [GitHub Issues](https://github.com/g
|
|
725
728
|
**Please don't ask question in the issue tracker**, instead ask them in our
|
726
729
|
[Google group](http://groups.google.com/group/guard-dev) or on `#guard` (irc.freenode.net).
|
727
730
|
|
728
|
-
Try to figure out where the issue belongs to: Is it an issue with Guard itself or with a Guard
|
731
|
+
Try to figure out where the issue belongs to: Is it an issue with Guard itself or with a Guard plugin you're
|
729
732
|
using?
|
730
733
|
|
731
734
|
When you file a bug, please try to follow these simple rules if applicable:
|
data/lib/guard.rb
CHANGED
@@ -2,7 +2,7 @@ require 'thread'
|
|
2
2
|
require 'listen'
|
3
3
|
|
4
4
|
# Guard is the main module for all Guard related modules and classes.
|
5
|
-
# Also
|
5
|
+
# Also Guard plugins should use this namespace.
|
6
6
|
#
|
7
7
|
module Guard
|
8
8
|
|
@@ -45,6 +45,7 @@ module Guard
|
|
45
45
|
@options = options
|
46
46
|
@watchdir = (options[:watchdir] && File.expand_path(options[:watchdir])) || Dir.pwd
|
47
47
|
@runner = Runner.new
|
48
|
+
@allow_stop = Listen::Turnstile.new
|
48
49
|
|
49
50
|
UI.clear
|
50
51
|
deprecated_options_warning
|
@@ -59,7 +60,7 @@ module Guard
|
|
59
60
|
Dsl.evaluate_guardfile(options)
|
60
61
|
UI.error 'No guards found in Guardfile, please add at least one.' if @guards.empty?
|
61
62
|
|
62
|
-
runner.deprecation_warning
|
63
|
+
runner.deprecation_warning if @options[:show_deprecations]
|
63
64
|
|
64
65
|
setup_notifier
|
65
66
|
setup_interactor
|
@@ -104,7 +105,7 @@ module Guard
|
|
104
105
|
def setup_listener
|
105
106
|
listener_callback = lambda do |modified, added, removed|
|
106
107
|
Dsl.reevaluate_guardfile if Watcher.match_guardfile?(modified)
|
107
|
-
|
108
|
+
|
108
109
|
::Guard.within_preserved_state do
|
109
110
|
runner.run_on_changes(modified, added, removed)
|
110
111
|
end
|
@@ -132,14 +133,14 @@ module Guard
|
|
132
133
|
end
|
133
134
|
end
|
134
135
|
|
135
|
-
# Start Guard by evaluate the `Guardfile`, initialize the declared
|
136
|
+
# Start Guard by evaluate the `Guardfile`, initialize the declared Guard plugins
|
136
137
|
# and start the available file change listener.
|
137
|
-
# Main method for Guard that is called from the CLI when
|
138
|
+
# Main method for Guard that is called from the CLI when Guard starts.
|
138
139
|
#
|
139
140
|
# - Setup Guard internals
|
140
141
|
# - Evaluate the `Guardfile`
|
141
142
|
# - Configure Notifiers
|
142
|
-
# - Initialize the declared
|
143
|
+
# - Initialize the declared Guard plugins
|
143
144
|
# - Start the available file change listener
|
144
145
|
#
|
145
146
|
# @option options [Boolean] clear if auto clear the UI should be done
|
@@ -156,23 +157,26 @@ module Guard
|
|
156
157
|
within_preserved_state do
|
157
158
|
runner.run(:start)
|
158
159
|
end
|
159
|
-
|
160
|
-
listener.start
|
160
|
+
|
161
|
+
listener.start(false)
|
162
|
+
|
163
|
+
@allow_stop.wait if @allow_stop
|
161
164
|
end
|
162
165
|
|
163
166
|
# Stop Guard listening to file changes
|
164
167
|
#
|
165
168
|
def stop
|
169
|
+
listener.stop
|
166
170
|
interactor.stop if interactor
|
167
171
|
runner.run(:stop)
|
168
172
|
UI.info 'Bye bye...', :reset => true
|
169
|
-
|
170
|
-
|
173
|
+
|
174
|
+
@allow_stop.signal if @allow_stop
|
171
175
|
end
|
172
176
|
|
173
|
-
# Reload Guardfile and all
|
177
|
+
# Reload Guardfile and all Guard plugins currently enabled.
|
174
178
|
#
|
175
|
-
# @param [Hash] scopes an hash with a
|
179
|
+
# @param [Hash] scopes an hash with a Guard plugin or a group scope
|
176
180
|
#
|
177
181
|
def reload(scopes)
|
178
182
|
within_preserved_state do
|
@@ -183,9 +187,9 @@ module Guard
|
|
183
187
|
end
|
184
188
|
end
|
185
189
|
|
186
|
-
# Trigger `run_all` on all
|
190
|
+
# Trigger `run_all` on all Guard plugins currently enabled.
|
187
191
|
#
|
188
|
-
# @param [Hash] scopes an hash with a
|
192
|
+
# @param [Hash] scopes an hash with a Guard plugin or a group scope
|
189
193
|
#
|
190
194
|
def run_all(scopes)
|
191
195
|
within_preserved_state do
|
@@ -207,22 +211,22 @@ module Guard
|
|
207
211
|
end
|
208
212
|
end
|
209
213
|
|
210
|
-
# Smart accessor for retrieving a specific
|
214
|
+
# Smart accessor for retrieving a specific Guard plugin or several Guard plugins at once.
|
211
215
|
#
|
212
216
|
# @see Guard.groups
|
213
217
|
#
|
214
|
-
# @example Filter
|
218
|
+
# @example Filter Guard plugins by String or Symbol
|
215
219
|
# Guard.guards('rspec')
|
216
220
|
# Guard.guards(:rspec)
|
217
221
|
#
|
218
|
-
# @example Filter
|
222
|
+
# @example Filter Guard plugins by Regexp
|
219
223
|
# Guard.guards(/rsp.+/)
|
220
224
|
#
|
221
|
-
# @example Filter
|
225
|
+
# @example Filter Guard plugins by Hash
|
222
226
|
# Guard.guards({ :name => 'rspec', :group => 'backend' })
|
223
227
|
#
|
224
|
-
# @param [String, Symbol, Regexp, Hash] filter the filter to apply to the
|
225
|
-
# @return [Array<Guard>] the filtered
|
228
|
+
# @param [String, Symbol, Regexp, Hash] filter the filter to apply to the Guard plugins
|
229
|
+
# @return [Array<Guard>] the filtered Guard plugins
|
226
230
|
#
|
227
231
|
def guards(filter = nil)
|
228
232
|
@guards ||= []
|
@@ -245,7 +249,7 @@ module Guard
|
|
245
249
|
end
|
246
250
|
end
|
247
251
|
|
248
|
-
# Smart accessor for retrieving a specific group or several groups at once.
|
252
|
+
# Smart accessor for retrieving a specific plugin group or several plugin groups at once.
|
249
253
|
#
|
250
254
|
# @see Guard.guards
|
251
255
|
#
|
@@ -270,13 +274,13 @@ module Guard
|
|
270
274
|
end
|
271
275
|
end
|
272
276
|
|
273
|
-
# Add a Guard to use.
|
277
|
+
# Add a Guard plugin to use.
|
274
278
|
#
|
275
279
|
# @param [String] name the Guard name
|
276
280
|
# @param [Array<Watcher>] watchers the list of declared watchers
|
277
281
|
# @param [Array<Hash>] callbacks the list of callbacks
|
278
|
-
# @param [Hash] options the
|
279
|
-
# @return [Guard::Guard] the
|
282
|
+
# @param [Hash] options the plugin options (see the given Guard documentation)
|
283
|
+
# @return [Guard::Guard] the added Guard plugin
|
280
284
|
#
|
281
285
|
def add_guard(name, watchers = [], callbacks = [], options = {})
|
282
286
|
if name.to_sym == :ego
|
@@ -290,11 +294,11 @@ module Guard
|
|
290
294
|
end
|
291
295
|
end
|
292
296
|
|
293
|
-
# Add a Guard group.
|
297
|
+
# Add a Guard plugin group.
|
294
298
|
#
|
295
299
|
# @param [String] name the group name
|
296
300
|
# @option options [Boolean] halt_on_fail if a task execution
|
297
|
-
# should be halted for all
|
301
|
+
# should be halted for all Guard plugins in this group if one Guard throws `:task_has_failed`
|
298
302
|
# @return [Guard::Group] the group added (or retrieved from the `@groups` variable if already present)
|
299
303
|
#
|
300
304
|
def add_group(name, options = {})
|
@@ -325,7 +329,7 @@ module Guard
|
|
325
329
|
@result
|
326
330
|
end
|
327
331
|
|
328
|
-
# Tries to load the Guard main class. This transforms the supplied Guard
|
332
|
+
# Tries to load the Guard plugin main class. This transforms the supplied Guard plugin
|
329
333
|
# name into a class name:
|
330
334
|
#
|
331
335
|
# * `guardname` will become `Guard::Guardname`
|
@@ -363,9 +367,9 @@ module Guard
|
|
363
367
|
end
|
364
368
|
end
|
365
369
|
|
366
|
-
# Locate a path to a Guard gem.
|
370
|
+
# Locate a path to a Guard plugin gem.
|
367
371
|
#
|
368
|
-
# @param [String] name the name of the Guard without the prefix `guard-`
|
372
|
+
# @param [String] name the name of the Guard plugin without the prefix `guard-`
|
369
373
|
# @return [String] the full path to the Guard gem
|
370
374
|
#
|
371
375
|
def locate_guard(name)
|
@@ -378,9 +382,9 @@ module Guard
|
|
378
382
|
UI.error "Could not find 'guard-#{ name }' gem path."
|
379
383
|
end
|
380
384
|
|
381
|
-
# Returns a list of
|
385
|
+
# Returns a list of Guard plugin Gem names installed locally.
|
382
386
|
#
|
383
|
-
# @return [Array<String>] a list of
|
387
|
+
# @return [Array<String>] a list of Guard plugin gem names
|
384
388
|
#
|
385
389
|
def guard_gem_names
|
386
390
|
if Gem::Version.create(Gem::VERSION) >= Gem::Version.create('1.8.0')
|
data/lib/guard/cli.rb
CHANGED
@@ -73,6 +73,11 @@ module Guard
|
|
73
73
|
:aliases => '-B',
|
74
74
|
:banner => 'Turn off warning when Bundler is not present'
|
75
75
|
|
76
|
+
method_option :show_deprecations,
|
77
|
+
:type => :boolean,
|
78
|
+
:default => false,
|
79
|
+
:banner => 'Turn on deprecation warnings'
|
80
|
+
|
76
81
|
# Listen options
|
77
82
|
method_option :latency,
|
78
83
|
:type => :numeric,
|
@@ -85,7 +90,7 @@ module Guard
|
|
85
90
|
:aliases => '-p',
|
86
91
|
:banner => 'Force usage of the Listen polling listener'
|
87
92
|
|
88
|
-
# Start Guard by initialize the defined
|
93
|
+
# Start Guard by initialize the defined Guard plugins and watch the file system.
|
89
94
|
# This is the default task, so calling `guard` is the same as calling `guard start`.
|
90
95
|
#
|
91
96
|
# @see Guard.start
|
@@ -100,7 +105,7 @@ module Guard
|
|
100
105
|
|
101
106
|
desc 'list', 'Lists guards that can be used with init'
|
102
107
|
|
103
|
-
# List the
|
108
|
+
# List the Guard plugins that are available for use in your system and marks
|
104
109
|
# those that are currently used in your `Guardfile`.
|
105
110
|
#
|
106
111
|
# @see Guard::DslDescriber.list
|
@@ -130,14 +135,14 @@ module Guard
|
|
130
135
|
:aliases => '-b',
|
131
136
|
:banner => 'Generate a bare Guardfile without adding any installed guard into it'
|
132
137
|
|
133
|
-
# Initializes the templates of all installed
|
134
|
-
# to the `Guardfile` when no Guard name is passed. When
|
135
|
-
# a
|
138
|
+
# Initializes the templates of all installed Guard pluginss and adds them
|
139
|
+
# to the `Guardfile` when no Guard name is passed. When passing
|
140
|
+
# a Guard plugin name it does the same but only for that Guard plugin.
|
136
141
|
#
|
137
142
|
# @see Guard::Guard.initialize_template
|
138
143
|
# @see Guard::Guard.initialize_all_templates
|
139
144
|
#
|
140
|
-
# @param [String] guard_name the name of the Guard to initialize
|
145
|
+
# @param [String] guard_name the name of the Guard plugin to initialize
|
141
146
|
#
|
142
147
|
def init(guard_name = nil)
|
143
148
|
verify_bundler_presence
|
@@ -153,10 +158,10 @@ module Guard
|
|
153
158
|
end
|
154
159
|
end
|
155
160
|
|
156
|
-
desc 'show', 'Show all defined
|
161
|
+
desc 'show', 'Show all defined Guard plugins and their options'
|
157
162
|
map %w(-T) => :show
|
158
163
|
|
159
|
-
# Shows all
|
164
|
+
# Shows all Guard plugins and their options that are defined in
|
160
165
|
# the `Guardfile`
|
161
166
|
#
|
162
167
|
# @see Guard::DslDescriber.show
|
data/lib/guard/dsl.rb
CHANGED
@@ -4,9 +4,9 @@ module Guard
|
|
4
4
|
# the behaviour of Guard.
|
5
5
|
#
|
6
6
|
# The main keywords of the DSL are `guard` and `watch`. These are necessary to define
|
7
|
-
# the used
|
7
|
+
# the used Guard plugins and the file changes they are watching.
|
8
8
|
#
|
9
|
-
# You can optionally group the
|
9
|
+
# You can optionally group the Guard plugins with the `group` keyword and ignore and filter certain paths
|
10
10
|
# with the `ignore` and `filter` keywords.
|
11
11
|
#
|
12
12
|
# You can set your preferred system notification library with `notification` and pass
|
@@ -15,8 +15,9 @@ module Guard
|
|
15
15
|
# specify `:off` as library). @see ::Guard::Notifier for more information about the supported libraries.
|
16
16
|
#
|
17
17
|
# A more advanced DSL use is the `callback` keyword that allows you to execute arbitrary
|
18
|
-
# code before or after any of the `start`, `stop`, `reload`, `run_all
|
19
|
-
#
|
18
|
+
# code before or after any of the `start`, `stop`, `reload`, `run_all`, `run_on_changes`,
|
19
|
+
# `run_on_additions`, `run_on_modifications` and `run_on_removals` Guard plugins method.
|
20
|
+
# You can even insert more hooks inside these methods.
|
20
21
|
# Please [checkout the Wiki page](https://github.com/guard/guard/wiki/Hooks-and-callbacks) for more details.
|
21
22
|
#
|
22
23
|
# The DSL will also evaluate normal Ruby code.
|
@@ -119,7 +120,7 @@ module Guard
|
|
119
120
|
after_reevaluate_guardfile
|
120
121
|
end
|
121
122
|
|
122
|
-
# Stop
|
123
|
+
# Stop Guard and clear internal state
|
123
124
|
# before the Guardfile will be re-evaluated.
|
124
125
|
#
|
125
126
|
def before_reevaluate_guardfile
|
@@ -131,7 +132,7 @@ module Guard
|
|
131
132
|
@@options.delete(:guardfile_contents)
|
132
133
|
end
|
133
134
|
|
134
|
-
# Start
|
135
|
+
# Start Guard and notification and show a message
|
135
136
|
# after the Guardfile has been re-evaluated.
|
136
137
|
#
|
137
138
|
def after_reevaluate_guardfile
|
@@ -158,7 +159,7 @@ module Guard
|
|
158
159
|
UI.error "Invalid Guardfile, original error is:\n#{ $! }"
|
159
160
|
end
|
160
161
|
|
161
|
-
# Test if the current `Guardfile` contains a specific Guard.
|
162
|
+
# Test if the current `Guardfile` contains a specific Guard plugin.
|
162
163
|
#
|
163
164
|
# @param [String] guard_name the name of the Guard
|
164
165
|
# @return [Boolean] whether the Guard has been declared
|
@@ -206,7 +207,7 @@ module Guard
|
|
206
207
|
end
|
207
208
|
|
208
209
|
unless guardfile_contents_usable?
|
209
|
-
UI.error 'No
|
210
|
+
UI.error 'No Guard plugins found in Guardfile, please add at least one.'
|
210
211
|
end
|
211
212
|
end
|
212
213
|
|
@@ -320,9 +321,9 @@ module Guard
|
|
320
321
|
::Guard::Interactor.interactor = interactor.to_sym
|
321
322
|
end
|
322
323
|
|
323
|
-
# Declares a group of
|
324
|
+
# Declares a group of Guard plugins to be run with `guard start --group group_name`.
|
324
325
|
#
|
325
|
-
# @example Declare two groups of
|
326
|
+
# @example Declare two groups of Guard plugins
|
326
327
|
#
|
327
328
|
# group 'backend' do
|
328
329
|
# guard 'spork'
|
@@ -334,7 +335,7 @@ module Guard
|
|
334
335
|
# guard 'livereload'
|
335
336
|
# end
|
336
337
|
#
|
337
|
-
# @param [Symbol, String] name the group
|
338
|
+
# @param [Symbol, String] name the group name called from the CLI
|
338
339
|
# @param [Hash] options the options accepted by the group
|
339
340
|
# @yield a block where you can declare several guards
|
340
341
|
#
|
@@ -356,7 +357,7 @@ module Guard
|
|
356
357
|
end
|
357
358
|
end
|
358
359
|
|
359
|
-
# Declare a
|
360
|
+
# Declare a Guard plugin to be used when running `guard start`.
|
360
361
|
#
|
361
362
|
# The name parameter is usually the name of the gem without
|
362
363
|
# the 'guard-' prefix.
|
@@ -411,7 +412,8 @@ module Guard
|
|
411
412
|
end
|
412
413
|
|
413
414
|
# Define a callback to execute arbitrary code before or after any of
|
414
|
-
# the `start`, `stop`, `reload`, `run_all`
|
415
|
+
# the `start`, `stop`, `reload`, `run_all`, `run_on_changes` `run_on_additions`, `run_on_modifications`
|
416
|
+
# and `run_on_removals` plugin method.
|
415
417
|
#
|
416
418
|
# @param [Array] args the callback arguments
|
417
419
|
# @yield a block with listeners
|
data/lib/guard/dsl_describer.rb
CHANGED
@@ -27,7 +27,7 @@ module Guard
|
|
27
27
|
super options
|
28
28
|
end
|
29
29
|
|
30
|
-
# List the
|
30
|
+
# List the Guard plugins that are available for use in your system and marks
|
31
31
|
# those that are currently used in your `Guardfile`.
|
32
32
|
#
|
33
33
|
# @example Guard list output
|
@@ -63,7 +63,7 @@ module Guard
|
|
63
63
|
UI.info '* denotes ones already in your Guardfile'
|
64
64
|
end
|
65
65
|
|
66
|
-
# Shows all
|
66
|
+
# Shows all Guard plugins and their options that are defined in
|
67
67
|
# the `Guardfile`.
|
68
68
|
#
|
69
69
|
# @example guard show output
|
data/lib/guard/group.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Guard
|
2
2
|
|
3
|
-
# A group of
|
3
|
+
# A group of Guard plugins. There are two reasons why you want to group your guards:
|
4
4
|
#
|
5
5
|
# - You can start only certain Groups from the command line by passing the `--group` option.
|
6
6
|
# - Abort task execution chain on failure within a group.
|
@@ -25,7 +25,7 @@ module Guard
|
|
25
25
|
# @param [String] name the name of the group
|
26
26
|
# @param [Hash] options the group options
|
27
27
|
# @option options [Boolean] halt_on_fail if a task execution
|
28
|
-
# should be halted for all
|
28
|
+
# should be halted for all Guard plugins in this group if a Guard plugin throws `:task_has_failed`
|
29
29
|
#
|
30
30
|
def initialize(name, options = {})
|
31
31
|
@name = name.to_sym
|
data/lib/guard/guard.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Guard
|
2
2
|
|
3
|
-
# Base class that every Guard implementation must inherit from.
|
3
|
+
# Base class that every Guard plugin implementation must inherit from.
|
4
4
|
#
|
5
5
|
# Guard will trigger the `start`, `stop`, `reload`, `run_all` and `run_on_changes`
|
6
6
|
# (`run_on_additions`, `run_on_modifications` and `run_on_removals`) task methods
|
@@ -13,8 +13,8 @@ module Guard
|
|
13
13
|
# In each of these Guard task methods you have to implement some work when you want to
|
14
14
|
# support this kind of task. The return value of each Guard task method is not evaluated
|
15
15
|
# by Guard, but I'll be passed to the "_end" hook for further evaluation. You can
|
16
|
-
# throw `:task_has_failed` to indicate that your Guard method was not successful,
|
17
|
-
# and successive
|
16
|
+
# throw `:task_has_failed` to indicate that your Guard plugin method was not successful,
|
17
|
+
# and successive Guard plugin tasks will be aborted when the group has set the `:halt_on_fail`
|
18
18
|
# option.
|
19
19
|
#
|
20
20
|
# @see Guard::Hook
|
@@ -28,11 +28,11 @@ module Guard
|
|
28
28
|
# end
|
29
29
|
# end
|
30
30
|
#
|
31
|
-
# Each Guard should provide a template Guardfile located within the Gem
|
31
|
+
# Each Guard plugin should provide a template Guardfile located within the Gem
|
32
32
|
# at `lib/guard/guard-name/templates/Guardfile`.
|
33
33
|
#
|
34
|
-
# By default all watchers for a Guard
|
35
|
-
# Guard, but if your Guard
|
34
|
+
# By default all watchers for a Guard plugin have to return strings of paths to the
|
35
|
+
# Guard, but if your Guard plugin wants to allow any return value from a watcher,
|
36
36
|
# you can set the `any_return` option to true.
|
37
37
|
#
|
38
38
|
# If one of those methods raise an exception other than `:task_has_failed`,
|
@@ -43,11 +43,11 @@ module Guard
|
|
43
43
|
|
44
44
|
attr_accessor :watchers, :options, :group
|
45
45
|
|
46
|
-
# Initializes a Guard.
|
46
|
+
# Initializes a Guard plugin.
|
47
47
|
#
|
48
|
-
# @param [Array<Guard::Watcher>] watchers the Guard file watchers
|
49
|
-
# @param [Hash] options the custom Guard options
|
50
|
-
# @option options [Symbol] group the group this Guard belongs to
|
48
|
+
# @param [Array<Guard::Watcher>] watchers the Guard plugin file watchers
|
49
|
+
# @param [Hash] options the custom Guard plugin options
|
50
|
+
# @option options [Symbol] group the group this Guard plugin belongs to
|
51
51
|
# @option options [Boolean] any_return allow any object to be returned from a watcher
|
52
52
|
#
|
53
53
|
def initialize(watchers = [], options = {})
|
@@ -55,10 +55,10 @@ module Guard
|
|
55
55
|
@watchers, @options = watchers, options
|
56
56
|
end
|
57
57
|
|
58
|
-
# Initialize the Guard. This will copy the Guardfile template inside the Guard gem.
|
58
|
+
# Initialize the Guard plugin. This will copy the Guardfile template inside the Guard plugin gem.
|
59
59
|
# The template Guardfile must be located within the Gem at `lib/guard/guard-name/templates/Guardfile`.
|
60
60
|
#
|
61
|
-
# @param [String] name the name of the Guard
|
61
|
+
# @param [String] name the name of the Guard plugin
|
62
62
|
#
|
63
63
|
def self.init(name)
|
64
64
|
if ::Guard::Dsl.guardfile_include?(name)
|
@@ -86,16 +86,16 @@ module Guard
|
|
86
86
|
# @raise [:task_has_failed] when start has failed
|
87
87
|
# @return [Object] the task result
|
88
88
|
#
|
89
|
-
|
90
|
-
|
89
|
+
def start
|
90
|
+
end
|
91
91
|
|
92
92
|
# Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
|
93
93
|
#
|
94
94
|
# @raise [:task_has_failed] when stop has failed
|
95
95
|
# @return [Object] the task result
|
96
96
|
#
|
97
|
-
|
98
|
-
|
97
|
+
def stop
|
98
|
+
end
|
99
99
|
|
100
100
|
# Called when `reload|r|z + enter` is pressed.
|
101
101
|
# This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
|
@@ -103,8 +103,8 @@ module Guard
|
|
103
103
|
# @raise [:task_has_failed] when reload has failed
|
104
104
|
# @return [Object] the task result
|
105
105
|
#
|
106
|
-
|
107
|
-
|
106
|
+
def reload
|
107
|
+
end
|
108
108
|
|
109
109
|
# Called when just `enter` is pressed
|
110
110
|
# This method should be principally used for long action like running all specs/tests/...
|
@@ -112,44 +112,44 @@ module Guard
|
|
112
112
|
# @raise [:task_has_failed] when run_all has failed
|
113
113
|
# @return [Object] the task result
|
114
114
|
#
|
115
|
-
|
116
|
-
|
115
|
+
def run_all
|
116
|
+
end
|
117
117
|
|
118
|
-
# Default behaviour on file(s) changes that the Guard watches.
|
118
|
+
# Default behaviour on file(s) changes that the Guard plugin watches.
|
119
119
|
#
|
120
120
|
# @param [Array<String>] paths the changes files or paths
|
121
|
-
# @raise [:task_has_failed] when
|
121
|
+
# @raise [:task_has_failed] when run_on_changes has failed
|
122
122
|
# @return [Object] the task result
|
123
123
|
#
|
124
|
-
|
125
|
-
|
124
|
+
def run_on_changes(paths)
|
125
|
+
end
|
126
126
|
|
127
|
-
# Called on file(s) additions that the Guard watches.
|
127
|
+
# Called on file(s) additions that the Guard plugin watches.
|
128
128
|
#
|
129
129
|
# @param [Array<String>] paths the changes files or paths
|
130
|
-
# @raise [:task_has_failed] when
|
130
|
+
# @raise [:task_has_failed] when run_on_additions has failed
|
131
131
|
# @return [Object] the task result
|
132
132
|
#
|
133
|
-
|
134
|
-
|
133
|
+
def run_on_additions(paths)
|
134
|
+
end
|
135
135
|
|
136
|
-
# Called on file(s) modifications that the Guard watches.
|
136
|
+
# Called on file(s) modifications that the Guard plugin watches.
|
137
137
|
#
|
138
138
|
# @param [Array<String>] paths the changes files or paths
|
139
|
-
# @raise [:task_has_failed] when
|
139
|
+
# @raise [:task_has_failed] when run_on_modifications has failed
|
140
140
|
# @return [Object] the task result
|
141
141
|
#
|
142
|
-
|
143
|
-
|
142
|
+
def run_on_modifications(paths)
|
143
|
+
end
|
144
144
|
|
145
|
-
# Called on file(s) removals that the Guard watches.
|
145
|
+
# Called on file(s) removals that the Guard plugin watches.
|
146
146
|
#
|
147
147
|
# @param [Array<String>] paths the changes files or paths
|
148
|
-
# @raise [:task_has_failed] when
|
148
|
+
# @raise [:task_has_failed] when run_on_removals has failed
|
149
149
|
# @return [Object] the task result
|
150
150
|
#
|
151
|
-
|
152
|
-
|
151
|
+
def run_on_removals(paths)
|
152
|
+
end
|
153
153
|
|
154
154
|
end
|
155
155
|
|
data/lib/guard/hook.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Guard
|
2
2
|
|
3
|
-
# Guard has a hook mechanism that allows you to insert callbacks for individual
|
4
|
-
# By default, each of the Guard instance methods has a "_begin" and an "_end" hook.
|
3
|
+
# Guard has a hook mechanism that allows you to insert callbacks for individual Guard plugins.
|
4
|
+
# By default, each of the Guard plugin instance methods has a "_begin" and an "_end" hook.
|
5
5
|
# For example, the Guard::Guard#start method has a :start_begin hook that is runs immediately
|
6
6
|
# before Guard::Guard#start, and a :start_end hook that runs immediately after Guard::Guard#start.
|
7
7
|
#
|
data/lib/guard/interactor.rb
CHANGED
@@ -185,17 +185,17 @@ module Guard
|
|
185
185
|
puts '[n]otification Toggle notifications'
|
186
186
|
puts '[s]how Show available Guard plugins'
|
187
187
|
puts '[c]hange <file> Trigger a file change'
|
188
|
-
puts '<enter> Run all
|
188
|
+
puts '<enter> Run all Guard plugins'
|
189
189
|
puts ''
|
190
190
|
puts 'You can scope the reload action to a specific guard or group:'
|
191
191
|
puts ''
|
192
192
|
puts 'rspec reload Reload the RSpec Guard'
|
193
193
|
puts 'backend reload Reload the backend group'
|
194
194
|
puts ''
|
195
|
-
puts 'You can also run only a specific Guard or all
|
195
|
+
puts 'You can also run only a specific Guard or all Guard plugins in a specific group:'
|
196
196
|
puts ''
|
197
197
|
puts 'jasmine Run the jasmine Guard'
|
198
|
-
puts 'frontend Run all
|
198
|
+
puts 'frontend Run all Guard plugins in the frontend group'
|
199
199
|
puts ''
|
200
200
|
end
|
201
201
|
|
data/lib/guard/runner.rb
CHANGED
@@ -38,7 +38,7 @@ module Guard
|
|
38
38
|
# Runs a Guard-task on all registered guards.
|
39
39
|
#
|
40
40
|
# @param [Symbol] task the task to run
|
41
|
-
# @param [Hash] scope either the
|
41
|
+
# @param [Hash] scope either the Guard plugin or the group to run the task on
|
42
42
|
#
|
43
43
|
# @see self.run_supervised_task
|
44
44
|
#
|
@@ -73,7 +73,7 @@ module Guard
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
# Run a Guard task, but remove the Guard when his work leads to a system failure.
|
76
|
+
# Run a Guard plugin task, but remove the Guard plugin when his work leads to a system failure.
|
77
77
|
#
|
78
78
|
# When the Group has `:halt_on_fail` disabled, we've to catch `:task_has_failed`
|
79
79
|
# here in order to avoid an uncaught throw error.
|
@@ -112,8 +112,7 @@ module Guard
|
|
112
112
|
# group level.
|
113
113
|
# @see .scoped_guards
|
114
114
|
#
|
115
|
-
# @param [Guard::Guard] guard the Guard to execute
|
116
|
-
#
|
115
|
+
# @param [Guard::Guard] guard the Guard plugin to execute
|
117
116
|
# @return [Symbol] the symbol to catch
|
118
117
|
#
|
119
118
|
def self.stopping_symbol_for(guard)
|
@@ -128,7 +127,7 @@ module Guard
|
|
128
127
|
# Tries to run the first implemented task by a given guard
|
129
128
|
# from a collection of tasks.
|
130
129
|
#
|
131
|
-
# @param [Guard::Guard] guard the
|
130
|
+
# @param [Guard::Guard] guard the Guard plugin to run the first found task on
|
132
131
|
# @param [Array<Symbol>] tasks the tasks to run the first among
|
133
132
|
# @param [Object] task_param the param to pass to each task
|
134
133
|
#
|
@@ -143,12 +142,12 @@ module Guard
|
|
143
142
|
end
|
144
143
|
end
|
145
144
|
|
146
|
-
# Loop through all groups and run the given task for each Guard.
|
145
|
+
# Loop through all groups and run the given task for each Guard plugin.
|
147
146
|
#
|
148
|
-
# Stop the task run for the all
|
147
|
+
# Stop the task run for the all Guard plugins within a group if one Guard
|
149
148
|
# throws `:task_has_failed`.
|
150
149
|
#
|
151
|
-
# @param [Hash] scope an hash with a
|
150
|
+
# @param [Hash] scope an hash with a Guard plugin or a group scope
|
152
151
|
# @yield the task to run
|
153
152
|
#
|
154
153
|
def scoped_guards(scopes = {})
|
@@ -169,7 +168,7 @@ module Guard
|
|
169
168
|
# Logic to know if the UI can be cleared or not in the run_on_changes method
|
170
169
|
# based on the guard and the changes.
|
171
170
|
#
|
172
|
-
# @param [Guard::Guard] guard the
|
171
|
+
# @param [Guard::Guard] guard the Guard plugin where run_on_changes is called
|
173
172
|
# @param [Array<String>] modified_paths the modified paths.
|
174
173
|
# @param [Array<String>] added_paths the added paths.
|
175
174
|
# @param [Array<String>] removed_paths the removed paths.
|
data/lib/guard/ui.rb
CHANGED
@@ -4,7 +4,7 @@ module Guard
|
|
4
4
|
# through this class is considered either as an error message or a diagnostic
|
5
5
|
# message and is written to standard error (STDERR).
|
6
6
|
#
|
7
|
-
# If your Guard does some output that is piped into another process for further
|
7
|
+
# If your Guard plugin does some output that is piped into another process for further
|
8
8
|
# processing, please just write it to STDOUT with `puts`.
|
9
9
|
#
|
10
10
|
module UI
|
data/lib/guard/version.rb
CHANGED
data/lib/guard/version.rbc
CHANGED
@@ -66,57 +66,21 @@ x
|
|
66
66
|
5
|
67
67
|
Guard
|
68
68
|
i
|
69
|
-
|
69
|
+
12
|
70
70
|
5
|
71
71
|
66
|
72
|
-
|
73
|
-
93
|
74
|
-
0
|
75
|
-
15
|
76
|
-
29
|
77
|
-
21
|
78
|
-
0
|
79
|
-
45
|
80
|
-
0
|
81
|
-
1
|
72
|
+
65
|
82
73
|
7
|
83
|
-
2
|
84
|
-
3
|
85
|
-
98
|
86
|
-
3
|
87
|
-
3
|
88
|
-
30
|
89
|
-
8
|
90
|
-
27
|
91
|
-
25
|
92
|
-
92
|
93
74
|
0
|
94
|
-
27
|
95
|
-
8
|
96
|
-
32
|
97
|
-
15
|
98
75
|
7
|
99
|
-
4
|
100
|
-
8
|
101
|
-
33
|
102
76
|
1
|
103
|
-
9
|
104
|
-
38
|
105
|
-
1
|
106
|
-
8
|
107
|
-
47
|
108
|
-
65
|
109
|
-
7
|
110
|
-
2
|
111
|
-
7
|
112
|
-
5
|
113
77
|
64
|
114
78
|
49
|
115
|
-
|
79
|
+
2
|
116
80
|
2
|
117
81
|
11
|
118
82
|
I
|
119
|
-
|
83
|
+
3
|
120
84
|
I
|
121
85
|
0
|
122
86
|
I
|
@@ -125,42 +89,24 @@ I
|
|
125
89
|
0
|
126
90
|
n
|
127
91
|
p
|
128
|
-
|
129
|
-
x
|
130
|
-
5
|
131
|
-
Guard
|
132
|
-
n
|
92
|
+
3
|
133
93
|
x
|
134
94
|
7
|
135
95
|
VERSION
|
136
|
-
x
|
137
|
-
22
|
138
|
-
vm_const_defined_under
|
139
|
-
s
|
140
|
-
8
|
141
|
-
constant
|
142
96
|
s
|
143
97
|
5
|
144
|
-
1.
|
98
|
+
1.2.1
|
145
99
|
x
|
146
100
|
9
|
147
101
|
const_set
|
148
102
|
p
|
149
|
-
|
150
|
-
I
|
151
|
-
2
|
103
|
+
3
|
152
104
|
I
|
153
105
|
2
|
154
106
|
I
|
155
|
-
|
156
|
-
I
|
157
|
-
4
|
158
|
-
I
|
159
|
-
2f
|
160
|
-
I
|
161
|
-
0
|
107
|
+
3
|
162
108
|
I
|
163
|
-
|
109
|
+
c
|
164
110
|
x
|
165
111
|
52
|
166
112
|
/Users/michi/Repositories/guard/lib/guard/version.rb
|
data/lib/guard/watcher.rb
CHANGED
@@ -10,8 +10,8 @@ module Guard
|
|
10
10
|
|
11
11
|
# Initialize a file watcher.
|
12
12
|
#
|
13
|
-
# @param [String, Regexp] pattern the pattern to be watched by the
|
14
|
-
# @param [Block] action the action to execute before passing the result to the Guard
|
13
|
+
# @param [String, Regexp] pattern the pattern to be watched by the Guard plugin
|
14
|
+
# @param [Block] action the action to execute before passing the result to the Guard plugin
|
15
15
|
#
|
16
16
|
def initialize(pattern, action = nil)
|
17
17
|
@pattern, @action = pattern, action
|
@@ -36,7 +36,7 @@ module Guard
|
|
36
36
|
|
37
37
|
# Finds the files that matches a Guard.
|
38
38
|
#
|
39
|
-
# @param [Guard::Guard] guard the
|
39
|
+
# @param [Guard::Guard] guard the Guard plugin which watchers are used
|
40
40
|
# @param [Array<String>] files the changed files
|
41
41
|
# @return [Array<Object>] the matched watcher response
|
42
42
|
#
|
@@ -62,9 +62,9 @@ module Guard
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
# Test if a file would be matched by any of the
|
65
|
+
# Test if a file would be matched by any of the Guard plugin watchers.
|
66
66
|
#
|
67
|
-
# @param [Array<Guard::Guard>] guards the
|
67
|
+
# @param [Array<Guard::Guard>] guards the Guard plugins to use the watchers from
|
68
68
|
# @param [Array<String>] files the files to test
|
69
69
|
# @return [Boolean] Whether a file matches
|
70
70
|
#
|
data/man/guard.1
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "GUARD" "1" "
|
4
|
+
.TH "GUARD" "1" "July 2012" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBguard\fR \- Guard keeps an eye on your file modifications\.
|
8
8
|
.
|
9
9
|
.SH "DESCRIPTION"
|
10
|
-
Guard is a command line tool
|
10
|
+
Guard is a command line tool to easily handle events on file system modifications\.
|
11
11
|
.
|
12
12
|
.SH "SYNOPSIS"
|
13
13
|
\fBguard <COMMAND> <OPTIONS>\fR
|
@@ -39,22 +39,31 @@ The following options are available:
|
|
39
39
|
\fB\-G\fR, \fB\-\-guardfile\fR \fIFILE\fR Tells Guard to use FILE as its Guardfile instead of \fB\./Guardfile\fR or \fB~/\.Guardfile\fR\.
|
40
40
|
.
|
41
41
|
.P
|
42
|
-
\fB\-
|
42
|
+
\fB\-i\fR, \fB\-\-no\-interactions\fR Turn off completely any Guard terminal interactions\.
|
43
43
|
.
|
44
44
|
.P
|
45
|
-
\fB\-
|
45
|
+
\fB\-B\fR, \fB\-\-no\-bundler\-warning\fR Turn off warning when Bundler is not present\.
|
46
|
+
.
|
47
|
+
.P
|
48
|
+
\fB\-\-show\-deprecations\fR Turn on deprecation warnings\.
|
49
|
+
.
|
50
|
+
.P
|
51
|
+
\fB\-l\fR, \fB\-\-latency\fR Overwrite Listen\'s default latency\.
|
52
|
+
.
|
53
|
+
.P
|
54
|
+
\fB\-p\fR, \fB\-\-force\-polling\fR Force usage of the Listen polling listener\.
|
46
55
|
.
|
47
56
|
.SS "init [GUARD]"
|
48
57
|
If no Guardfile is present in the current directory, creates an empty Guardfile\.
|
49
58
|
.
|
50
59
|
.P
|
51
|
-
If \fIGUARD\fR is present, add its default Guardfile configuration to the current Guardfile\. Note that \fIGUARD\fR is the
|
60
|
+
If \fIGUARD\fR is present, add its default Guardfile configuration to the current Guardfile\. Note that \fIGUARD\fR is the Guard plugin name without the \fBguard\-\fR prefix\. For instance to initialize guard\-rspec, run \fBguard init rspec\fR\.
|
52
61
|
.
|
53
62
|
.SS "list"
|
54
|
-
Lists
|
63
|
+
Lists Guard plugins that can be used with the \fBinit\fR command\.
|
55
64
|
.
|
56
65
|
.SS "\-T, show"
|
57
|
-
List defined groups and
|
66
|
+
List defined groups and Guard plugins for the current Guardfile\.
|
58
67
|
.
|
59
68
|
.SS "\-h, help [COMMAND]"
|
60
69
|
List all of Guard\'s available commands\.
|
@@ -63,7 +72,7 @@ List all of Guard\'s available commands\.
|
|
63
72
|
If \fICOMMAND\fR is given, displays a specific help for \fITASK\fR\.
|
64
73
|
.
|
65
74
|
.SH "EXAMPLES"
|
66
|
-
Initialize Guard and a specific
|
75
|
+
Initialize Guard and a specific Guard plugin at the same time:
|
67
76
|
.
|
68
77
|
.P
|
69
78
|
\fB[bundle exec] guard init [rspec]\fR
|
data/man/guard.1.html
CHANGED
@@ -75,7 +75,7 @@
|
|
75
75
|
|
76
76
|
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
77
77
|
|
78
|
-
<p>Guard is a command line tool
|
78
|
+
<p>Guard is a command line tool to easily handle events on file system modifications.</p>
|
79
79
|
|
80
80
|
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
81
81
|
|
@@ -111,27 +111,36 @@
|
|
111
111
|
<p><code>-G</code>, <code>--guardfile</code> <var>FILE</var>
|
112
112
|
Tells Guard to use FILE as its Guardfile instead of <code>./Guardfile</code> or <code>~/.Guardfile</code>.</p>
|
113
113
|
|
114
|
-
<p><code>-A</code>, <code>--watch-all-modifications</code>
|
115
|
-
Watch all file modifications like moves or deletions with.</p>
|
116
|
-
|
117
114
|
<p><code>-i</code>, <code>--no-interactions</code>
|
118
115
|
Turn off completely any Guard terminal interactions.</p>
|
119
116
|
|
117
|
+
<p><code>-B</code>, <code>--no-bundler-warning</code>
|
118
|
+
Turn off warning when Bundler is not present.</p>
|
119
|
+
|
120
|
+
<p><code>--show-deprecations</code>
|
121
|
+
Turn on deprecation warnings.</p>
|
122
|
+
|
123
|
+
<p><code>-l</code>, <code>--latency</code>
|
124
|
+
Overwrite Listen's default latency.</p>
|
125
|
+
|
126
|
+
<p><code>-p</code>, <code>--force-polling</code>
|
127
|
+
Force usage of the Listen polling listener.</p>
|
128
|
+
|
120
129
|
<h3 id="init-GUARD-">init [GUARD]</h3>
|
121
130
|
|
122
131
|
<p>If no Guardfile is present in the current directory, creates an empty Guardfile.</p>
|
123
132
|
|
124
133
|
<p>If <var>GUARD</var> is present, add its default Guardfile configuration to the current Guardfile.
|
125
|
-
Note that <var>GUARD</var> is the
|
134
|
+
Note that <var>GUARD</var> is the Guard plugin name without the <code>guard-</code> prefix.
|
126
135
|
For instance to initialize guard-rspec, run <code>guard init rspec</code>.</p>
|
127
136
|
|
128
137
|
<h3 id="list">list</h3>
|
129
138
|
|
130
|
-
<p>Lists
|
139
|
+
<p>Lists Guard plugins that can be used with the <code>init</code> command.</p>
|
131
140
|
|
132
141
|
<h3 id="-T-show">-T, show</h3>
|
133
142
|
|
134
|
-
<p>List defined groups and
|
143
|
+
<p>List defined groups and Guard plugins for the current Guardfile.</p>
|
135
144
|
|
136
145
|
<h3 id="-h-help-COMMAND-">-h, help [COMMAND]</h3>
|
137
146
|
|
@@ -141,7 +150,7 @@ For instance to initialize guard-rspec, run <code>guard init rspec</code>.</p>
|
|
141
150
|
|
142
151
|
<h2 id="EXAMPLES">EXAMPLES</h2>
|
143
152
|
|
144
|
-
<p>Initialize Guard and a specific
|
153
|
+
<p>Initialize Guard and a specific Guard plugin at the same time:</p>
|
145
154
|
|
146
155
|
<p><code>[bundle exec] guard init [rspec]</code></p>
|
147
156
|
|
@@ -172,7 +181,7 @@ https://github.com/guard/guard/blob/master/CHANGELOG.md</p>
|
|
172
181
|
|
173
182
|
<ol class='man-decor man-foot man foot'>
|
174
183
|
<li class='tl'></li>
|
175
|
-
<li class='tc'>
|
184
|
+
<li class='tc'>July 2012</li>
|
176
185
|
<li class='tr'>guard(1)</li>
|
177
186
|
</ol>
|
178
187
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -91,54 +91,6 @@ dependencies:
|
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: 1.1.0
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: yard
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ! '>='
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '0'
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: redcarpet
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ! '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: pry
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- - ! '>='
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- - ! '>='
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
142
94
|
description: Guard is a command line tool to easily handle events on file system modifications.
|
143
95
|
email:
|
144
96
|
- thibaud@thibaud.me
|
@@ -197,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
197
149
|
version: '0'
|
198
150
|
segments:
|
199
151
|
- 0
|
200
|
-
hash:
|
152
|
+
hash: -3637143437801209002
|
201
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
154
|
none: false
|
203
155
|
requirements:
|