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 +4 -4
- data/lib/filewatch/ext/filetail.rb +4 -2
- data/lib/filewatch/ext/tailbase.rb +13 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4686023797b04eae09ab5bec38217d1165d3b25
|
4
|
+
data.tar.gz: 4a09a85762f5d60cf45997e4ee67bfb0c36299fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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.
|
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-
|
11
|
+
date: 2014-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: filewatch
|