filewatch 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -216,5 +216,10 @@ module FileWatch
216
216
  end
217
217
  db.close
218
218
  end # def _sincedb_write
219
- end # class Watch
219
+
220
+ public
221
+ def quit
222
+ @watch.quit
223
+ end # def quit
224
+ end # class Tail
220
225
  end # module FileWatch
@@ -97,7 +97,8 @@ module FileWatch
97
97
  public
98
98
  def subscribe(stat_interval = 1, discover_interval = 5, &block)
99
99
  glob = 0
100
- loop do
100
+ @quit = false
101
+ while !@quit
101
102
  each(&block)
102
103
 
103
104
  glob += 1
@@ -147,5 +148,9 @@ module FileWatch
147
148
  end
148
149
  end # def _discover_file
149
150
 
151
+ public
152
+ def quit
153
+ @quit = true
154
+ end # def quit
150
155
  end # class Watch
151
156
  end # module FileWatch
@@ -0,0 +1,17 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), "..", "..", "lib"))
2
+ require "minitest/unit"
3
+ require "minitest/autorun"
4
+ require "filewatch/tail"
5
+
6
+ class TailTest < MiniTest::Unit::TestCase
7
+ def test_quit
8
+ require "timeout"
9
+ tail = FileWatch::Tail.new
10
+ #Thread.new(tail) { |t| sleep(1); t.quit }
11
+
12
+ #Timeout.timeout(5) do
13
+ #tail.subscribe { |e| }
14
+ #end
15
+ tail.quit
16
+ end
17
+ end # class TailTest
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filewatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-09-16 00:00:00.000000000 Z
13
+ date: 2012-10-02 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Watch files and directories in ruby. Also supports tailing and glob file
16
16
  patterns.
@@ -22,31 +22,32 @@ executables:
22
22
  extensions: []
23
23
  extra_rdoc_files: []
24
24
  files:
25
- - lib/filewatch/watch.rb
26
25
  - lib/filewatch/tail.rb
27
26
  - lib/filewatch/buftok.rb
28
- - test/globtail/test4.sh
29
- - test/globtail/test10.data
30
- - test/globtail/test5.data
31
- - test/globtail/Makefile
32
- - test/globtail/test9.sh
33
- - test/globtail/test7.sh
34
- - test/globtail/test4.data
35
- - test/globtail/test8.sh
27
+ - lib/filewatch/watch.rb
28
+ - test/globtail/test9.data
36
29
  - test/globtail/test10.sh
37
- - test/globtail/test7.data
38
- - test/globtail/test2.data
39
30
  - test/globtail/test3.sh
31
+ - test/globtail/test8.sh
32
+ - test/globtail/test6.sh
33
+ - test/globtail/test4.data
34
+ - test/globtail/framework.sh
35
+ - test/globtail/Makefile
36
+ - test/globtail/test5.data
40
37
  - test/globtail/test6.data
38
+ - test/globtail/test7.data
39
+ - test/globtail/test2.data
40
+ - test/globtail/test5.sh
41
+ - test/globtail/test10.data
42
+ - test/globtail/test8.data
41
43
  - test/globtail/test1.sh
44
+ - test/globtail/test4.sh
45
+ - test/globtail/test3.data
42
46
  - test/globtail/test1.data
43
- - test/globtail/test8.data
44
- - test/globtail/framework.sh
47
+ - test/globtail/test7.sh
45
48
  - test/globtail/test2.sh
46
- - test/globtail/test3.data
47
- - test/globtail/test9.data
48
- - test/globtail/test5.sh
49
- - test/globtail/test6.sh
49
+ - test/globtail/test9.sh
50
+ - test/filewatch/tail.rb
50
51
  - bin/globtail
51
52
  homepage: https://github.com/jordansissel/ruby-filewatch
52
53
  licenses: []