rb-inotify 0.9.5 → 0.9.7

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 CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 21746deefe3056f06e405f69943c4025142ad73c
4
- data.tar.gz: 1c48a71566b8b7e27db5508786b2fd069fedb83f
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MjdkMDg4NDNjNGI0ZWY5ZWU0MGY5ZDlkMDE0NTljYTdjZjhkOWE5NQ==
5
+ data.tar.gz: !binary |-
6
+ NjNiOGM3MzlhZWRiMWM3NzQyMTRjZTFiYzgwNGQyOTFlOTBkOTVlOQ==
5
7
  SHA512:
6
- metadata.gz: 0a535d94104c057f21550c33d14f9400fa1e3e1aa198af4efb8b1ce522f9086a1bccdf47393e0cd23e132c62466b687605150da320be503c69092264d09a35f3
7
- data.tar.gz: 9af00377548db5c8b46be15403dd5e63d9fe5322eda6b6b39160422832d9b4abc1a0c260fea8638e04928fbbb7c477ab0cb7b4846530e23612c0a0998a3cbcd3
8
+ metadata.gz: !binary |-
9
+ OTVjMWMyYjE3ZDc3MmM0NDQ5NDY3MzAyZDNkMTllYTQyMjNjMWFjMzc0NDkz
10
+ Yzg4YjY0ZjdmZDExYTY4MDBmMDNjNjAyYTIzYTAzNTdhMDc0YWVmMTlkNzcy
11
+ NmNmNTYyNWE4YTAwN2Y1NmQ0YjAwZmJjNDQ1MWViYzc4NTdmN2Y=
12
+ data.tar.gz: !binary |-
13
+ M2UwMjc1M2EyZTYyM2FmZDZlYjE2OTYzNzQ3MmUyOGY5MmUyOTc5MDliNGUz
14
+ ZDYxYzdlNzdhNWQ4ZjU0ZjE2NzhiMjc5MzNhMzFkN2E4YTNiMWM3ZjI4OWJk
15
+ YjZlMTQ4ZDBlNGI3ZWRmYTNlMDNhYzFiYzgwMWFiNWVkZmQyMzU=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.5
1
+ 0.9.7
@@ -3,6 +3,7 @@ require 'rb-inotify/native/flags'
3
3
  require 'rb-inotify/notifier'
4
4
  require 'rb-inotify/watcher'
5
5
  require 'rb-inotify/event'
6
+ require 'rb-inotify/errors'
6
7
 
7
8
  # The root module of the library, which is laid out as so:
8
9
  #
@@ -13,5 +14,5 @@ module INotify
13
14
  # An array containing the version number of rb-inotify.
14
15
  # The numbers in the array are the major, minor, and patch versions,
15
16
  # respectively.
16
- VERSION = [0, 9, 5]
17
+ VERSION = [0, 9, 7]
17
18
  end
@@ -0,0 +1,3 @@
1
+ module INotify
2
+ class QueueOverflowError < RuntimeError; end
3
+ end
@@ -117,7 +117,7 @@ module INotify
117
117
  @notifier = notifier
118
118
  @watcher_id = @native[:wd]
119
119
 
120
- raise Exception.new("inotify event queue has overflowed.") if @native[:mask] & Native::Flags::IN_Q_OVERFLOW != 0
120
+ raise QueueOverflowError.new("inotify event queue has overflowed.") if @native[:mask] & Native::Flags::IN_Q_OVERFLOW != 0
121
121
  end
122
122
 
123
123
  # Calls the callback of the watcher that fired this event,
@@ -242,6 +242,7 @@ module INotify
242
242
  #
243
243
  # @raise [SystemCallError] if closing the underlying file descriptor fails.
244
244
  def close
245
+ stop
245
246
  if Native.close(@fd) == 0
246
247
  @watchers.clear
247
248
  return
@@ -255,9 +256,11 @@ module INotify
255
256
  FFI.errno)
256
257
  end
257
258
 
258
- # Blocks until there are one or more filesystem events
259
- # that this notifier has watchers registered for.
260
- # Once there are events, returns their {Event} objects.
259
+ # Blocks until there are one or more filesystem events that this notifier
260
+ # has watchers registered for. Once there are events, returns their {Event}
261
+ # objects.
262
+ #
263
+ # This can return an empty list if the watcher was closed elsewhere.
261
264
  #
262
265
  # {#run} or {#process} are ususally preferable to calling this directly.
263
266
  def read_events
@@ -269,11 +272,12 @@ module INotify
269
272
  rescue SystemCallError => er
270
273
  # EINVAL means that there's more data to be read
271
274
  # than will fit in the buffer size
272
- raise er unless er.errno == Errno::EINVAL::Errno || tries == 5
275
+ raise er unless er.errno == Errno::EINVAL::Errno && tries < 5
273
276
  size *= 2
274
277
  tries += 1
275
278
  retry
276
279
  end
280
+ return [] if data.nil?
277
281
 
278
282
  events = []
279
283
  cookies = {}
@@ -292,7 +296,13 @@ module INotify
292
296
  # Same as IO#readpartial, or as close as we need.
293
297
  def readpartial(size)
294
298
  # Use Ruby's readpartial if possible, to avoid blocking other threads.
295
- return to_io.readpartial(size) if self.class.supports_ruby_io?
299
+ begin
300
+ return to_io.readpartial(size) if self.class.supports_ruby_io?
301
+ rescue Errno::EBADF
302
+ # If the IO has already been closed, reading from it will cause
303
+ # Errno::EBADF.
304
+ return nil
305
+ end
296
306
 
297
307
  tries = 0
298
308
  begin
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: rb-inotify 0.9.7 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "rb-inotify"
8
- s.version = "0.9.5"
9
+ s.version = "0.9.7"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Nathan Weizenbaum"]
12
- s.date = "2014-06-06"
14
+ s.date = "2016-02-08"
13
15
  s.description = "A Ruby wrapper for Linux's inotify, using FFI"
14
16
  s.email = "nex342@gmail.com"
15
17
  s.extra_rdoc_files = [
@@ -22,6 +24,7 @@ Gem::Specification.new do |s|
22
24
  "Rakefile",
23
25
  "VERSION",
24
26
  "lib/rb-inotify.rb",
27
+ "lib/rb-inotify/errors.rb",
25
28
  "lib/rb-inotify/event.rb",
26
29
  "lib/rb-inotify/native.rb",
27
30
  "lib/rb-inotify/native/flags.rb",
@@ -30,8 +33,7 @@ Gem::Specification.new do |s|
30
33
  "rb-inotify.gemspec"
31
34
  ]
32
35
  s.homepage = "http://github.com/nex3/rb-inotify"
33
- s.require_paths = ["lib"]
34
- s.rubygems_version = "2.0.3"
36
+ s.rubygems_version = "2.4.3"
35
37
  s.summary = "A Ruby wrapper for Linux's inotify, using FFI"
36
38
 
37
39
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb-inotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-06 00:00:00.000000000 Z
11
+ date: 2016-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.5.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.5.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: yard
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.4.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.4.0
41
41
  description: A Ruby wrapper for Linux's inotify, using FFI
@@ -51,6 +51,7 @@ files:
51
51
  - Rakefile
52
52
  - VERSION
53
53
  - lib/rb-inotify.rb
54
+ - lib/rb-inotify/errors.rb
54
55
  - lib/rb-inotify/event.rb
55
56
  - lib/rb-inotify/native.rb
56
57
  - lib/rb-inotify/native/flags.rb
@@ -66,17 +67,17 @@ require_paths:
66
67
  - lib
67
68
  required_ruby_version: !ruby/object:Gem::Requirement
68
69
  requirements:
69
- - - '>='
70
+ - - ! '>='
70
71
  - !ruby/object:Gem::Version
71
72
  version: '0'
72
73
  required_rubygems_version: !ruby/object:Gem::Requirement
73
74
  requirements:
74
- - - '>='
75
+ - - ! '>='
75
76
  - !ruby/object:Gem::Version
76
77
  version: '0'
77
78
  requirements: []
78
79
  rubyforge_project:
79
- rubygems_version: 2.0.3
80
+ rubygems_version: 2.4.3
80
81
  signing_key:
81
82
  specification_version: 4
82
83
  summary: A Ruby wrapper for Linux's inotify, using FFI