rb-inotify 0.9.0 → 0.9.1

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.9.1
data/lib/rb-inotify.rb CHANGED
@@ -13,5 +13,5 @@ module INotify
13
13
  # An array containing the version number of rb-inotify.
14
14
  # The numbers in the array are the major, minor, and patch versions,
15
15
  # respectively.
16
- VERSION = [0, 9, 0]
16
+ VERSION = [0, 9, 1]
17
17
  end
@@ -189,13 +189,17 @@ module INotify
189
189
  def watch(path, *flags, &callback)
190
190
  return Watcher.new(self, path, *flags, &callback) unless flags.include?(:recursive)
191
191
 
192
- Dir.new(path).each do |base|
192
+ dir = Dir.new(path)
193
+
194
+ dir.each do |base|
193
195
  d = File.join(path, base)
194
196
  binary_d = d.respond_to?(:force_encoding) ? d.dup.force_encoding('BINARY') : d
195
197
  next if binary_d =~ /\/\.\.?$/ # Current or parent directory
196
198
  watch(d, *flags, &callback) if !RECURSIVE_BLACKLIST.include?(d) && File.directory?(d)
197
199
  end
198
200
 
201
+ dir.close
202
+
199
203
  rec_flags = [:create, :moved_to]
200
204
  return watch(path, *((flags - [:recursive]) | rec_flags)) do |event|
201
205
  callback.call(event) if flags.include?(:all_events) || !(flags & event.flags).empty?
@@ -270,11 +274,11 @@ module INotify
270
274
 
271
275
  events = []
272
276
  cookies = {}
273
- while ev = Event.consume(data, self)
274
- events << ev
275
- next if ev.cookie == 0
276
- cookies[ev.cookie] ||= []
277
- cookies[ev.cookie] << ev
277
+ while event = Event.consume(data, self)
278
+ events << event
279
+ next if event.cookie == 0
280
+ cookies[event.cookie] ||= []
281
+ cookies[event.cookie] << event
278
282
  end
279
283
  cookies.each {|c, evs| evs.each {|ev| ev.related.replace(evs - [ev]).freeze}}
280
284
  events
data/rb-inotify.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rb-inotify"
8
- s.version = "0.9.0"
8
+ s.version = "0.9.1"
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 = "2013-01-12"
12
+ s.date = "2013-08-09"
13
13
  s.description = "A Ruby wrapper for Linux's inotify, using FFI"
14
14
  s.email = "nex342@gmail.com"
15
15
  s.extra_rdoc_files = [
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.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-12 00:00:00.000000000 Z
12
+ date: 2013-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi