listen 2.7.11 → 2.7.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound.yml +3 -0
- data/.rubocop.yml +20 -232
- data/.rubocop_todo.yml +33 -0
- data/CONTRIBUTING.md +5 -5
- data/Gemfile +1 -0
- data/Guardfile +12 -9
- data/README.md +15 -29
- data/Rakefile +8 -1
- data/TROUBLESHOOTING.md +139 -0
- data/lib/listen.rb +6 -5
- data/lib/listen/adapter.rb +2 -1
- data/lib/listen/adapter/base.rb +7 -3
- data/lib/listen/adapter/darwin.rb +16 -1
- data/lib/listen/adapter/tcp.rb +8 -5
- data/lib/listen/adapter/windows.rb +6 -6
- data/lib/listen/change.rb +3 -2
- data/lib/listen/cli.rb +1 -3
- data/lib/listen/directory.rb +7 -11
- data/lib/listen/file.rb +35 -41
- data/lib/listen/internals/logging.rb +31 -0
- data/lib/listen/internals/thread_pool.rb +19 -0
- data/lib/listen/listener.rb +14 -14
- data/lib/listen/record.rb +2 -2
- data/lib/listen/silencer.rb +3 -3
- data/lib/listen/tcp/broadcaster.rb +8 -5
- data/lib/listen/version.rb +1 -1
- data/listen.gemspec +2 -2
- data/spec/acceptance/listen_spec.rb +1 -2
- data/spec/acceptance/tcp_spec.rb +4 -1
- data/spec/lib/listen/adapter/darwin_spec.rb +108 -0
- data/spec/lib/listen/adapter/polling_spec.rb +1 -0
- data/spec/lib/listen/file_spec.rb +20 -20
- data/spec/lib/listen/listener_spec.rb +1 -1
- data/spec/lib/listen/record_spec.rb +1 -1
- data/spec/lib/listen/silencer_spec.rb +4 -4
- data/spec/spec_helper.rb +4 -0
- data/spec/support/acceptance_helper.rb +2 -4
- data/vendor/hound/config/style_guides/ruby.yml +259 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65b3168861b5ccc57809689d8ad5849a631db822
|
4
|
+
data.tar.gz: 3640593ce18fa45435a2ff0184e9c7fda77acfce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ba0723ef31cfc026fb71bc89f0d1f951cbd276270bb57329fef1ffa5aae8e982f645a69a2a7bbf39591ae6d8160950fbb71f356417874948c39d010559cca31
|
7
|
+
data.tar.gz: 1203e42ab3497f1c2d1348330398880f92b1932038f60b7f8f2283e67bfc4e04e034f10b35389bb00a0775db352d91228af98243951f702137cbc19a3ffe2ad5
|
data/.hound.yml
ADDED
data/.rubocop.yml
CHANGED
@@ -1,232 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
Enabled:
|
21
|
-
|
22
|
-
CaseEquality:
|
23
|
-
Enabled: false
|
24
|
-
|
25
|
-
CharacterLiteral:
|
26
|
-
Enabled: false
|
27
|
-
|
28
|
-
ClassLength:
|
29
|
-
Enabled: false
|
30
|
-
|
31
|
-
ClassVars:
|
32
|
-
Enabled: false
|
33
|
-
|
34
|
-
CollectionMethods:
|
35
|
-
PreferredMethods:
|
36
|
-
find: detect
|
37
|
-
reduce: inject
|
38
|
-
collect: map
|
39
|
-
find_all: select
|
40
|
-
|
41
|
-
ColonMethodCall:
|
42
|
-
Enabled: false
|
43
|
-
|
44
|
-
CommentAnnotation:
|
45
|
-
Enabled: false
|
46
|
-
|
47
|
-
CyclomaticComplexity:
|
48
|
-
Enabled: false
|
49
|
-
|
50
|
-
Delegate:
|
51
|
-
Enabled: false
|
52
|
-
|
53
|
-
DeprecatedHashMethods:
|
54
|
-
Enabled: false
|
55
|
-
|
56
|
-
Documentation:
|
57
|
-
Enabled: false
|
58
|
-
|
59
|
-
DotPosition:
|
60
|
-
EnforcedStyle: trailing
|
61
|
-
|
62
|
-
DoubleNegation:
|
63
|
-
Enabled: false
|
64
|
-
|
65
|
-
EmptyLiteral:
|
66
|
-
Enabled: false
|
67
|
-
|
68
|
-
Encoding:
|
69
|
-
Enabled: false
|
70
|
-
|
71
|
-
EvenOdd:
|
72
|
-
Enabled: false
|
73
|
-
|
74
|
-
FileName:
|
75
|
-
Enabled: false
|
76
|
-
|
77
|
-
FlipFlop:
|
78
|
-
Enabled: false
|
79
|
-
|
80
|
-
FormatString:
|
81
|
-
Enabled: false
|
82
|
-
|
83
|
-
GlobalVars:
|
84
|
-
Enabled: false
|
85
|
-
|
86
|
-
IfUnlessModifier:
|
87
|
-
Enabled: false
|
88
|
-
|
89
|
-
IfWithSemicolon:
|
90
|
-
Enabled: false
|
91
|
-
|
92
|
-
Lambda:
|
93
|
-
Enabled: false
|
94
|
-
|
95
|
-
LambdaCall:
|
96
|
-
Enabled: false
|
97
|
-
|
98
|
-
LineEndConcatenation:
|
99
|
-
Enabled: false
|
100
|
-
|
101
|
-
LineLength:
|
102
|
-
Max: 80
|
103
|
-
|
104
|
-
MethodLength:
|
105
|
-
Enabled: false
|
106
|
-
|
107
|
-
ModuleFunction:
|
108
|
-
Enabled: false
|
109
|
-
|
110
|
-
NegatedIf:
|
111
|
-
Enabled: false
|
112
|
-
|
113
|
-
NegatedWhile:
|
114
|
-
Enabled: false
|
115
|
-
|
116
|
-
NilComparison:
|
117
|
-
Enabled: false
|
118
|
-
|
119
|
-
Not:
|
120
|
-
Enabled: false
|
121
|
-
|
122
|
-
NumericLiterals:
|
123
|
-
Enabled: false
|
124
|
-
|
125
|
-
OneLineConditional:
|
126
|
-
Enabled: false
|
127
|
-
|
128
|
-
OpMethod:
|
129
|
-
Enabled: false
|
130
|
-
|
131
|
-
ParameterLists:
|
132
|
-
Enabled: false
|
133
|
-
|
134
|
-
PercentLiteralDelimiters:
|
135
|
-
PreferredDelimiters:
|
136
|
-
'%': '{}'
|
137
|
-
|
138
|
-
PerlBackrefs:
|
139
|
-
Enabled: false
|
140
|
-
|
141
|
-
PredicateName:
|
142
|
-
NamePrefixBlacklist:
|
143
|
-
- is_
|
144
|
-
|
145
|
-
Proc:
|
146
|
-
Enabled: false
|
147
|
-
|
148
|
-
RaiseArgs:
|
149
|
-
Enabled: false
|
150
|
-
|
151
|
-
RegexpLiteral:
|
152
|
-
Enabled: false
|
153
|
-
|
154
|
-
SelfAssignment:
|
155
|
-
Enabled: false
|
156
|
-
|
157
|
-
SingleLineBlockParams:
|
158
|
-
Enabled: false
|
159
|
-
|
160
|
-
SingleLineMethods:
|
161
|
-
Enabled: false
|
162
|
-
|
163
|
-
SpecialGlobalVars:
|
164
|
-
Enabled: false
|
165
|
-
|
166
|
-
VariableInterpolation:
|
167
|
-
Enabled: false
|
168
|
-
|
169
|
-
TrailingComma:
|
170
|
-
Enabled: false
|
171
|
-
|
172
|
-
TrivialAccessors:
|
173
|
-
Enabled: false
|
174
|
-
|
175
|
-
VariableInterpolation:
|
176
|
-
Enabled: false
|
177
|
-
|
178
|
-
WhenThen:
|
179
|
-
Enabled: false
|
180
|
-
|
181
|
-
WhileUntilModifier:
|
182
|
-
Enabled: false
|
183
|
-
|
184
|
-
WordArray:
|
185
|
-
Enabled: false
|
186
|
-
|
187
|
-
# Lint
|
188
|
-
|
189
|
-
AmbiguousOperator:
|
190
|
-
Enabled: false
|
191
|
-
|
192
|
-
AmbiguousRegexpLiteral:
|
193
|
-
Enabled: false
|
194
|
-
|
195
|
-
AssignmentInCondition:
|
196
|
-
Enabled: false
|
197
|
-
|
198
|
-
ConditionPosition:
|
199
|
-
Enabled: false
|
200
|
-
|
201
|
-
DeprecatedClassMethods:
|
202
|
-
Enabled: false
|
203
|
-
|
204
|
-
ElseLayout:
|
205
|
-
Enabled: false
|
206
|
-
|
207
|
-
HandleExceptions:
|
208
|
-
Enabled: false
|
209
|
-
|
210
|
-
InvalidCharacterLiteral:
|
211
|
-
Enabled: false
|
212
|
-
|
213
|
-
LiteralInCondition:
|
214
|
-
Enabled: false
|
215
|
-
|
216
|
-
LiteralInInterpolation:
|
217
|
-
Enabled: false
|
218
|
-
|
219
|
-
Loop:
|
220
|
-
Enabled: false
|
221
|
-
|
222
|
-
ParenthesesAsGroupedExpression:
|
223
|
-
Enabled: false
|
224
|
-
|
225
|
-
RequireParentheses:
|
226
|
-
Enabled: false
|
227
|
-
|
228
|
-
UnderscorePrefixedVariableName:
|
229
|
-
Enabled: false
|
230
|
-
|
231
|
-
Void:
|
232
|
-
Enabled: false
|
1
|
+
inherit_from:
|
2
|
+
- vendor/hound/config/style_guides/ruby.yml
|
3
|
+
- .rubocop_todo.yml
|
4
|
+
|
5
|
+
# Rails cops
|
6
|
+
AllCops:
|
7
|
+
RunRailsCops: true
|
8
|
+
|
9
|
+
# Files you want to exclude
|
10
|
+
AllCops:
|
11
|
+
Exclude:
|
12
|
+
- db/schema.rb
|
13
|
+
- Gemfile
|
14
|
+
- Guardfile
|
15
|
+
- Rakefile
|
16
|
+
|
17
|
+
# TODO: put your overrides here:
|
18
|
+
Style/StringLiterals:
|
19
|
+
EnforcedStyle: single_quotes
|
20
|
+
Enabled: true
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-11-11 16:35:31 +0100 using RuboCop version 0.25.0.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 2
|
9
|
+
# Configuration parameters: CountComments.
|
10
|
+
Metrics/ClassLength:
|
11
|
+
Max: 223
|
12
|
+
|
13
|
+
# Offense count: 7
|
14
|
+
Metrics/CyclomaticComplexity:
|
15
|
+
Max: 14
|
16
|
+
|
17
|
+
# Offense count: 27
|
18
|
+
# Configuration parameters: CountComments.
|
19
|
+
Metrics/MethodLength:
|
20
|
+
Max: 34
|
21
|
+
|
22
|
+
# Offense count: 5
|
23
|
+
Metrics/PerceivedComplexity:
|
24
|
+
Max: 16
|
25
|
+
|
26
|
+
# Offense count: 19
|
27
|
+
Style/Documentation:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
# Offense count: 44
|
31
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
32
|
+
Style/DotPosition:
|
33
|
+
Enabled: false
|
data/CONTRIBUTING.md
CHANGED
@@ -4,6 +4,8 @@ Contribute to Listen
|
|
4
4
|
File an issue
|
5
5
|
-------------
|
6
6
|
|
7
|
+
If you haven't already, first see [TROUBLESHOOTING](https://github.com/guard/listen/blob/master/TROUBLESHOOTING.md) for known issues, solutions and workarounds.
|
8
|
+
|
7
9
|
You can report bugs and feature requests to [GitHub Issues](https://github.com/guard/listen/issues).
|
8
10
|
|
9
11
|
**Please don't ask question in the issue tracker**, instead ask them in our
|
@@ -11,14 +13,12 @@ You can report bugs and feature requests to [GitHub Issues](https://github.com/g
|
|
11
13
|
|
12
14
|
Try to figure out where the issue belongs to: Is it an issue with Listen itself or with Guard?
|
13
15
|
|
14
|
-
When you file a bug, please try to follow these simple rules if applicable:
|
15
|
-
|
16
|
-
* Make sure you run Listen with `bundle exec` first.
|
17
|
-
* Add your `Guardfile` (if used) and `Gemfile` to the issue.
|
18
|
-
* Make sure that the issue is reproducible with your description.
|
19
16
|
|
20
17
|
**It's most likely that your bug gets resolved faster if you provide as much information as possible!**
|
21
18
|
|
19
|
+
The MOST useful information is debugging output from Listen (`LISTEN_GEM_DEBUGGING=1`) - see [TROUBLESHOOTING](https://github.com/guard/listen/blob/master/TROUBLESHOOTING.md) for details.
|
20
|
+
|
21
|
+
|
22
22
|
Development
|
23
23
|
-----------
|
24
24
|
|
data/Gemfile
CHANGED
data/Guardfile
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
ignore(%r{spec/\.fixtures/})
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
group :specs, halt_on_fail: true do
|
4
|
+
guard :rspec, cmd: 'bundle exec rspec', failed_mode: :keep do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch(%r{^spec/support/*}) { 'spec' }
|
8
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
9
|
+
end
|
9
10
|
|
10
|
-
guard :rubocop, all_on_start: false, cli: '--rails' do
|
11
|
-
|
12
|
-
|
11
|
+
guard :rubocop, all_on_start: false, cli: '--rails' do
|
12
|
+
watch(%r{.+\.rb$}) { |m| m[0] }
|
13
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
14
|
+
watch(%r{(?:.+/)?\.rubocop_todo\.yml$}) { |m| File.dirname(m[0]) }
|
15
|
+
end
|
13
16
|
end
|
data/README.md
CHANGED
@@ -17,12 +17,13 @@ The Listen gem listens to file modifications and notifies you about the changes.
|
|
17
17
|
* Tested on MRI Ruby environments (1.9+ only) via [Travis CI](https://travis-ci.org/guard/listen),
|
18
18
|
|
19
19
|
Please note that:
|
20
|
+
- Some filesystems won't work without polling (VM/Vagrant Shared folders, NFS, Samba, sshfs, etc.)
|
20
21
|
- Specs suite on JRuby and Rubinius aren't reliable on Travis CI, but should work.
|
21
22
|
- Windows and \*BSD adapter aren't continuously and automaticaly tested.
|
22
23
|
- \*BSD is broken and not supported any more, see: [#220](https://github.com/guard/listen/issues/220)
|
23
24
|
|
24
25
|
|
25
|
-
## Pending features
|
26
|
+
## Pending features / issues
|
26
27
|
|
27
28
|
* ~~Non-recursive directory scanning~~ [#111](https://github.com/guard/listen/issues/111)
|
28
29
|
* Symlinks support. [#25](https://github.com/guard/listen/issues/25)
|
@@ -168,11 +169,12 @@ Also, setting the environment variable `LISTEN_GEM_DEBUGGING=1` does the same as
|
|
168
169
|
## Listen adapters
|
169
170
|
|
170
171
|
The Listen gem has a set of adapters to notify it when there are changes.
|
172
|
+
|
171
173
|
There are 4 OS-specific adapters to support Darwin, Linux, ~~\*BSD~~ and Windows.
|
172
174
|
These adapters are fast as they use some system-calls to implement the notifying function.
|
173
175
|
|
174
|
-
There is also a polling adapter
|
175
|
-
|
176
|
+
There is also a polling adapter - although it's much slower than other adapters,
|
177
|
+
it works on every platform/system and scenario (including network filesystems such as VM shared folders).
|
176
178
|
|
177
179
|
The Darwin and Linux adapters are dependencies of the Listen gem so they work out of the box. For other adapters a specific gem will have to be added to your Gemfile, please read below.
|
178
180
|
|
@@ -182,12 +184,12 @@ while initializing the listener.
|
|
182
184
|
|
183
185
|
### On Windows
|
184
186
|
|
185
|
-
If your are on Windows,
|
187
|
+
If your are on Windows, it's recommended to use the [`wdm`](https://github.com/Maher4Ever/wdm) adapter instead of polling.
|
188
|
+
|
186
189
|
Please add the following to your Gemfile:
|
187
190
|
|
188
191
|
```ruby
|
189
|
-
|
190
|
-
gem 'wdm', '>= 0.1.0' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i
|
192
|
+
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
|
191
193
|
```
|
192
194
|
|
193
195
|
### On \*BSD
|
@@ -195,6 +197,7 @@ gem 'wdm', '>= 0.1.0' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i
|
|
195
197
|
**NOTE: \*BSD currently is BROKEN with no plans to fix it or support it (see: [#220](https://github.com/guard/listen/issues/220))**
|
196
198
|
|
197
199
|
If your are on \*BSD you can try to use the [`rb-kqueue`](https://github.com/mat813/rb-kqueue) instead of polling.
|
200
|
+
|
198
201
|
Please add the following to your Gemfile:
|
199
202
|
|
200
203
|
```ruby
|
@@ -213,29 +216,10 @@ end
|
|
213
216
|
|
214
217
|
### Issues and troubleshooting
|
215
218
|
|
216
|
-
|
217
|
-
|
218
|
-
Here are some things you could try to avoid forcing polling.
|
219
|
-
|
220
|
-
* [Update your Dropbox client](http://www.dropbox.com/downloading), if you have Dropbox installed.
|
221
|
-
* Move or rename the listened directory.
|
222
|
-
* Update/reboot your OS.
|
223
|
-
* Increase latency.
|
224
|
-
* If running Linux, check and see if you need package inotify-tools
|
225
|
-
|
226
|
-
If your application keeps using the polling-adapter and you can't figure out why, feel free to [open an issue](https://github.com/guard/listen/issues/new) (and be sure to [give all the details](https://github.com/guard/listen/blob/master/CONTRIBUTING.md)).
|
227
|
-
|
228
|
-
Also, if you have problems related to receiving the wrong events, too many
|
229
|
-
events or none at all, be sure set the environment variable
|
230
|
-
`LISTEN_GEM_DEBUGGING=1` and include the output when reporting a new issue.
|
219
|
+
*NOTE: without providing the output after setting the `LISTEN_GEM_DEBUGGING=1` environment variable, it can be almost impossible to guess why listen is not working as expected.*
|
231
220
|
|
232
|
-
|
233
|
-
shown with `LISTEN_GEM_DEBUGGING=1`, set `LISTEN_GEM_DEBUGGING=2` for full
|
234
|
-
logging.
|
221
|
+
See [TROUBLESHOOTING](https://github.com/guard/listen/blob/master/TROUBLESHOOTING.md)
|
235
222
|
|
236
|
-
Listen traps SIGINT signal to properly finalize listeners. If you plan
|
237
|
-
on trapping this signal yourself - make sure to call `Listen.stop` in
|
238
|
-
signal handler.
|
239
223
|
|
240
224
|
## Performance
|
241
225
|
|
@@ -250,13 +234,15 @@ Also, if the directories you're watching contain many files, make sure you're:
|
|
250
234
|
* not running multiple instances of Listen in the background
|
251
235
|
* using a file system with atime modification disabled (ideally)
|
252
236
|
* not using a filesystem with inaccurate file modification times (ideally), e.g. HFS, VFAT
|
253
|
-
* running Listen with the latency
|
237
|
+
* running Listen with the `:latency` and `:wait_for_delay` options not too small or too big (depends on needs)
|
238
|
+
* not buffering to a slow terminal (e.g. transparency + fancy font + slow gfx card + lots of output)
|
239
|
+
* ideally not running a slow encryption stack, e.g. btrfs + ecryptfs
|
254
240
|
|
255
241
|
When in doubt, LISTEN_GEM_DEBUGGING=2 can help discover the actual events and time they happened.
|
256
242
|
|
257
243
|
## Forwarding file events over TCP
|
258
244
|
|
259
|
-
Listen is capable of forwarding file events over the network using a messaging protocol. This can be useful for virtualized development environments when file events are unavailable, as is the case with [Vagrant](https://github.com/mitchellh/vagrant).
|
245
|
+
Listen is capable of forwarding file events over the network using a messaging protocol. This can be useful for virtualized development environments when file events are unavailable, as is the case with shared folders in VMs. [Vagrant](https://github.com/mitchellh/vagrant) uses Listen in it's rsync-auto mode to solve this issue.
|
260
246
|
|
261
247
|
To broadcast events over TCP programmatically, use the `forward_to` option with an address - just a port or a hostname/port combination:
|
262
248
|
|