filewatch-ext 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd745a247b7c5a4cad92d151ecce249b84b77955
4
- data.tar.gz: 807d72739b47249f1e45fafe9e03530c70b6c458
3
+ metadata.gz: f4686023797b04eae09ab5bec38217d1165d3b25
4
+ data.tar.gz: 4a09a85762f5d60cf45997e4ee67bfb0c36299fb
5
5
  SHA512:
6
- metadata.gz: 557568e1c3143bd6c6c5b80779efbafb87aa6fa2b4756fd06d26106060734d31b98a79e4342af9995038c1c521d97ba5bffe7e7baff9325b53b93f29bf6e2376
7
- data.tar.gz: 9d4a2baf2aa5dc41e514ed5f790ab2b2ee585721bb96effb7aa06080fd5e24f4ccfa72eaf9ce817f0c6801243d6d4a8d08ee69077fb84a31ee86ec8f29f69d14
6
+ metadata.gz: f94fb66a38aaf7362462b540117c5e782d306db617b35475983064766dfc855c3036aaecaa49ef922b4dfc08e486b3902e9d912d5641f43604d36868247dda83
7
+ data.tar.gz: 4b72a4ae0e6bc4a573749206a977b53faa36cdee65668995a468695fbe1b10b0159bed321379c14117b416bc6c0587d291c3433bcd9dc67404e26339f9966f44
@@ -111,16 +111,18 @@ module FileWatch::Ext
111
111
  private
112
112
  def _read_file(path, &block)
113
113
  # BufferedTokenizer is now in codec
114
+
115
+ changed = false
114
116
  loop do
115
117
  begin
116
118
  data = @files[path].sysread(32768)
117
-
119
+ changed = true
118
120
  yield(path, data, :log)
119
121
 
120
122
  @sincedb[@statcache[path]][:pos] = @files[path].pos
121
123
  _check_sincedb(false, path, &block)
122
124
  rescue EOFError
123
- _check_sincedb(true, path, &block)
125
+ _check_sincedb(true, path, &block) if changed
124
126
  _close_file(path) if @opts[:eof_close]
125
127
  @logger.debug("End of file reached for #{path}")
126
128
  break
@@ -94,7 +94,7 @@ module FileWatch::Ext
94
94
  if eof || delta >= @opts[:sincedb_write_interval]
95
95
  @logger.debug("writing sincedb (delta since last write = #{delta})") if @logger.debug?
96
96
  _sincedb_write
97
- _progressdb_write(path, &block) if @opts[:progressdb]
97
+ _progressdb_write(path, eof, &block) if @opts[:progressdb]
98
98
  @sincedb_last_write = now
99
99
  end
100
100
  end
@@ -155,10 +155,20 @@ module FileWatch::Ext
155
155
  end
156
156
 
157
157
  protected
158
- def _progressdb_write(path, &block)
159
- @sincedb.each do |inode, meta|
158
+ def _progressdb_write(path, eof, &block)
159
+ if eof
160
+ inode = @statcache[path]
161
+ meta = @sincedb[@statcache[path]]
160
162
  line = [inode, meta[:size], meta[:pos]].flatten.join(" ")
161
163
  yield(path, line, :progressdb)
164
+ else
165
+ @statcache.each do |path, inode|
166
+ meta = @sincedb[inode]
167
+ if meta[:size] != meta[:pos]
168
+ line = [inode, meta[:size], meta[:pos]].flatten.join(" ")
169
+ yield(path, line, :progressdb)
170
+ end
171
+ end
162
172
  end
163
173
  end
164
174
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filewatch-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dietmar Duft
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-03 00:00:00.000000000 Z
11
+ date: 2014-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: filewatch