filewatch 0.5.0 → 0.5.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.
Files changed (2) hide show
  1. data/lib/filewatch/tail.rb +14 -10
  2. metadata +32 -32
@@ -153,29 +153,33 @@ module FileWatch
153
153
  changed = false
154
154
  loop do
155
155
  begin
156
- data = @files[path].sysread(4096)
156
+ data = @files[path].sysread(16394)
157
157
  changed = true
158
158
  @buffers[path].extract(data).each do |line|
159
159
  yield(path, line)
160
160
  end
161
161
 
162
162
  @sincedb[@statcache[path]] = @files[path].pos
163
+ write_sincedb_if_necessary
163
164
  rescue Errno::EWOULDBLOCK, Errno::EINTR, EOFError
164
165
  break
165
166
  end
166
167
  end
167
168
 
168
- if changed
169
- now = Time.now.to_i
170
- delta = now - @sincedb_last_write
171
- if delta >= @opts[:sincedb_write_interval]
172
- @logger.debug("writing sincedb (delta since last write = #{delta})")
173
- _sincedb_write
174
- @sincedb_last_write = now
175
- end
176
- end
169
+ write_sincedb_if_necessary
177
170
  end # def _read_file
178
171
 
172
+ private
173
+ def write_sincedb_if_necessary
174
+ now = Time.now.to_i
175
+ delta = now - @sincedb_last_write
176
+ if delta >= @opts[:sincedb_write_interval]
177
+ @logger.debug("writing sincedb (delta since last write = #{delta})")
178
+ _sincedb_write
179
+ @sincedb_last_write = now
180
+ end
181
+ end # def write_sincedb_if_necessary
182
+
179
183
  public
180
184
  def sincedb_write(reason=nil)
181
185
  @logger.debug("caller requested sincedb write (#{reason})")
metadata CHANGED
@@ -1,19 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filewatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
5
- prerelease:
4
+ version: 0.5.1
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jordan Sissel
9
9
  - Pete Fritchman
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-02 00:00:00.000000000 Z
13
+ date: 2013-01-26 00:00:00.000000000 Z
14
14
  dependencies: []
15
- description: Watch files and directories in ruby. Also supports tailing and glob file
16
- patterns.
15
+ description: Watch files and directories in ruby. Also supports tailing and glob file patterns.
17
16
  email:
18
17
  - jls@semicomplete.com
19
18
  - petef@databits.net
@@ -22,57 +21,58 @@ executables:
22
21
  extensions: []
23
22
  extra_rdoc_files: []
24
23
  files:
25
- - lib/filewatch/tail.rb
26
24
  - lib/filewatch/buftok.rb
27
25
  - lib/filewatch/watch.rb
28
- - test/globtail/test9.data
26
+ - lib/filewatch/tail.rb
27
+ - test/filewatch/tail.rb
28
+ - test/globtail/Makefile
29
+ - test/globtail/framework.sh
30
+ - test/globtail/test1.data
31
+ - test/globtail/test1.sh
32
+ - test/globtail/test10.data
29
33
  - test/globtail/test10.sh
34
+ - test/globtail/test2.data
35
+ - test/globtail/test2.sh
36
+ - test/globtail/test3.data
30
37
  - test/globtail/test3.sh
31
- - test/globtail/test8.sh
32
- - test/globtail/test6.sh
33
38
  - test/globtail/test4.data
34
- - test/globtail/framework.sh
35
- - test/globtail/Makefile
39
+ - test/globtail/test4.sh
36
40
  - test/globtail/test5.data
41
+ - test/globtail/test5.sh
37
42
  - test/globtail/test6.data
43
+ - test/globtail/test6.sh
38
44
  - test/globtail/test7.data
39
- - test/globtail/test2.data
40
- - test/globtail/test5.sh
41
- - test/globtail/test10.data
42
- - test/globtail/test8.data
43
- - test/globtail/test1.sh
44
- - test/globtail/test4.sh
45
- - test/globtail/test3.data
46
- - test/globtail/test1.data
47
45
  - test/globtail/test7.sh
48
- - test/globtail/test2.sh
46
+ - test/globtail/test8.data
47
+ - test/globtail/test8.sh
48
+ - test/globtail/test9.data
49
49
  - test/globtail/test9.sh
50
- - test/filewatch/tail.rb
51
50
  - bin/globtail
52
51
  homepage: https://github.com/jordansissel/ruby-filewatch
53
52
  licenses: []
54
- post_install_message:
53
+ post_install_message:
55
54
  rdoc_options: []
56
55
  require_paths:
57
56
  - lib
58
57
  - lib
59
58
  required_ruby_version: !ruby/object:Gem::Requirement
60
- none: false
61
59
  requirements:
62
- - - ! '>='
60
+ - - ">="
63
61
  - !ruby/object:Gem::Version
64
- version: '0'
65
- required_rubygems_version: !ruby/object:Gem::Requirement
62
+ version: !binary |-
63
+ MA==
66
64
  none: false
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
66
  requirements:
68
- - - ! '>='
67
+ - - ">="
69
68
  - !ruby/object:Gem::Version
70
- version: '0'
69
+ version: !binary |-
70
+ MA==
71
+ none: false
71
72
  requirements: []
72
- rubyforge_project:
73
+ rubyforge_project:
73
74
  rubygems_version: 1.8.24
74
- signing_key:
75
+ signing_key:
75
76
  specification_version: 3
76
77
  summary: filewatch - file watching for ruby
77
78
  test_files: []
78
- has_rdoc: