listen 1.1.6 → 1.2.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +9 -0
- data/lib/listen/adapter.rb +9 -1
- data/lib/listen/listener.rb +16 -0
- data/lib/listen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8776e2e4466c49d67aa6697bcee59db998508757
|
4
|
+
data.tar.gz: 296383775b460f0177cfb73232a20fee9aa15a97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 154daba042dadf9e3a2b88e0ad8a5e9d4a9fde2768b0918556c3b76160d1dbf123ddb9fc9484e88468a2a5cd122bc37c4ab50b347f27b1949346db15c9eb0bd2
|
7
|
+
data.tar.gz: 89a846a26738db61e4128c2d81421efcabcba3c0312e854afc44a7353e142dd01347f99530534155007977bc8b8df64fa59dd3d97d8f875d64115ff2c5f66a83
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 1.2.0 - Jun 11, 2013
|
2
|
+
|
3
|
+
### Improvement
|
4
|
+
|
5
|
+
- [#124][] New `force_adapter` option, skip the `.listen_test` adapter test. ([@nicobrevin][])
|
6
|
+
|
1
7
|
## 1.1.6 - Jun 4, 2013
|
2
8
|
|
3
9
|
### Change
|
@@ -310,6 +316,7 @@
|
|
310
316
|
[#118]: https://github.com/guard/listen/issues/118
|
311
317
|
[#120]: https://github.com/guard/listen/issues/120
|
312
318
|
[#122]: https://github.com/guard/listen/issues/122
|
319
|
+
[#124]: https://github.com/guard/listen/issues/124
|
313
320
|
[@Maher4Ever]: https://github.com/Maher4Ever
|
314
321
|
[@ahoward]: https://github.com/ahoward
|
315
322
|
[@akerbos]: https://github.com/akerbos
|
@@ -329,6 +336,7 @@
|
|
329
336
|
[@napcs]: https://github.com/napcs
|
330
337
|
[@netzpirat]: https://github.com/netzpirat
|
331
338
|
[@nex3]: https://github.com/nex3
|
339
|
+
[@nicobrevin]: https://github.com/nicobrevin
|
332
340
|
[@nilbus]: https://github.com/nilbus
|
333
341
|
[@nysalor]: https://github.com/nysalor
|
334
342
|
[@piotr-sokolowski]: https://github.com/piotr-sokolowski
|
data/README.md
CHANGED
@@ -87,6 +87,7 @@ listener = listener.filter(/\.rb$/)
|
|
87
87
|
listener = listener.latency(0.5)
|
88
88
|
listener = listener.force_polling(true)
|
89
89
|
listener = listener.polling_fallback_message(false)
|
90
|
+
listener = listener.force_adapter(Listen::Adapters::Linux)
|
90
91
|
listener = listener.change(&callback)
|
91
92
|
listener.start
|
92
93
|
```
|
@@ -207,6 +208,9 @@ or via ["Object" API](#object-api) methods:
|
|
207
208
|
:latency => 0.5 # Set the delay (**in seconds**) between checking for changes
|
208
209
|
# default: 0.25 sec (1.0 sec for polling)
|
209
210
|
|
211
|
+
:force_adapter => Listen::Adapters::Linux # Force the use of a particular adapter class
|
212
|
+
# default: none
|
213
|
+
|
210
214
|
:force_polling => true # Force the use of the polling adapter
|
211
215
|
# default: none
|
212
216
|
|
@@ -276,6 +280,11 @@ want to force the use of the polling adapter, either use the `:force_polling` op
|
|
276
280
|
while initializing the listener or call the `#force_polling` method on your listener
|
277
281
|
before starting it.
|
278
282
|
|
283
|
+
It is also possible to force the use of a particular adapter, by using the `:force_adapter`
|
284
|
+
option. This option skips the usual adapter choosing mechanism and uses the given
|
285
|
+
adapter class instead. The adapter choosing mechanism requires write permission
|
286
|
+
to your watched directories and will needlessly load code, which isn't always desirable.
|
287
|
+
|
279
288
|
## Polling fallback
|
280
289
|
|
281
290
|
When a OS-specific adapter doesn't work the Listen gem automatically falls back to the polling adapter.
|
data/lib/listen/adapter.rb
CHANGED
@@ -42,7 +42,15 @@ module Listen
|
|
42
42
|
# @return [Listen::Adapter] the chosen adapter
|
43
43
|
#
|
44
44
|
def self.select_and_initialize(directories, options = {}, &callback)
|
45
|
-
|
45
|
+
forced_adapter_class = options.delete(:force_adapter)
|
46
|
+
force_polling = options.delete(:force_polling)
|
47
|
+
|
48
|
+
if forced_adapter_class
|
49
|
+
forced_adapter_class.load_dependent_adapter
|
50
|
+
return forced_adapter_class.new(directories, options, &callback)
|
51
|
+
end
|
52
|
+
|
53
|
+
return Adapters::Polling.new(directories, options, &callback) if force_polling
|
46
54
|
|
47
55
|
OPTIMIZED_ADAPTERS.each do |adapter|
|
48
56
|
namespaced_adapter = Adapters.const_get(adapter)
|
data/lib/listen/listener.rb
CHANGED
@@ -21,6 +21,7 @@ module Listen
|
|
21
21
|
# @option options [Boolean] relative_paths whether or not to use relative-paths in the callback
|
22
22
|
# @option options [Boolean] force_polling whether to force the polling adapter or not
|
23
23
|
# @option options [String, Boolean] polling_fallback_message to change polling fallback message or remove it
|
24
|
+
# @option options [Class] force_adapter force the use of this adapter class, skipping usual adapter selection
|
24
25
|
#
|
25
26
|
# @yield [modified, added, removed] the changed files
|
26
27
|
# @yieldparam [Array<String>] modified the list of modified files
|
@@ -180,6 +181,21 @@ module Listen
|
|
180
181
|
self
|
181
182
|
end
|
182
183
|
|
184
|
+
# Sets whether to force the use of a particular adapter, rather than
|
185
|
+
# going through usual adapter selection process on start.
|
186
|
+
#
|
187
|
+
# @example Force use of Linux polling
|
188
|
+
# force_adapter Listen::Adapters::Linux
|
189
|
+
#
|
190
|
+
# @param [Class] adapter class to use for file system event notification.
|
191
|
+
#
|
192
|
+
# @return [Listen::Listener] the listener
|
193
|
+
#
|
194
|
+
def force_adapter(adapter_class)
|
195
|
+
@adapter_options[:force_adapter] = adapter_class
|
196
|
+
self
|
197
|
+
end
|
198
|
+
|
183
199
|
# Sets whether the paths in the callback should be
|
184
200
|
# relative or absolute.
|
185
201
|
#
|
data/lib/listen/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: listen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibaud Guillaume-Gentil
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rb-fsevent
|