clarity 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,7 @@ lib/clarity.rb
9
9
  lib/clarity/cli.rb
10
10
  lib/clarity/commands/command_builder.rb
11
11
  lib/clarity/commands/tail_command_builder.rb
12
+ lib/clarity/grep_renderer.rb
12
13
  lib/clarity/parsers/hostname_parser.rb
13
14
  lib/clarity/parsers/shop_parser.rb
14
15
  lib/clarity/parsers/time_parser.rb
@@ -17,6 +17,14 @@ We wrote Clarity to allow our support staff to use a simple interface to look
17
17
  through the various log files in our server farm. The application was such a
18
18
  big success internally that we decided to release it as open source.
19
19
 
20
+ == USAGE:
21
+
22
+ clarity --username=admin --password=secret --port=8989 /var/log
23
+
24
+ == SCREENSHOT:
25
+
26
+ http://img.skitch.com/20091104-je9kq1a2gfr586ia8y246bq4n8.png
27
+
20
28
  == REQUIREMENTS:
21
29
 
22
30
  * eventmachine
@@ -13,7 +13,7 @@ require 'clarity/parsers/shop_parser'
13
13
  require 'clarity/renderers/log_renderer'
14
14
 
15
15
  module Clarity
16
- VERSION = '0.9.1'
16
+ VERSION = '0.9.2'
17
17
 
18
18
  Templates = File.dirname(__FILE__) + '/../views'
19
19
  Public = File.dirname(__FILE__) + '/../public'
@@ -0,0 +1,37 @@
1
+ module Clarity
2
+ module GrepRenderer
3
+ attr_accessor :response, :parser, :marker, :params
4
+
5
+ def parser
6
+ @parser ||= TimeParser.new( HostnameParser.new(ShopParser.new), params)
7
+ end
8
+
9
+ def renderer
10
+ @renderer ||= LogRenderer.new
11
+ end
12
+
13
+ # once download is complete, send it to client
14
+ def receive_data(data)
15
+ @buffer ||= StringScanner.new("")
16
+ @buffer << data
17
+
18
+ html = ""
19
+ while line = @buffer.scan_until(/\n/)
20
+ tokens = parser.parse(line)
21
+ html << renderer.render(tokens)
22
+ end
23
+
24
+ return if html.empty?
25
+
26
+ response.chunk html
27
+ response.send_chunks
28
+ end
29
+
30
+ def unbind
31
+ response.chunk '</div><hr><p id="done">Done</p></body></html>'
32
+ response.chunk ''
33
+ response.send_chunks
34
+ puts 'Done'
35
+ end
36
+ end
37
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clarity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Tobias L\xC3\xBCtke"
@@ -76,6 +76,7 @@ files:
76
76
  - lib/clarity/cli.rb
77
77
  - lib/clarity/commands/command_builder.rb
78
78
  - lib/clarity/commands/tail_command_builder.rb
79
+ - lib/clarity/grep_renderer.rb
79
80
  - lib/clarity/parsers/hostname_parser.rb
80
81
  - lib/clarity/parsers/shop_parser.rb
81
82
  - lib/clarity/parsers/time_parser.rb