eventmachine-tail 0.2.20100524185851 → 0.2.20100525165012
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rtail +7 -0
- data/samples/tail-with-block.rb +6 -2
- data/test/test_glob.rb +1 -1
- metadata +3 -3
data/bin/rtail
CHANGED
@@ -63,6 +63,13 @@ def main(args)
|
|
63
63
|
end
|
64
64
|
|
65
65
|
EventMachine.run do
|
66
|
+
Signal.trap("INT") do
|
67
|
+
EventMachine.schedule do
|
68
|
+
$stderr.puts "Got SIGINT"
|
69
|
+
exit 128 + (Signal.list["INT"])
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
66
73
|
args.each do |path|
|
67
74
|
EventMachine::FileGlobWatchTail.new(path, Reader,
|
68
75
|
interval = globcheck_interval,
|
data/samples/tail-with-block.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Simple 'tail -f' example.
|
3
|
+
# Simple 'tail -f' example. This one uses a block instead of a separate handler
|
4
|
+
# class
|
4
5
|
# Usage example:
|
5
|
-
# tail.rb /var/log/messages
|
6
|
+
# tail-with-block.rb /var/log/messages
|
6
7
|
|
7
8
|
require "rubygems"
|
8
9
|
require "eventmachine"
|
@@ -17,6 +18,9 @@ def main(args)
|
|
17
18
|
EventMachine.run do
|
18
19
|
args.each do |path|
|
19
20
|
EventMachine::file_tail(path) do |filetail, line|
|
21
|
+
# filetail is the 'EventMachine::FileTail' instance for this file.
|
22
|
+
# line is the line read from thefile.
|
23
|
+
# this block is invoked for every line read.
|
20
24
|
puts line
|
21
25
|
end
|
22
26
|
end
|
data/test/test_glob.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 20100525165012
|
9
|
+
version: 0.2.20100525165012
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jordan Sissel
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-25 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|