ffilewatch 0.6.5 → 0.6.6
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.
- checksums.yaml +4 -4
- data/lib/filewatch/tail.rb +3 -2
- data/lib/filewatch/watch.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 63bee458a75994296f2de71c2024bdcf03ef81df
|
|
4
|
+
data.tar.gz: 9290d8d3719945a70b9b5e6f2a24aa40c865c175
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb0f49c8e61082a25a1b6a49dc3f29e47ed7206a93852ad5360380d7257c343cb3bd8da89c4e90927c5a9c5c2e7b80543391913435ecc2067fc1a7d48e90ae06
|
|
7
|
+
data.tar.gz: 66349e105c8485d6528ab8f29fd279786ea6b30d12f9871cda2dbdce6b8323ac855a1452c9c712ac39973d43d1b1d2ae888ca4ac7585ffbcd853099bd0c5995c
|
data/lib/filewatch/tail.rb
CHANGED
|
@@ -30,14 +30,13 @@ module FileWatch
|
|
|
30
30
|
@changed = Hash.new { |h, k| h[k] = 0 }
|
|
31
31
|
@lastwarn = Hash.new { |h, k| h[k] = 0 }
|
|
32
32
|
@buffers = {}
|
|
33
|
-
@watch = FileWatch::Watch.new
|
|
34
|
-
@watch.logger = @logger
|
|
35
33
|
@sincedb = {}
|
|
36
34
|
@sincedb_last_write = Time.now.to_i
|
|
37
35
|
@sincedb_write_pending = false
|
|
38
36
|
@sincedb_writing = false
|
|
39
37
|
@statcache = {}
|
|
40
38
|
@opts = {
|
|
39
|
+
:ignore_before => 0, # Ignore files last modified before this timestamp
|
|
41
40
|
:eviction_interval => 300, # Let go of file handles after five minutes
|
|
42
41
|
:sincedb_write_interval => 10,
|
|
43
42
|
:stat_interval => 1,
|
|
@@ -53,6 +52,8 @@ module FileWatch
|
|
|
53
52
|
if !@opts.include?(:sincedb_path)
|
|
54
53
|
raise NoSinceDBPathGiven.new("No HOME or SINCEDB_PATH set in environment. I need one of these set so I can keep track of the files I am following.")
|
|
55
54
|
end
|
|
55
|
+
@watch = FileWatch::Watch.new ignore_before: @opts[:ignore_before]
|
|
56
|
+
@watch.logger = @logger
|
|
56
57
|
@watch.exclude(@opts[:exclude])
|
|
57
58
|
_start_eviction
|
|
58
59
|
_sincedb_open
|
data/lib/filewatch/watch.rb
CHANGED
|
@@ -11,6 +11,9 @@ module FileWatch
|
|
|
11
11
|
public
|
|
12
12
|
def initialize(opts={})
|
|
13
13
|
@iswindows = ((RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/) != nil)
|
|
14
|
+
@opts = {
|
|
15
|
+
ignore_before: 0
|
|
16
|
+
}.merge(opts)
|
|
14
17
|
if opts[:logger]
|
|
15
18
|
@logger = opts[:logger]
|
|
16
19
|
else
|
|
@@ -155,6 +158,8 @@ module FileWatch
|
|
|
155
158
|
end
|
|
156
159
|
next if skip
|
|
157
160
|
|
|
161
|
+
next if File::mtime(path).to_i < @opts[:ignore_before]
|
|
162
|
+
|
|
158
163
|
stat = File::Stat.new(file)
|
|
159
164
|
@files[file] = {
|
|
160
165
|
:size => 0,
|