rb-inotify 0.9.10 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +3 -1
- data/.travis.yml +12 -23
- data/Gemfile +13 -0
- data/LICENSE.md +10 -0
- data/README.md +12 -2
- data/lib/rb-inotify/native.rb +0 -3
- data/lib/rb-inotify/notifier.rb +44 -57
- data/lib/rb-inotify/version.rb +1 -1
- data/rb-inotify.gemspec +10 -12
- data/spec/notifier_spec.rb +180 -0
- data/spec/spec_helper.rb +17 -0
- metadata +34 -32
- data/spec/rb-inotify/errors_spec.rb +0 -9
- /data/spec/{rb-inotify_spec.rb → inotify_spec.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 803cf77fe31e9334147381cbc2fcdc911f5c8c060582af70afb80ba00caa4967
|
4
|
+
data.tar.gz: dc13bce654e7a7c20d17722db4a62d4a091a6f21918e8133702306d90d5e0ccb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b798f26a05bb0757e2bb29c49bdc07b694659c9bfd1a007be3fec48acbfccb59c049bbf17881c739f80f66fc63b03df15fb70574aaae73ce2f457667e726eec
|
7
|
+
data.tar.gz: c29ccd96375401b43d52ca09345ab235e11b044706ef4995525372961b126d4b845ac468c422c40dd77eec36995ac19855dccab85706a6458f34505bec5ac02b
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,30 +1,19 @@
|
|
1
1
|
language: ruby
|
2
|
-
sudo: false
|
3
|
-
dist: trusty
|
4
2
|
cache: bundler
|
5
|
-
|
6
|
-
- 1.8
|
7
|
-
- 1.9
|
8
|
-
- 2.0
|
9
|
-
- 2.1
|
10
|
-
- 2.2
|
11
|
-
- 2.3
|
12
|
-
- 2.4
|
13
|
-
- jruby-head
|
14
|
-
- ruby-head
|
15
|
-
- jruby-9.1.8.0
|
16
|
-
- jruby-head
|
17
|
-
- rbx-3
|
3
|
+
|
18
4
|
matrix:
|
5
|
+
include:
|
6
|
+
- rvm: 2.3
|
7
|
+
- rvm: 2.4
|
8
|
+
- rvm: 2.5
|
9
|
+
- rvm: 2.6
|
10
|
+
- rvm: jruby
|
11
|
+
- rvm: truffleruby
|
12
|
+
- rvm: jruby-head
|
13
|
+
- rvm: ruby-head
|
19
14
|
allow_failures:
|
15
|
+
- rvm: truffleruby
|
16
|
+
- rvm: jruby
|
20
17
|
- rvm: ruby-head
|
21
18
|
- rvm: jruby-head
|
22
|
-
- rvm: rbx-3
|
23
19
|
fast_finish: true
|
24
|
-
script:
|
25
|
-
# Unit test
|
26
|
-
- bundle exec rake
|
27
|
-
# Install test
|
28
|
-
- gem build rb-inotify.gemspec
|
29
|
-
- gem install rb-inotify-*.gem
|
30
|
-
- sh -c "gem list | grep rb-inotify"
|
data/Gemfile
CHANGED
@@ -1,3 +1,16 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
+
# Specify your gem's dependencies in utopia.gemspec
|
3
4
|
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem 'pry'
|
8
|
+
gem 'pry-coolline'
|
9
|
+
|
10
|
+
gem 'tty-prompt'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :test do
|
14
|
+
gem 'simplecov'
|
15
|
+
gem 'coveralls', require: false
|
16
|
+
end
|
data/LICENSE.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# The MIT License
|
2
|
+
|
3
|
+
Copyright, 2009, by [Natalie Weizenbaum](https://github.com/nex3).
|
4
|
+
Copyright, 2017, by [Samuel G. D. Williams](http://www.codeotaku.com).
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
|
+
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
9
|
+
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ It uses the [FFI](http://wiki.github.com/ffi/ffi) gem to avoid having to compile
|
|
10
10
|
[![Code Climate](https://codeclimate.com/github/guard/rb-inotify.svg)](https://codeclimate.com/github/guard/rb-inotify)
|
11
11
|
[![Coverage Status](https://coveralls.io/repos/guard/rb-inotify/badge.svg)](https://coveralls.io/r/guard/rb-inotify)
|
12
12
|
|
13
|
-
##
|
13
|
+
## Usage
|
14
14
|
|
15
15
|
The API is similar to the inotify C API, but with a more Rubyish feel.
|
16
16
|
First, create a notifier:
|
@@ -69,6 +69,16 @@ Unfortunately, this currently doesn't work under JRuby.
|
|
69
69
|
JRuby currently doesn't use native file descriptors for the IO object,
|
70
70
|
so we can't use the notifier's file descriptor as a stand-in.
|
71
71
|
|
72
|
+
### Resource Limits
|
73
|
+
|
74
|
+
If you get an error like `inotify event queue has overflowed` you might be running into system limits. You can add the following to your `/etc/sysctl.conf` to increase the number of files that can be monitored:
|
75
|
+
|
76
|
+
```
|
77
|
+
fs.inotify.max_user_watches = 100000
|
78
|
+
fs.inotify.max_queued_events = 100000
|
79
|
+
fs.inotify.max_user_instances = 100000
|
80
|
+
```
|
81
|
+
|
72
82
|
## Contributing
|
73
83
|
|
74
84
|
1. Fork it
|
@@ -81,7 +91,7 @@ so we can't use the notifier's file descriptor as a stand-in.
|
|
81
91
|
|
82
92
|
Released under the MIT license.
|
83
93
|
|
84
|
-
Copyright, 2009, by
|
94
|
+
Copyright, 2009, by [Natalie Weizenbaum](https://github.com/nex3).
|
85
95
|
Copyright, 2017, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
86
96
|
|
87
97
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
data/lib/rb-inotify/native.rb
CHANGED
@@ -29,8 +29,5 @@ module INotify
|
|
29
29
|
attach_function :inotify_add_watch, [:int, :string, :uint32], :int
|
30
30
|
attach_function :inotify_rm_watch, [:int, :uint32], :int
|
31
31
|
attach_function :fpathconf, [:int, :int], :long
|
32
|
-
|
33
|
-
attach_function :read, [:int, :pointer, :size_t], :ssize_t
|
34
|
-
attach_function :close, [:int], :int
|
35
32
|
end
|
36
33
|
end
|
data/lib/rb-inotify/notifier.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'thread'
|
2
|
+
|
1
3
|
module INotify
|
2
4
|
# Notifier wraps a single instance of inotify.
|
3
5
|
# It's possible to have more than one instance,
|
@@ -38,12 +40,8 @@ module INotify
|
|
38
40
|
# (except under JRuby -- see \{#to\_io}).
|
39
41
|
#
|
40
42
|
# @return [Fixnum]
|
41
|
-
|
42
|
-
|
43
|
-
# @return [Boolean] Whether or not this Ruby implementation supports
|
44
|
-
# wrapping the native file descriptor in a Ruby IO wrapper.
|
45
|
-
def self.supports_ruby_io?
|
46
|
-
RUBY_PLATFORM !~ /java/
|
43
|
+
def fd
|
44
|
+
@handle.fileno
|
47
45
|
end
|
48
46
|
|
49
47
|
# Creates a new {Notifier}.
|
@@ -51,9 +49,22 @@ module INotify
|
|
51
49
|
# @return [Notifier]
|
52
50
|
# @raise [SystemCallError] if inotify failed to initialize for some reason
|
53
51
|
def initialize
|
54
|
-
@
|
52
|
+
@running = Mutex.new
|
53
|
+
@pipe = IO.pipe
|
54
|
+
# JRuby shutdown sometimes runs IO finalizers before all threads finish.
|
55
|
+
if RUBY_ENGINE == 'jruby'
|
56
|
+
@pipe[0].autoclose = false
|
57
|
+
@pipe[1].autoclose = false
|
58
|
+
end
|
59
|
+
|
55
60
|
@watchers = {}
|
56
|
-
|
61
|
+
|
62
|
+
fd = Native.inotify_init
|
63
|
+
unless fd < 0
|
64
|
+
@handle = IO.new(fd)
|
65
|
+
@handle.autoclose = false if RUBY_ENGINE == 'jruby'
|
66
|
+
return
|
67
|
+
end
|
57
68
|
|
58
69
|
raise SystemCallError.new(
|
59
70
|
"Failed to initialize inotify" +
|
@@ -82,10 +93,7 @@ module INotify
|
|
82
93
|
# @return [IO] An IO object wrapping the file descriptor
|
83
94
|
# @raise [NotImplementedError] if this is being called in JRuby
|
84
95
|
def to_io
|
85
|
-
|
86
|
-
raise NotImplementedError.new("INotify::Notifier#to_io is not supported under JRuby")
|
87
|
-
end
|
88
|
-
@io ||= IO.new(@fd)
|
96
|
+
@handle
|
89
97
|
end
|
90
98
|
|
91
99
|
# Watches a file or directory for changes,
|
@@ -221,8 +229,14 @@ module INotify
|
|
221
229
|
#
|
222
230
|
# @see #process
|
223
231
|
def run
|
224
|
-
@
|
225
|
-
|
232
|
+
@running.synchronize do
|
233
|
+
Thread.current[:INOTIFY_RUN_THREAD] = true
|
234
|
+
@stop = false
|
235
|
+
|
236
|
+
process until @stop
|
237
|
+
end
|
238
|
+
ensure
|
239
|
+
Thread.current[:INOTIFY_RUN_THREAD] = false
|
226
240
|
end
|
227
241
|
|
228
242
|
# Stop watching for filesystem events.
|
@@ -230,6 +244,13 @@ module INotify
|
|
230
244
|
# exit out as soon as we finish handling the events.
|
231
245
|
def stop
|
232
246
|
@stop = true
|
247
|
+
@pipe.last.write "."
|
248
|
+
|
249
|
+
unless Thread.current[:INOTIFY_RUN_THREAD]
|
250
|
+
@running.synchronize do
|
251
|
+
# no-op: we just needed to wait until the lock was available
|
252
|
+
end
|
253
|
+
end
|
233
254
|
end
|
234
255
|
|
235
256
|
# Blocks until there are one or more filesystem events
|
@@ -250,17 +271,8 @@ module INotify
|
|
250
271
|
# @raise [SystemCallError] if closing the underlying file descriptor fails.
|
251
272
|
def close
|
252
273
|
stop
|
253
|
-
|
254
|
-
|
255
|
-
return
|
256
|
-
end
|
257
|
-
|
258
|
-
raise SystemCallError.new("Failed to properly close inotify socket" +
|
259
|
-
case FFI.errno
|
260
|
-
when Errno::EBADF::Errno; ": invalid or closed file descriptior"
|
261
|
-
when Errno::EIO::Errno; ": an I/O error occured"
|
262
|
-
end,
|
263
|
-
FFI.errno)
|
274
|
+
@handle.close
|
275
|
+
@watchers.clear
|
264
276
|
end
|
265
277
|
|
266
278
|
# Blocks until there are one or more filesystem events that this notifier
|
@@ -302,38 +314,13 @@ module INotify
|
|
302
314
|
|
303
315
|
# Same as IO#readpartial, or as close as we need.
|
304
316
|
def readpartial(size)
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
return nil
|
313
|
-
rescue IOError => ex
|
314
|
-
return nil if ex.message =~ /stream closed/
|
315
|
-
raise
|
316
|
-
end
|
317
|
-
|
318
|
-
tries = 0
|
319
|
-
begin
|
320
|
-
tries += 1
|
321
|
-
buffer = FFI::MemoryPointer.new(:char, size)
|
322
|
-
size_read = Native.read(fd, buffer, size)
|
323
|
-
return buffer.read_string(size_read) if size_read >= 0
|
324
|
-
end while FFI.errno == Errno::EINTR::Errno && tries <= 5
|
325
|
-
|
326
|
-
raise SystemCallError.new("Error reading inotify events" +
|
327
|
-
case FFI.errno
|
328
|
-
when Errno::EAGAIN::Errno; ": no data available for non-blocking I/O"
|
329
|
-
when Errno::EBADF::Errno; ": invalid or closed file descriptor"
|
330
|
-
when Errno::EFAULT::Errno; ": invalid buffer"
|
331
|
-
when Errno::EINVAL::Errno; ": invalid file descriptor"
|
332
|
-
when Errno::EIO::Errno; ": I/O error"
|
333
|
-
when Errno::EISDIR::Errno; ": file descriptor is a directory"
|
334
|
-
else; ""
|
335
|
-
end,
|
336
|
-
FFI.errno)
|
317
|
+
readable, = select([@handle, @pipe.first])
|
318
|
+
return nil if readable.include?(@pipe.first)
|
319
|
+
@handle.readpartial(size)
|
320
|
+
rescue Errno::EBADF
|
321
|
+
# If the IO has already been closed, reading from it will cause
|
322
|
+
# Errno::EBADF.
|
323
|
+
nil
|
337
324
|
end
|
338
325
|
end
|
339
326
|
end
|
data/lib/rb-inotify/version.rb
CHANGED
data/rb-inotify.gemspec
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
4
|
-
require 'rb-inotify/version'
|
2
|
+
require_relative 'lib/rb-inotify/version'
|
5
3
|
|
6
4
|
Gem::Specification.new do |spec|
|
7
5
|
spec.name = 'rb-inotify'
|
@@ -18,13 +16,13 @@ Gem::Specification.new do |spec|
|
|
18
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
18
|
spec.require_paths = ["lib"]
|
21
|
-
|
22
|
-
spec.required_ruby_version = '>=
|
23
|
-
|
24
|
-
spec.add_dependency
|
25
|
-
|
26
|
-
spec.add_development_dependency "rspec", "~> 3.
|
27
|
-
spec.add_development_dependency "bundler"
|
28
|
-
|
29
|
-
spec.add_development_dependency "
|
19
|
+
|
20
|
+
spec.required_ruby_version = '>= 2.2'
|
21
|
+
|
22
|
+
spec.add_dependency "ffi", "~> 1.0"
|
23
|
+
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.6"
|
25
|
+
spec.add_development_dependency "bundler"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "concurrent-ruby"
|
30
28
|
end
|
@@ -0,0 +1,180 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'tmpdir'
|
3
|
+
require 'concurrent'
|
4
|
+
|
5
|
+
describe INotify::Notifier do
|
6
|
+
describe "instance" do
|
7
|
+
around do |block|
|
8
|
+
Dir.mktmpdir do |dir|
|
9
|
+
@root = Pathname.new(dir)
|
10
|
+
@notifier = INotify::Notifier.new
|
11
|
+
|
12
|
+
begin
|
13
|
+
block.call
|
14
|
+
ensure
|
15
|
+
@notifier.close
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
let(:dir) do
|
21
|
+
@root.join("foo").tap(&:mkdir)
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:another_dir) do
|
25
|
+
@root.join("bar").tap(&:mkdir)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "stops" do
|
29
|
+
@notifier.stop
|
30
|
+
end
|
31
|
+
|
32
|
+
describe :process do
|
33
|
+
it "gets events" do
|
34
|
+
events = recording(dir, :create)
|
35
|
+
dir.join("test.txt").write("hello world")
|
36
|
+
|
37
|
+
@notifier.process
|
38
|
+
|
39
|
+
expect(events.size).to eq(1)
|
40
|
+
expect(events.first.name).to eq("test.txt")
|
41
|
+
expect(events.first.absolute_name).to eq(dir.join("test.txt").to_s)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "gets simultaneous events" do
|
45
|
+
events = recording(dir, :create)
|
46
|
+
|
47
|
+
dir.join("one.txt").write("hello world")
|
48
|
+
dir.join("two.txt").write("hello world")
|
49
|
+
|
50
|
+
@notifier.process
|
51
|
+
|
52
|
+
expect(events.map(&:name)).to match_array(%w(one.txt two.txt))
|
53
|
+
end
|
54
|
+
|
55
|
+
it "separates events between watches" do
|
56
|
+
bar_events = nil
|
57
|
+
|
58
|
+
foo_events = recording(dir, :create)
|
59
|
+
bar_events = recording(another_dir, :create)
|
60
|
+
|
61
|
+
dir.join("test.txt").write("hello world")
|
62
|
+
another_dir.join("test_two.txt").write("hello world")
|
63
|
+
|
64
|
+
@notifier.process
|
65
|
+
|
66
|
+
expect(foo_events.size).to eq(1)
|
67
|
+
expect(foo_events.first.name).to eq("test.txt")
|
68
|
+
expect(foo_events.first.absolute_name).to eq(dir.join("test.txt").to_s)
|
69
|
+
|
70
|
+
expect(bar_events.size).to eq(1)
|
71
|
+
expect(bar_events.first.name).to eq("test_two.txt")
|
72
|
+
expect(bar_events.first.absolute_name).to eq(another_dir.join("test_two.txt").to_s)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe :run do
|
77
|
+
it "processes repeatedly until stopped" do
|
78
|
+
barriers = Array.new(3) { Concurrent::Event.new }
|
79
|
+
barrier_queue = barriers.dup
|
80
|
+
events = recording(dir, :create) { barrier_queue.shift.set }
|
81
|
+
|
82
|
+
run_thread = Thread.new { @notifier.run }
|
83
|
+
|
84
|
+
dir.join("one.txt").write("hello world")
|
85
|
+
barriers.shift.wait(1) or raise "timeout"
|
86
|
+
|
87
|
+
expect(events.map(&:name)).to match_array(%w(one.txt))
|
88
|
+
|
89
|
+
dir.join("two.txt").write("hello world")
|
90
|
+
barriers.shift.wait(1) or raise "timeout"
|
91
|
+
|
92
|
+
expect(events.map(&:name)).to match_array(%w(one.txt two.txt))
|
93
|
+
|
94
|
+
@notifier.stop
|
95
|
+
|
96
|
+
dir.join("three.txt").write("hello world")
|
97
|
+
barriers.shift.wait(1)
|
98
|
+
|
99
|
+
dir.join("four.txt").write("hello world")
|
100
|
+
run_thread.join
|
101
|
+
|
102
|
+
expect(events.map(&:name)).to match_array(%w(one.txt two.txt))
|
103
|
+
end
|
104
|
+
|
105
|
+
it "can be stopped from within a callback" do
|
106
|
+
barriers = Array.new(3) { Concurrent::Event.new }
|
107
|
+
barrier_queue = barriers.dup
|
108
|
+
events = recording(dir, :create) { @notifier.stop }
|
109
|
+
|
110
|
+
run_thread = Thread.new { @notifier.run }
|
111
|
+
dir.join("one.txt").write("hello world")
|
112
|
+
run_thread.join
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe :fd do
|
117
|
+
it "returns an integer" do
|
118
|
+
expect(@notifier.fd).to be_an(Integer)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe :to_io do
|
123
|
+
it "returns a ruby IO" do
|
124
|
+
expect(@notifier.to_io).to be_an(::IO)
|
125
|
+
end
|
126
|
+
|
127
|
+
it "matches the fd" do
|
128
|
+
expect(@notifier.to_io.fileno).to eq(@notifier.fd)
|
129
|
+
end
|
130
|
+
|
131
|
+
it "caches its result" do
|
132
|
+
expect(@notifier.to_io).to be(@notifier.to_io)
|
133
|
+
end
|
134
|
+
|
135
|
+
it "is selectable" do
|
136
|
+
events = recording(dir, :create)
|
137
|
+
expect(select([@notifier.to_io], nil, nil, 0.2)).to be_nil
|
138
|
+
|
139
|
+
dir.join("test.txt").write("hello world")
|
140
|
+
expect(select([@notifier.to_io], nil, nil, 0.2)).to eq([[@notifier.to_io], [], []])
|
141
|
+
|
142
|
+
@notifier.process
|
143
|
+
expect(select([@notifier.to_io], nil, nil, 0.2)).to be_nil
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
private
|
148
|
+
|
149
|
+
def recording(dir, *flags, callback: nil)
|
150
|
+
events = []
|
151
|
+
@notifier.watch(dir.to_s, *flags) do |event|
|
152
|
+
events << event
|
153
|
+
yield if block_given?
|
154
|
+
end
|
155
|
+
|
156
|
+
events
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
describe "mixed instances" do
|
161
|
+
it "doesn't tangle fds" do
|
162
|
+
notifiers = Array.new(30) { INotify::Notifier.new }
|
163
|
+
notifiers.each(&:to_io)
|
164
|
+
|
165
|
+
one = Array.new(10) { IO.pipe.last }
|
166
|
+
notifiers.each(&:close)
|
167
|
+
|
168
|
+
two = Array.new(10) { IO.pipe.last }
|
169
|
+
|
170
|
+
notifiers = nil
|
171
|
+
GC.start
|
172
|
+
|
173
|
+
_, writable, _ = select(nil, one, nil, 1)
|
174
|
+
expect(writable).to match_array(one)
|
175
|
+
|
176
|
+
_, writable, _ = select(nil, two, nil, 1)
|
177
|
+
expect(writable).to match_array(two)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,21 @@
|
|
1
1
|
|
2
|
+
if ENV['COVERAGE'] || ENV['TRAVIS']
|
3
|
+
begin
|
4
|
+
require 'simplecov'
|
5
|
+
|
6
|
+
SimpleCov.start do
|
7
|
+
add_filter "/spec/"
|
8
|
+
end
|
9
|
+
|
10
|
+
if ENV['TRAVIS']
|
11
|
+
require 'coveralls'
|
12
|
+
Coveralls.wear!
|
13
|
+
end
|
14
|
+
rescue LoadError
|
15
|
+
warn "Could not load simplecov: #{$!}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
2
19
|
require "bundler/setup"
|
3
20
|
require "rb-inotify"
|
4
21
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rb-inotify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Natalie Weizenbaum
|
@@ -9,76 +9,78 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 0.5.0
|
21
|
-
- - "<"
|
18
|
+
- - "~>"
|
22
19
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
20
|
+
version: '1.0'
|
24
21
|
type: :runtime
|
25
22
|
prerelease: false
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
27
24
|
requirements:
|
28
|
-
- - "
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: 0.5.0
|
31
|
-
- - "<"
|
25
|
+
- - "~>"
|
32
26
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
27
|
+
version: '1.0'
|
34
28
|
- !ruby/object:Gem::Dependency
|
35
29
|
name: rspec
|
36
30
|
requirement: !ruby/object:Gem::Requirement
|
37
31
|
requirements:
|
38
32
|
- - "~>"
|
39
33
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3.
|
34
|
+
version: '3.6'
|
41
35
|
type: :development
|
42
36
|
prerelease: false
|
43
37
|
version_requirements: !ruby/object:Gem::Requirement
|
44
38
|
requirements:
|
45
39
|
- - "~>"
|
46
40
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
41
|
+
version: '3.6'
|
48
42
|
- !ruby/object:Gem::Dependency
|
49
43
|
name: bundler
|
50
44
|
requirement: !ruby/object:Gem::Requirement
|
51
45
|
requirements:
|
52
|
-
- - "
|
46
|
+
- - ">="
|
53
47
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
48
|
+
version: '0'
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
52
|
requirements:
|
59
|
-
- - "
|
53
|
+
- - ">="
|
60
54
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
55
|
+
version: '0'
|
62
56
|
- !ruby/object:Gem::Dependency
|
63
57
|
name: rake
|
64
58
|
requirement: !ruby/object:Gem::Requirement
|
65
59
|
requirements:
|
66
60
|
- - ">="
|
67
61
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
69
|
-
- - "<"
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: '13'
|
62
|
+
version: '0'
|
72
63
|
type: :development
|
73
64
|
prerelease: false
|
74
65
|
version_requirements: !ruby/object:Gem::Requirement
|
75
66
|
requirements:
|
76
67
|
- - ">="
|
77
68
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
79
|
-
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: concurrent-ruby
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
80
75
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
82
84
|
description:
|
83
85
|
email:
|
84
86
|
- nex342@gmail.com
|
@@ -91,6 +93,7 @@ files:
|
|
91
93
|
- ".travis.yml"
|
92
94
|
- ".yardopts"
|
93
95
|
- Gemfile
|
96
|
+
- LICENSE.md
|
94
97
|
- README.md
|
95
98
|
- Rakefile
|
96
99
|
- lib/rb-inotify.rb
|
@@ -102,8 +105,8 @@ files:
|
|
102
105
|
- lib/rb-inotify/version.rb
|
103
106
|
- lib/rb-inotify/watcher.rb
|
104
107
|
- rb-inotify.gemspec
|
105
|
-
- spec/
|
106
|
-
- spec/
|
108
|
+
- spec/inotify_spec.rb
|
109
|
+
- spec/notifier_spec.rb
|
107
110
|
- spec/spec_helper.rb
|
108
111
|
homepage: https://github.com/guard/rb-inotify
|
109
112
|
licenses:
|
@@ -117,19 +120,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
120
|
requirements:
|
118
121
|
- - ">="
|
119
122
|
- !ruby/object:Gem::Version
|
120
|
-
version: '
|
123
|
+
version: '2.2'
|
121
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
125
|
requirements:
|
123
126
|
- - ">="
|
124
127
|
- !ruby/object:Gem::Version
|
125
128
|
version: '0'
|
126
129
|
requirements: []
|
127
|
-
|
128
|
-
rubygems_version: 2.6.10
|
130
|
+
rubygems_version: 3.0.4
|
129
131
|
signing_key:
|
130
132
|
specification_version: 4
|
131
133
|
summary: A Ruby wrapper for Linux inotify, using FFI
|
132
134
|
test_files:
|
133
|
-
- spec/
|
134
|
-
- spec/
|
135
|
+
- spec/inotify_spec.rb
|
136
|
+
- spec/notifier_spec.rb
|
135
137
|
- spec/spec_helper.rb
|
File without changes
|