listen 2.8.4 → 2.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -11
  3. data/lib/listen/adapter/base.rb +8 -4
  4. data/lib/listen/adapter/bsd.rb +8 -25
  5. data/lib/listen/adapter/tcp.rb +2 -1
  6. data/lib/listen/internals/logging.rb +12 -8
  7. data/lib/listen/listener.rb +1 -1
  8. data/lib/listen/version.rb +1 -1
  9. metadata +4 -121
  10. data/.gitignore +0 -28
  11. data/.hound.yml +0 -3
  12. data/.rspec +0 -2
  13. data/.rubocop.yml +0 -20
  14. data/.rubocop_todo.yml +0 -33
  15. data/.travis.yml +0 -15
  16. data/.yardopts +0 -11
  17. data/Gemfile +0 -48
  18. data/Guardfile +0 -16
  19. data/Rakefile +0 -151
  20. data/TROUBLESHOOTING.md +0 -139
  21. data/listen.gemspec +0 -33
  22. data/spec/acceptance/listen_spec.rb +0 -230
  23. data/spec/acceptance/tcp_spec.rb +0 -139
  24. data/spec/lib/listen/adapter/base_spec.rb +0 -31
  25. data/spec/lib/listen/adapter/bsd_spec.rb +0 -14
  26. data/spec/lib/listen/adapter/darwin_spec.rb +0 -145
  27. data/spec/lib/listen/adapter/linux_spec.rb +0 -93
  28. data/spec/lib/listen/adapter/polling_spec.rb +0 -48
  29. data/spec/lib/listen/adapter/tcp_spec.rb +0 -129
  30. data/spec/lib/listen/adapter/windows_spec.rb +0 -14
  31. data/spec/lib/listen/adapter_spec.rb +0 -75
  32. data/spec/lib/listen/change_spec.rb +0 -104
  33. data/spec/lib/listen/directory_spec.rb +0 -180
  34. data/spec/lib/listen/file_spec.rb +0 -252
  35. data/spec/lib/listen/listener_spec.rb +0 -482
  36. data/spec/lib/listen/record_spec.rb +0 -377
  37. data/spec/lib/listen/silencer_spec.rb +0 -100
  38. data/spec/lib/listen/tcp/broadcaster_spec.rb +0 -124
  39. data/spec/lib/listen/tcp/listener_spec.rb +0 -104
  40. data/spec/lib/listen/tcp/message_spec.rb +0 -138
  41. data/spec/lib/listen_spec.rb +0 -52
  42. data/spec/spec_helper.rb +0 -52
  43. data/spec/support/acceptance_helper.rb +0 -275
  44. data/spec/support/fixtures_helper.rb +0 -30
  45. data/spec/support/platform_helper.rb +0 -15
  46. data/vendor/hound/config/style_guides/ruby.yml +0 -259
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12793c4773ab97a1c6dae6b24118a9dd6cdb65c5
4
- data.tar.gz: 40934da6856ee4f074b7487bbf9b733d7c352c71
3
+ metadata.gz: 518edf112bf9fef9d8d244170676f6fd9777ee1a
4
+ data.tar.gz: 9c41a94f5b5fd71820f5e3beec8e2dfa6613daf6
5
5
  SHA512:
6
- metadata.gz: df21cae8514eecb194d12f3a01adb142bbc60bd8548b41821292c951607b54d73ff36b8b9590978afabbcfb0fe17f9e2d0155727cbfc8923eba7a65c177b8237
7
- data.tar.gz: b10c7d7068c590686d3d2081960b2145484b9aea2ef4143b5b73df2a0bd37bdf0a403ea764963446af44a63e01b3e82de74a341df2c3123c711253829db36712
6
+ metadata.gz: 28e6b2b78fb6749fdc5345ee3cd9a92ba5ae30dfecdbe077941e360c4d4222007ea04f1e7ad4cfd3635f2c0093dfc624aa0736fe225312cfb3387498ce740947
7
+ data.tar.gz: f97fc0da2b8c2ce16af3ed209ba0cadda2546ed632e90d4e917d96e5738cdf561de8ad12ac31e894a903083b2d1d42fa275bd374b948fa6a527ea19f947d5ad2
data/README.md CHANGED
@@ -16,7 +16,7 @@ Make sure you know these few basic tricks: https://github.com/guard/listen/wiki/
16
16
 
17
17
  ## Features
18
18
 
19
- * OS-optimized adapters on MRI for Mac OS X 10.6+, Linux, ~~\*BSD~~ and Windows, [more info](#listen-adapters) below.
19
+ * OS-optimized adapters on MRI for Mac OS X 10.6+, Linux, \*BSD and Windows, [more info](#listen-adapters) below.
20
20
  * Detects file modification, addition and removal.
21
21
  * You can watch multiple directories.
22
22
  * Regexp-patterns for ignoring paths for more accuracy and speed
@@ -28,7 +28,6 @@ Please note that:
28
28
  - Some filesystems won't work without polling (VM/Vagrant Shared folders, NFS, Samba, sshfs, etc.)
29
29
  - Specs suite on JRuby and Rubinius aren't reliable on Travis CI, but should work.
30
30
  - Windows and \*BSD adapter aren't continuously and automaticaly tested.
31
- - \*BSD is broken and not supported any more, see: [#220](https://github.com/guard/listen/issues/220)
32
31
 
33
32
  ## Pending features / issues
34
33
 
@@ -178,7 +177,7 @@ Also, setting the environment variable `LISTEN_GEM_DEBUGGING=1` does the same as
178
177
 
179
178
  The Listen gem has a set of adapters to notify it when there are changes.
180
179
 
181
- There are 4 OS-specific adapters to support Darwin, Linux, ~~\*BSD~~ and Windows.
180
+ There are 4 OS-specific adapters to support Darwin, Linux, \*BSD and Windows.
182
181
  These adapters are fast as they use some system-calls to implement the notifying function.
183
182
 
184
183
  There is also a polling adapter - although it's much slower than other adapters,
@@ -202,22 +201,14 @@ gem 'wdm', '>= 0.1.0' if Gem.win_platform?
202
201
 
203
202
  ### On \*BSD
204
203
 
205
- **NOTE: \*BSD currently is BROKEN with no plans to fix it or support it (see: [#220](https://github.com/guard/listen/issues/220))**
206
-
207
204
  If your are on \*BSD you can try to use the [`rb-kqueue`](https://github.com/mat813/rb-kqueue) instead of polling.
208
205
 
209
206
  Please add the following to your Gemfile:
210
207
 
211
208
  ```ruby
212
209
  require 'rbconfig'
213
- gem 'rb-kqueue', '>= 0.2'
214
210
  if RbConfig::CONFIG['target_os'] =~ /bsd|dragonfly/i
215
211
  gem 'rb-kqueue', '>= 0.2'
216
-
217
- # Base versions have known conflicts/bugs
218
- # Even master branches may not work...
219
- gem 'ffi', github: 'carpetsmoker/ffi', ref: 'ac63e07f7'
220
- gem 'celluloid', github: 'celluloid/celluloid', ref: '7fdef04'
221
212
  end
222
213
 
223
214
  ```
@@ -79,16 +79,20 @@ module Listen
79
79
  @mq.send(:_queue_raw_change, type, dir, rel_path, options)
80
80
  end
81
81
 
82
- def _log(*args)
83
- self.class.send(:_log, *args)
82
+ def _log(*args, &block)
83
+ self.class.send(:_log, *args, &block)
84
84
  end
85
85
 
86
86
  def _log_exception(msg)
87
87
  _log :error, format(msg, $ERROR_INFO, $ERROR_POSITION * "\n")
88
88
  end
89
89
 
90
- def self._log(*args)
91
- Celluloid::Logger.send(*args)
90
+ def self._log(*args, &block)
91
+ if block
92
+ Celluloid::Logger.send(*args, block.call)
93
+ else
94
+ Celluloid::Logger.send(*args)
95
+ end
92
96
  end
93
97
  end
94
98
  end
@@ -21,31 +21,13 @@ module Listen
21
21
  BUNDLER_DECLARE_GEM = <<-EOS.gsub(/^ {6}/, '')
22
22
  Please add the following to your Gemfile to avoid polling for changes:
23
23
  require 'rbconfig'
24
- if RbConfig::CONFIG['target_os'] =~ #{OS_REGEXP}
24
+ if RbConfig::CONFIG['target_os'] =~ /#{OS_REGEXP}/
25
25
  gem 'rb-kqueue', '>= 0.2'
26
-
27
- # Base versions have known conflicts/bugs
28
- # Even master branches may not work...
29
- gem 'ffi', github: 'carpetsmoker/ffi', ref: 'ac63e07f7'
30
- gem 'celluloid', github: 'celluloid/celluloid', ref: '7fdef04'
31
26
  end
32
27
  EOS
33
28
 
34
- BSD_EXPERIMENTAL = <<-EOS.gsub(/^ {6}/, '')
35
- NOTE *BSD SUPPORT IS EXPERIMENTAL!
36
-
37
- In fact, it likely WONT WORK!!!!
38
-
39
- (see: https://github.com/guard/listen/issues/220)
40
-
41
- If you're brave enough, feel free to suggest pull requests and
42
- experiment on your own. For help, browse existing issues marked 'bsd'
43
- for clues, tips and workaround.
44
- EOS
45
-
46
29
  def self.usable?
47
30
  return false unless super
48
- Kernel.warn BSD_EXPERIMENTAL
49
31
  require 'rb-kqueue'
50
32
  require 'find'
51
33
  true
@@ -58,6 +40,7 @@ module Listen
58
40
 
59
41
  def _configure(directory, &_callback)
60
42
  @worker ||= KQueue::Queue.new
43
+ @callback = _callback
61
44
  # use Record to make a snapshot of dir, so we
62
45
  # can detect new files
63
46
  _find(directory.to_s) { |path| _watch_file(path, @worker) }
@@ -73,16 +56,16 @@ module Listen
73
56
  # Force dir content tracking to kick in, or we won't have
74
57
  # names of added files
75
58
  _queue_change(:dir, dir, '.', recursive: true)
76
- else
59
+ elsif full_path.exist?
77
60
  path = full_path.relative_path_from(dir)
78
- _queue_change(:file, dir, path, change: _change(event.flags))
61
+ _queue_change(:file, dir, path.to_s, change: _change(event.flags))
79
62
  end
80
63
 
81
64
  # If it is a directory, and it has a write flag, it means a
82
65
  # file has been added so find out which and deal with it.
83
66
  # No need to check for removed files, kqueue will forget them
84
67
  # when the vfs does.
85
- _watch_for_new_file(event) if path.directory?
68
+ _watch_for_new_file(event) if full_path.directory?
86
69
  end
87
70
 
88
71
  def _change(event_flags)
@@ -109,12 +92,12 @@ module Listen
109
92
  end
110
93
 
111
94
  def _watch_file(path, queue)
112
- queue.watch_file(path, *options.events, &_worker_callback)
95
+ queue.watch_file(path, *options.events, &@callback)
113
96
  end
114
97
 
115
98
  # Quick rubocop workaround
116
- def _find(*paths)
117
- Find.send(:find, *paths)
99
+ def _find(*paths, &block)
100
+ Find.send(:find, *paths, &block)
118
101
  end
119
102
  end
120
103
  end
@@ -75,7 +75,8 @@ module Listen
75
75
  # Handles incoming message by notifying of path changes
76
76
  def handle_message(message)
77
77
  type, change, dir, path, _ = message.object
78
- _log :debug, "TCP message: #{[type, change, dir, path].inspect}"
78
+ _log(:debug) { "TCP message: #{[type, change, dir, path].inspect}" }
79
+
79
80
  _queue_change(type.to_sym, Pathname(dir), path, change: change.to_sym)
80
81
  end
81
82
 
@@ -3,20 +3,24 @@ require 'celluloid/logger'
3
3
  module Listen
4
4
  module Internals
5
5
  module Logging
6
- def _info(*args)
7
- _log(:info, *args)
6
+ def _info(*args, &block)
7
+ _log(:info, *args, &block)
8
8
  end
9
9
 
10
- def _warn(*args)
11
- _log(:warn, *args)
10
+ def _warn(*args, &block)
11
+ _log(:warn, *args, &block)
12
12
  end
13
13
 
14
- def _debug(*args)
15
- _log(:debug, *args)
14
+ def _debug(*args, &block)
15
+ _log(:debug, *args, &block)
16
16
  end
17
17
 
18
- def _log(*args)
19
- Celluloid::Logger.send(*args)
18
+ def _log(*args, &block)
19
+ if block
20
+ Celluloid::Logger.send(*args, block.call)
21
+ else
22
+ Celluloid::Logger.send(*args)
23
+ end
20
24
  end
21
25
 
22
26
  def _format_error(fmt)
@@ -332,7 +332,7 @@ module Listen
332
332
  end
333
333
 
334
334
  def _queue_raw_change(type, dir, rel_path, options)
335
- _debug "raw queue: #{[type, dir, rel_path, options].inspect}"
335
+ _debug { "raw queue: #{[type, dir, rel_path, options].inspect}" }
336
336
 
337
337
  unless (worker = async(:change_pool))
338
338
  _warn 'Failed to allocate worker from change pool'
@@ -1,3 +1,3 @@
1
1
  module Listen
2
- VERSION = '2.8.4'
2
+ VERSION = '2.8.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: listen
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.4
4
+ version: 2.8.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-18 00:00:00.000000000 Z
11
+ date: 2015-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid
@@ -66,62 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.3.5
69
- - !ruby/object:Gem::Dependency
70
- name: celluloid-io
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: 0.15.0
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: 0.15.0
83
- - !ruby/object:Gem::Dependency
84
- name: rake
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rspec
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 3.0.0rc1
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 3.0.0rc1
111
- - !ruby/object:Gem::Dependency
112
- name: rspec-retry
113
- requirement: !ruby/object:Gem::Requirement
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
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
69
  description: The Listen gem listens to file modifications and notifies you about the
126
70
  changes. Works everywhere!
127
71
  email: thibaud@thibaud.gg
@@ -130,21 +74,10 @@ executables:
130
74
  extensions: []
131
75
  extra_rdoc_files: []
132
76
  files:
133
- - ".gitignore"
134
- - ".hound.yml"
135
- - ".rspec"
136
- - ".rubocop.yml"
137
- - ".rubocop_todo.yml"
138
- - ".travis.yml"
139
- - ".yardopts"
140
77
  - CHANGELOG.md
141
78
  - CONTRIBUTING.md
142
- - Gemfile
143
- - Guardfile
144
79
  - LICENSE.txt
145
80
  - README.md
146
- - Rakefile
147
- - TROUBLESHOOTING.md
148
81
  - bin/listen
149
82
  - lib/listen.rb
150
83
  - lib/listen/adapter.rb
@@ -172,32 +105,6 @@ files:
172
105
  - lib/listen/tcp/broadcaster.rb
173
106
  - lib/listen/tcp/message.rb
174
107
  - lib/listen/version.rb
175
- - listen.gemspec
176
- - spec/acceptance/listen_spec.rb
177
- - spec/acceptance/tcp_spec.rb
178
- - spec/lib/listen/adapter/base_spec.rb
179
- - spec/lib/listen/adapter/bsd_spec.rb
180
- - spec/lib/listen/adapter/darwin_spec.rb
181
- - spec/lib/listen/adapter/linux_spec.rb
182
- - spec/lib/listen/adapter/polling_spec.rb
183
- - spec/lib/listen/adapter/tcp_spec.rb
184
- - spec/lib/listen/adapter/windows_spec.rb
185
- - spec/lib/listen/adapter_spec.rb
186
- - spec/lib/listen/change_spec.rb
187
- - spec/lib/listen/directory_spec.rb
188
- - spec/lib/listen/file_spec.rb
189
- - spec/lib/listen/listener_spec.rb
190
- - spec/lib/listen/record_spec.rb
191
- - spec/lib/listen/silencer_spec.rb
192
- - spec/lib/listen/tcp/broadcaster_spec.rb
193
- - spec/lib/listen/tcp/listener_spec.rb
194
- - spec/lib/listen/tcp/message_spec.rb
195
- - spec/lib/listen_spec.rb
196
- - spec/spec_helper.rb
197
- - spec/support/acceptance_helper.rb
198
- - spec/support/fixtures_helper.rb
199
- - spec/support/platform_helper.rb
200
- - vendor/hound/config/style_guides/ruby.yml
201
108
  homepage: https://github.com/guard/listen
202
109
  licenses:
203
110
  - MIT
@@ -218,33 +125,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
125
  version: '0'
219
126
  requirements: []
220
127
  rubyforge_project:
221
- rubygems_version: 2.2.2
128
+ rubygems_version: 2.4.3
222
129
  signing_key:
223
130
  specification_version: 4
224
131
  summary: Listen to file modifications
225
- test_files:
226
- - spec/acceptance/listen_spec.rb
227
- - spec/acceptance/tcp_spec.rb
228
- - spec/lib/listen/adapter/base_spec.rb
229
- - spec/lib/listen/adapter/bsd_spec.rb
230
- - spec/lib/listen/adapter/darwin_spec.rb
231
- - spec/lib/listen/adapter/linux_spec.rb
232
- - spec/lib/listen/adapter/polling_spec.rb
233
- - spec/lib/listen/adapter/tcp_spec.rb
234
- - spec/lib/listen/adapter/windows_spec.rb
235
- - spec/lib/listen/adapter_spec.rb
236
- - spec/lib/listen/change_spec.rb
237
- - spec/lib/listen/directory_spec.rb
238
- - spec/lib/listen/file_spec.rb
239
- - spec/lib/listen/listener_spec.rb
240
- - spec/lib/listen/record_spec.rb
241
- - spec/lib/listen/silencer_spec.rb
242
- - spec/lib/listen/tcp/broadcaster_spec.rb
243
- - spec/lib/listen/tcp/listener_spec.rb
244
- - spec/lib/listen/tcp/message_spec.rb
245
- - spec/lib/listen_spec.rb
246
- - spec/spec_helper.rb
247
- - spec/support/acceptance_helper.rb
248
- - spec/support/fixtures_helper.rb
249
- - spec/support/platform_helper.rb
132
+ test_files: []
250
133
  has_rdoc:
data/.gitignore DELETED
@@ -1,28 +0,0 @@
1
- pkg/*
2
- doc/*
3
- *.gem
4
- *.rbc
5
- .*.swp
6
- *.bak
7
- bundle
8
- .bundle
9
- .yardoc
10
- .rbx
11
- .rvmrc
12
- .vagrant
13
- Gemfile.lock
14
- spec/.fixtures
15
- coverage
16
- .ruby-version
17
- example*
18
- test.txt
19
-
20
- ## MAC OS
21
- .DS_Store
22
- .Trashes
23
- .com.apple.timemachine.supported
24
- .fseventsd
25
- Desktop DB
26
- Desktop DF
27
-
28
- .idea
data/.hound.yml DELETED
@@ -1,3 +0,0 @@
1
- ruby:
2
- enabled: true
3
- config_file: .rubocop.yml
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --format documentation
@@ -1,20 +0,0 @@
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