rb-inotify 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rb-inotify.rb +1 -1
- data/lib/rb-inotify/notifier.rb +14 -5
- data/rb-inotify.gemspec +17 -19
- metadata +39 -16
- data/.gitignore +0 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.2
|
data/lib/rb-inotify.rb
CHANGED
data/lib/rb-inotify/notifier.rb
CHANGED
@@ -22,6 +22,11 @@ module INotify
|
|
22
22
|
# # Nothing happens until you run the notifier!
|
23
23
|
# notifier.run
|
24
24
|
class Notifier
|
25
|
+
# A list of directories that should never be recursively watched.
|
26
|
+
#
|
27
|
+
# * Files in `/dev/fd` sometimes register as directories, but are not enumerable.
|
28
|
+
RECURSIVE_BLACKLIST = %w[/dev/fd]
|
29
|
+
|
25
30
|
# A hash from {Watcher} ids to the instances themselves.
|
26
31
|
#
|
27
32
|
# @private
|
@@ -178,7 +183,7 @@ module INotify
|
|
178
183
|
Dir.entries(path).each do |d|
|
179
184
|
next if d == '.' || d == '..'
|
180
185
|
d = File.join(path, d)
|
181
|
-
watch(d, *flags, &callback) if File.directory?(d)
|
186
|
+
watch(d, *flags, &callback) if !RECURSIVE_BLACKLIST.include?(d) && File.directory?(d)
|
182
187
|
end
|
183
188
|
|
184
189
|
rec_flags = [:create, :moved_to]
|
@@ -229,7 +234,7 @@ module INotify
|
|
229
234
|
rescue SystemCallError => er
|
230
235
|
# EINVAL means that there's more data to be read
|
231
236
|
# than will fit in the buffer size
|
232
|
-
raise er unless er.errno == EINVAL || tries == 5
|
237
|
+
raise er unless er.errno == Errno::EINVAL::Errno || tries == 5
|
233
238
|
size *= 2
|
234
239
|
tries += 1
|
235
240
|
retry
|
@@ -262,9 +267,13 @@ module INotify
|
|
262
267
|
|
263
268
|
# Same as IO#readpartial, or as close as we need.
|
264
269
|
def readpartial(size)
|
265
|
-
|
266
|
-
|
267
|
-
|
270
|
+
tries = 0
|
271
|
+
begin
|
272
|
+
tries += 1
|
273
|
+
buffer = FFI::MemoryPointer.new(:char, size)
|
274
|
+
size_read = Native.read(fd, buffer, size)
|
275
|
+
return buffer.read_string(size_read) if size_read >= 0
|
276
|
+
end while FFI.errno == Errno::EINTR::Errno && tries <= 5
|
268
277
|
|
269
278
|
raise SystemCallError.new("Error reading inotify events" +
|
270
279
|
case FFI.errno
|
data/rb-inotify.gemspec
CHANGED
@@ -1,46 +1,44 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rb-inotify}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nathan Weizenbaum"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-11-15}
|
13
13
|
s.description = %q{A Ruby wrapper for Linux's inotify, using FFI}
|
14
14
|
s.email = %q{nex342@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.md"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
|
-
".
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
"rb-inotify.gemspec"
|
19
|
+
".yardopts",
|
20
|
+
"MIT-LICENSE",
|
21
|
+
"README.md",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"lib/rb-inotify.rb",
|
25
|
+
"lib/rb-inotify/event.rb",
|
26
|
+
"lib/rb-inotify/native.rb",
|
27
|
+
"lib/rb-inotify/native/flags.rb",
|
28
|
+
"lib/rb-inotify/notifier.rb",
|
29
|
+
"lib/rb-inotify/watcher.rb",
|
30
|
+
"rb-inotify.gemspec"
|
32
31
|
]
|
33
32
|
s.homepage = %q{http://github.com/nex3/rb-notify}
|
34
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
35
33
|
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.3.
|
34
|
+
s.rubygems_version = %q{1.3.7}
|
37
35
|
s.summary = %q{A Ruby wrapper for Linux's inotify, using FFI}
|
38
36
|
|
39
37
|
if s.respond_to? :specification_version then
|
40
38
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
41
39
|
s.specification_version = 3
|
42
40
|
|
43
|
-
if Gem::Version.new(Gem::
|
41
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
42
|
s.add_runtime_dependency(%q<ffi>, [">= 0.5.0"])
|
45
43
|
s.add_development_dependency(%q<yard>, [">= 0.4.0"])
|
46
44
|
else
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rb-inotify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 59
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 8
|
9
|
+
- 2
|
10
|
+
version: 0.8.2
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Nathan Weizenbaum
|
@@ -9,29 +15,41 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-11-15 00:00:00 -08:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: ffi
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 11
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 5
|
33
|
+
- 0
|
23
34
|
version: 0.5.0
|
24
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
25
37
|
- !ruby/object:Gem::Dependency
|
26
38
|
name: yard
|
27
|
-
|
28
|
-
|
29
|
-
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
30
42
|
requirements:
|
31
43
|
- - ">="
|
32
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 15
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 4
|
49
|
+
- 0
|
33
50
|
version: 0.4.0
|
34
|
-
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
35
53
|
description: A Ruby wrapper for Linux's inotify, using FFI
|
36
54
|
email: nex342@gmail.com
|
37
55
|
executables: []
|
@@ -41,7 +59,6 @@ extensions: []
|
|
41
59
|
extra_rdoc_files:
|
42
60
|
- README.md
|
43
61
|
files:
|
44
|
-
- .gitignore
|
45
62
|
- .yardopts
|
46
63
|
- MIT-LICENSE
|
47
64
|
- README.md
|
@@ -59,26 +76,32 @@ homepage: http://github.com/nex3/rb-notify
|
|
59
76
|
licenses: []
|
60
77
|
|
61
78
|
post_install_message:
|
62
|
-
rdoc_options:
|
63
|
-
|
79
|
+
rdoc_options: []
|
80
|
+
|
64
81
|
require_paths:
|
65
82
|
- lib
|
66
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
67
85
|
requirements:
|
68
86
|
- - ">="
|
69
87
|
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
89
|
+
segments:
|
90
|
+
- 0
|
70
91
|
version: "0"
|
71
|
-
version:
|
72
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
73
94
|
requirements:
|
74
95
|
- - ">="
|
75
96
|
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
98
|
+
segments:
|
99
|
+
- 0
|
76
100
|
version: "0"
|
77
|
-
version:
|
78
101
|
requirements: []
|
79
102
|
|
80
103
|
rubyforge_project:
|
81
|
-
rubygems_version: 1.3.
|
104
|
+
rubygems_version: 1.3.7
|
82
105
|
signing_key:
|
83
106
|
specification_version: 3
|
84
107
|
summary: A Ruby wrapper for Linux's inotify, using FFI
|
data/.gitignore
DELETED