Hello community,

here is the log from the commit of package rubygem-rb-inotify for 
openSUSE:Factory checked in at 2019-03-04 09:21:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-rb-inotify (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-rb-inotify.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-rb-inotify"

Mon Mar  4 09:21:09 2019 rev:5 rq:679537 version:0.10.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-rb-inotify/rubygem-rb-inotify.changes    
2017-07-10 11:07:00.619464485 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-rb-inotify.new.28833/rubygem-rb-inotify.changes
 2019-03-04 09:21:11.084592241 +0100
@@ -1,0 +2,6 @@
+Wed Dec 19 07:14:42 UTC 2018 - Stephan Kulow <[email protected]>
+
+- updated to version 0.10.0
+  no changelog found
+
+-------------------------------------------------------------------

Old:
----
  rb-inotify-0.9.10.gem

New:
----
  rb-inotify-0.10.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-rb-inotify.spec ++++++
--- /var/tmp/diff_new_pack.177A5n/_old  2019-03-04 09:21:12.312592020 +0100
+++ /var/tmp/diff_new_pack.177A5n/_new  2019-03-04 09:21:12.316592020 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-rb-inotify
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,7 +12,7 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
@@ -24,16 +24,16 @@
 #
 
 Name:           rubygem-rb-inotify
-Version:        0.9.10
+Version:        0.10.0
 Release:        0
 %define mod_name rb-inotify
 %define mod_full_name %{mod_name}-%{version}
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+BuildRequires:  %{ruby >= 2.2}
 BuildRequires:  %{rubygem gem2rpm}
-BuildRequires:  %{ruby}
 BuildRequires:  ruby-macros >= 5
 Url:            https://github.com/guard/rb-inotify
-Source:         http://rubygems.org/gems/%{mod_full_name}.gem
+Source:         https://rubygems.org/gems/%{mod_full_name}.gem
 Source1:        gem2rpm.yml
 Summary:        A Ruby wrapper for Linux inotify, using FFI
 License:        MIT
@@ -48,7 +48,7 @@
 
 %install
 %gem_install \
-  --doc-files="README.md" \
+  --doc-files="LICENSE.md README.md" \
   -f
 
 %gem_packages

++++++ rb-inotify-0.9.10.gem -> rb-inotify-0.10.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore      2017-06-18 01:28:26.000000000 +0200
+++ new/.gitignore      2018-12-16 00:08:21.000000000 +0100
@@ -16,4 +16,6 @@
 test/version_tmp
 tmp
 .tags*
-.rspec_status
\ No newline at end of file
+.rspec_status
+/guard/
+/listen/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml     2017-06-18 01:28:26.000000000 +0200
+++ new/.travis.yml     2018-12-16 00:08:21.000000000 +0100
@@ -1,30 +1,21 @@
 language: ruby
-sudo: false
-dist: trusty
 cache: bundler
-rvm:
-  - 1.8
-  - 1.9
-  - 2.0
-  - 2.1
-  - 2.2
-  - 2.3
-  - 2.4
-  - jruby-head
-  - ruby-head
-  - jruby-9.1.8.0
-  - jruby-head
-  - rbx-3
+
 matrix:
+  include:
+    - rvm: 2.3
+    - rvm: 2.4
+    - rvm: 2.5
+    - rvm: 2.6
+    - rvm: jruby
+    - rvm: truffleruby
+    - rvm: jruby-head
+    - rvm: ruby-head
+    - rvm: rbx-3
   allow_failures:
+    - rvm: truffleruby
+    - rvm: jruby
     - rvm: ruby-head
     - rvm: jruby-head
     - rvm: rbx-3
   fast_finish: true
-script:
-  # Unit test
-  - bundle exec rake
-  # Install test
-  - gem build rb-inotify.gemspec
-  - gem install rb-inotify-*.gem
-  - sh -c "gem list | grep rb-inotify"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Gemfile new/Gemfile
--- old/Gemfile 2017-06-18 01:28:26.000000000 +0200
+++ new/Gemfile 2018-12-16 00:08:21.000000000 +0100
@@ -1,3 +1,16 @@
 source 'https://rubygems.org'
 
+# Specify your gem's dependencies in utopia.gemspec
 gemspec
+
+group :development do
+       gem 'pry'
+       gem 'pry-coolline'
+       
+       gem 'tty-prompt'
+end
+
+group :test do
+       gem 'simplecov'
+       gem 'coveralls', require: false
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/LICENSE.md new/LICENSE.md
--- old/LICENSE.md      1970-01-01 01:00:00.000000000 +0100
+++ new/LICENSE.md      2018-12-16 00:08:21.000000000 +0100
@@ -0,0 +1,10 @@
+# The MIT License (MIT)
+
+Copyright, 2009, by [Natalie Weizenbaum](https://github.com/nex3).
+Copyright, 2017, by [Samuel G. D. 
Williams](http://www.codeotaku.com/samuel-williams).
+
+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:
+
+The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.
+
+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.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2017-06-18 01:28:26.000000000 +0200
+++ new/README.md       2018-12-16 00:08:21.000000000 +0100
@@ -81,7 +81,7 @@
 
 Released under the MIT license.
 
-Copyright, 2009, by Nathan Weizenbaum.  
+Copyright, 2009, by [Natalie Weizenbaum](https://github.com/nex3).
 Copyright, 2017, by [Samuel G. D. 
Williams](http://www.codeotaku.com/samuel-williams).
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rb-inotify/native.rb new/lib/rb-inotify/native.rb
--- old/lib/rb-inotify/native.rb        2017-06-18 01:28:26.000000000 +0200
+++ new/lib/rb-inotify/native.rb        2018-12-16 00:08:21.000000000 +0100
@@ -29,8 +29,5 @@
     attach_function :inotify_add_watch, [:int, :string, :uint32], :int
     attach_function :inotify_rm_watch, [:int, :uint32], :int
     attach_function :fpathconf, [:int, :int], :long
-
-    attach_function :read, [:int, :pointer, :size_t], :ssize_t
-    attach_function :close, [:int], :int
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rb-inotify/notifier.rb 
new/lib/rb-inotify/notifier.rb
--- old/lib/rb-inotify/notifier.rb      2017-06-18 01:28:26.000000000 +0200
+++ new/lib/rb-inotify/notifier.rb      2018-12-16 00:08:21.000000000 +0100
@@ -1,3 +1,5 @@
+require 'thread'
+
 module INotify
   # Notifier wraps a single instance of inotify.
   # It's possible to have more than one instance,
@@ -38,12 +40,8 @@
     # (except under JRuby -- see \{#to\_io}).
     #
     # @return [Fixnum]
-    attr_reader :fd
-
-    # @return [Boolean] Whether or not this Ruby implementation supports
-    #   wrapping the native file descriptor in a Ruby IO wrapper.
-    def self.supports_ruby_io?
-      RUBY_PLATFORM !~ /java/
+    def fd
+      @handle.fileno
     end
 
     # Creates a new {Notifier}.
@@ -51,9 +49,16 @@
     # @return [Notifier]
     # @raise [SystemCallError] if inotify failed to initialize for some reason
     def initialize
-      @fd = Native.inotify_init
+      @running = Mutex.new
+      @pipe = IO.pipe
+
       @watchers = {}
-      return unless @fd < 0
+
+      fd = Native.inotify_init
+      unless fd < 0
+        @handle = IO.new(fd)
+        return
+      end
 
       raise SystemCallError.new(
         "Failed to initialize inotify" +
@@ -82,10 +87,7 @@
     # @return [IO] An IO object wrapping the file descriptor
     # @raise [NotImplementedError] if this is being called in JRuby
     def to_io
-      unless self.class.supports_ruby_io?
-        raise NotImplementedError.new("INotify::Notifier#to_io is not 
supported under JRuby")
-      end
-      @io ||= IO.new(@fd)
+      @handle
     end
 
     # Watches a file or directory for changes,
@@ -221,8 +223,11 @@
     #
     # @see #process
     def run
-      @stop = false
-      process until @stop
+      @running.synchronize do
+        @stop = false
+
+        process until @stop
+      end
     end
 
     # Stop watching for filesystem events.
@@ -230,6 +235,11 @@
     # exit out as soon as we finish handling the events.
     def stop
       @stop = true
+      @pipe.last.write "."
+
+      @running.synchronize do
+        # no-op: we just needed to wait until the lock was available
+      end
     end
 
     # Blocks until there are one or more filesystem events
@@ -250,17 +260,8 @@
     # @raise [SystemCallError] if closing the underlying file descriptor fails.
     def close
       stop
-      if Native.close(@fd) == 0
-        @watchers.clear
-        return
-      end
-
-      raise SystemCallError.new("Failed to properly close inotify socket" +
-       case FFI.errno
-       when Errno::EBADF::Errno; ": invalid or closed file descriptior"
-       when Errno::EIO::Errno; ": an I/O error occured"
-       end,
-       FFI.errno)
+      @handle.close
+      @watchers.clear
     end
 
     # Blocks until there are one or more filesystem events that this notifier
@@ -302,38 +303,13 @@
 
     # Same as IO#readpartial, or as close as we need.
     def readpartial(size)
-      # Use Ruby's readpartial if possible, to avoid blocking other threads.
-      begin
-        return to_io.readpartial(size) if self.class.supports_ruby_io?
-      rescue Errno::EBADF, IOError
-        # If the IO has already been closed, reading from it will cause
-        # Errno::EBADF. In JRuby it can raise IOError with invalid or
-        # closed file descriptor.
-        return nil
-      rescue IOError => ex
-        return nil if ex.message =~ /stream closed/
-        raise
-      end
-
-      tries = 0
-      begin
-        tries += 1
-        buffer = FFI::MemoryPointer.new(:char, size)
-        size_read = Native.read(fd, buffer, size)
-        return buffer.read_string(size_read) if size_read >= 0
-      end while FFI.errno == Errno::EINTR::Errno && tries <= 5
-
-      raise SystemCallError.new("Error reading inotify events" +
-        case FFI.errno
-        when Errno::EAGAIN::Errno; ": no data available for non-blocking I/O"
-        when Errno::EBADF::Errno; ": invalid or closed file descriptor"
-        when Errno::EFAULT::Errno; ": invalid buffer"
-        when Errno::EINVAL::Errno; ": invalid file descriptor"
-        when Errno::EIO::Errno; ": I/O error"
-        when Errno::EISDIR::Errno; ": file descriptor is a directory"
-        else; ""
-        end,
-        FFI.errno)
+      readable, = select([@handle, @pipe.first])
+      return nil if readable.include?(@pipe.first)
+      @handle.readpartial(size)
+    rescue Errno::EBADF
+      # If the IO has already been closed, reading from it will cause
+      # Errno::EBADF.
+      nil
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/rb-inotify/version.rb 
new/lib/rb-inotify/version.rb
--- old/lib/rb-inotify/version.rb       2017-06-18 01:28:26.000000000 +0200
+++ new/lib/rb-inotify/version.rb       2018-12-16 00:08:21.000000000 +0100
@@ -20,5 +20,5 @@
 # THE SOFTWARE.
 
 module INotify
-  VERSION = '0.9.10'
+  VERSION = '0.10.0'
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2017-06-18 01:28:26.000000000 +0200
+++ new/metadata        2018-12-16 00:08:21.000000000 +0100
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: rb-inotify
 version: !ruby/object:Gem::Version
-  version: 0.9.10
+  version: 0.10.0
 platform: ruby
 authors:
 - Natalie Weizenbaum
@@ -9,76 +9,78 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2017-06-17 00:00:00.000000000 Z
+date: 2018-12-15 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: ffi
   requirement: !ruby/object:Gem::Requirement
     requirements:
-    - - ">="
-      - !ruby/object:Gem::Version
-        version: 0.5.0
-    - - "<"
+    - - "~>"
       - !ruby/object:Gem::Version
-        version: '2'
+        version: '1.0'
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
-    - - ">="
-      - !ruby/object:Gem::Version
-        version: 0.5.0
-    - - "<"
+    - - "~>"
       - !ruby/object:Gem::Version
-        version: '2'
+        version: '1.0'
 - !ruby/object:Gem::Dependency
   name: rspec
   requirement: !ruby/object:Gem::Requirement
     requirements:
     - - "~>"
       - !ruby/object:Gem::Version
-        version: '3.4'
+        version: '3.6'
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - "~>"
       - !ruby/object:Gem::Version
-        version: '3.4'
+        version: '3.6'
 - !ruby/object:Gem::Dependency
   name: bundler
   requirement: !ruby/object:Gem::Requirement
     requirements:
-    - - "~>"
+    - - ">="
       - !ruby/object:Gem::Version
-        version: '1.3'
+        version: '0'
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
-    - - "~>"
+    - - ">="
       - !ruby/object:Gem::Version
-        version: '1.3'
+        version: '0'
 - !ruby/object:Gem::Dependency
   name: rake
   requirement: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: 10.5.0
-    - - "<"
-      - !ruby/object:Gem::Version
-        version: '13'
+        version: '0'
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: 10.5.0
-    - - "<"
+        version: '0'
+- !ruby/object:Gem::Dependency
+  name: concurrent-ruby
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ">="
       - !ruby/object:Gem::Version
-        version: '13'
+        version: '0'
+  type: :development
+  prerelease: false
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ">="
+      - !ruby/object:Gem::Version
+        version: '0'
 description: 
 email:
 - [email protected]
@@ -91,6 +93,7 @@
 - ".travis.yml"
 - ".yardopts"
 - Gemfile
+- LICENSE.md
 - README.md
 - Rakefile
 - lib/rb-inotify.rb
@@ -102,8 +105,8 @@
 - lib/rb-inotify/version.rb
 - lib/rb-inotify/watcher.rb
 - rb-inotify.gemspec
-- spec/rb-inotify/errors_spec.rb
-- spec/rb-inotify_spec.rb
+- spec/inotify_spec.rb
+- spec/notifier_spec.rb
 - spec/spec_helper.rb
 homepage: https://github.com/guard/rb-inotify
 licenses:
@@ -117,7 +120,7 @@
   requirements:
   - - ">="
     - !ruby/object:Gem::Version
-      version: '0'
+      version: '2.2'
 required_rubygems_version: !ruby/object:Gem::Requirement
   requirements:
   - - ">="
@@ -125,11 +128,11 @@
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 2.6.10
+rubygems_version: 2.7.8
 signing_key: 
 specification_version: 4
 summary: A Ruby wrapper for Linux inotify, using FFI
 test_files:
-- spec/rb-inotify/errors_spec.rb
-- spec/rb-inotify_spec.rb
+- spec/inotify_spec.rb
+- spec/notifier_spec.rb
 - spec/spec_helper.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rb-inotify.gemspec new/rb-inotify.gemspec
--- old/rb-inotify.gemspec      2017-06-18 01:28:26.000000000 +0200
+++ new/rb-inotify.gemspec      2018-12-16 00:08:21.000000000 +0100
@@ -1,7 +1,5 @@
 # -*- encoding: utf-8 -*-
-
-$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
-require 'rb-inotify/version'
+require_relative 'lib/rb-inotify/version'
 
 Gem::Specification.new do |spec|
   spec.name     = 'rb-inotify'
@@ -18,13 +16,13 @@
   spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
   spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
   spec.require_paths = ["lib"]
-
-  spec.required_ruby_version = '>= 0'
-
-  spec.add_dependency 'ffi', '>= 0.5.0', '< 2'
-
-  spec.add_development_dependency "rspec", "~> 3.4"
-  spec.add_development_dependency "bundler", "~> 1.3"
-  # rake 11.x requires Ruby >= 1.9.3
-  spec.add_development_dependency "rake", ">= 10.5.0", "< 13"
+  
+  spec.required_ruby_version = '>= 2.2'
+  
+  spec.add_dependency "ffi", "~> 1.0"
+  
+  spec.add_development_dependency "rspec", "~> 3.6"
+  spec.add_development_dependency "bundler"
+  spec.add_development_dependency "rake"
+  spec.add_development_dependency "concurrent-ruby"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/inotify_spec.rb new/spec/inotify_spec.rb
--- old/spec/inotify_spec.rb    1970-01-01 01:00:00.000000000 +0100
+++ new/spec/inotify_spec.rb    2018-12-16 00:08:21.000000000 +0100
@@ -0,0 +1,9 @@
+require 'spec_helper'
+
+describe INotify do
+  describe "version" do
+    it "exists" do
+      expect(INotify::VERSION).to be_truthy
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/notifier_spec.rb new/spec/notifier_spec.rb
--- old/spec/notifier_spec.rb   1970-01-01 01:00:00.000000000 +0100
+++ new/spec/notifier_spec.rb   2018-12-16 00:08:21.000000000 +0100
@@ -0,0 +1,170 @@
+require 'spec_helper'
+require 'tmpdir'
+require 'concurrent'
+
+describe INotify::Notifier do
+  describe "instance" do
+    around do |block|
+      Dir.mktmpdir do |dir|
+        @root = Pathname.new(dir)
+        @notifier = INotify::Notifier.new
+
+        begin
+          block.call
+        ensure
+          @notifier.close
+        end
+      end
+    end
+
+    let(:dir) do
+      @root.join("foo").tap(&:mkdir)
+    end
+
+    let(:another_dir) do
+      @root.join("bar").tap(&:mkdir)
+    end
+
+    it "stops" do
+      @notifier.stop
+    end
+
+    describe :process do
+      it "gets events" do
+        events = recording(dir, :create)
+        dir.join("test.txt").write("hello world")
+
+        @notifier.process
+
+        expect(events.size).to eq(1)
+        expect(events.first.name).to eq("test.txt")
+        expect(events.first.absolute_name).to eq(dir.join("test.txt").to_s)
+      end
+
+      it "gets simultaneous events" do
+        events = recording(dir, :create)
+
+        dir.join("one.txt").write("hello world")
+        dir.join("two.txt").write("hello world")
+
+        @notifier.process
+
+        expect(events.map(&:name)).to match_array(%w(one.txt two.txt))
+      end
+
+      it "separates events between watches" do
+        bar_events = nil
+
+        foo_events = recording(dir, :create)
+        bar_events = recording(another_dir, :create)
+
+        dir.join("test.txt").write("hello world")
+        another_dir.join("test_two.txt").write("hello world")
+
+        @notifier.process
+
+        expect(foo_events.size).to eq(1)
+        expect(foo_events.first.name).to eq("test.txt")
+        expect(foo_events.first.absolute_name).to eq(dir.join("test.txt").to_s)
+
+        expect(bar_events.size).to eq(1)
+        expect(bar_events.first.name).to eq("test_two.txt")
+        expect(bar_events.first.absolute_name).to 
eq(another_dir.join("test_two.txt").to_s)
+      end
+    end
+
+    describe :run do
+      it "processes repeatedly until stopped" do
+        barriers = Array.new(3) { Concurrent::Event.new }
+        barrier_queue = barriers.dup
+        events = recording(dir, :create) { barrier_queue.shift.set }
+
+        run_thread = Thread.new { @notifier.run }
+
+        dir.join("one.txt").write("hello world")
+        barriers.shift.wait(1) or raise "timeout"
+
+        expect(events.map(&:name)).to match_array(%w(one.txt))
+
+        dir.join("two.txt").write("hello world")
+        barriers.shift.wait(1) or raise "timeout"
+
+        expect(events.map(&:name)).to match_array(%w(one.txt two.txt))
+
+        @notifier.stop
+
+        dir.join("three.txt").write("hello world")
+        barriers.shift.wait(1)
+
+        dir.join("four.txt").write("hello world")
+        run_thread.join
+
+        expect(events.map(&:name)).to match_array(%w(one.txt two.txt))
+      end
+    end
+
+    describe :fd do
+      it "returns an integer" do
+        expect(@notifier.fd).to be_an(Integer)
+      end
+    end
+
+    describe :to_io do
+      it "returns a ruby IO" do
+        expect(@notifier.to_io).to be_an(::IO)
+      end
+
+      it "matches the fd" do
+        expect(@notifier.to_io.fileno).to eq(@notifier.fd)
+      end
+
+      it "caches its result" do
+        expect(@notifier.to_io).to be(@notifier.to_io)
+      end
+
+      it "is selectable" do
+        events = recording(dir, :create)
+        expect(select([@notifier.to_io], nil, nil, 0.2)).to be_nil
+
+        dir.join("test.txt").write("hello world")
+        expect(select([@notifier.to_io], nil, nil, 0.2)).to 
eq([[@notifier.to_io], [], []])
+
+        @notifier.process
+        expect(select([@notifier.to_io], nil, nil, 0.2)).to be_nil
+      end
+    end
+
+    private
+
+    def recording(dir, *flags, callback: nil)
+      events = []
+      @notifier.watch(dir.to_s, *flags) do |event|
+        events << event
+        yield if block_given?
+      end
+
+      events
+    end
+  end
+
+  describe "mixed instances" do
+    it "doesn't tangle fds" do
+      notifiers = Array.new(30) { INotify::Notifier.new }
+      notifiers.each(&:to_io)
+
+      one = Array.new(10) { IO.pipe.last }
+      notifiers.each(&:close)
+
+      two = Array.new(10) { IO.pipe.last }
+
+      notifiers = nil
+      GC.start
+
+      _, writable, _ = select(nil, one, nil, 1)
+      expect(writable).to match_array(one)
+
+      _, writable, _ = select(nil, two, nil, 1)
+      expect(writable).to match_array(two)
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/rb-inotify/errors_spec.rb 
new/spec/rb-inotify/errors_spec.rb
--- old/spec/rb-inotify/errors_spec.rb  2017-06-18 01:28:26.000000000 +0200
+++ new/spec/rb-inotify/errors_spec.rb  1970-01-01 01:00:00.000000000 +0100
@@ -1,9 +0,0 @@
-require 'spec_helper'
-
-describe INotify do
-  describe "QueueOverflowError" do
-    it "exists" do
-      expect(INotify::QueueOverflowError).to be_truthy
-    end
-  end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/rb-inotify_spec.rb new/spec/rb-inotify_spec.rb
--- old/spec/rb-inotify_spec.rb 2017-06-18 01:28:26.000000000 +0200
+++ new/spec/rb-inotify_spec.rb 1970-01-01 01:00:00.000000000 +0100
@@ -1,9 +0,0 @@
-require 'spec_helper'
-
-describe INotify do
-  describe "version" do
-    it "exists" do
-      expect(INotify::VERSION).to be_truthy
-    end
-  end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/spec_helper.rb new/spec/spec_helper.rb
--- old/spec/spec_helper.rb     2017-06-18 01:28:26.000000000 +0200
+++ new/spec/spec_helper.rb     2018-12-16 00:08:21.000000000 +0100
@@ -1,4 +1,21 @@
 
+if ENV['COVERAGE'] || ENV['TRAVIS']
+       begin
+               require 'simplecov'
+               
+               SimpleCov.start do
+                       add_filter "/spec/"
+               end
+               
+               if ENV['TRAVIS']
+                       require 'coveralls'
+                       Coveralls.wear!
+               end
+       rescue LoadError
+               warn "Could not load simplecov: #{$!}"
+       end
+end
+
 require "bundler/setup"
 require "rb-inotify"
 


Reply via email to