picky-statistics 1.2.3 → 1.2.4
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.
- data/lib/picky-statistics/application/app.rb +0 -1
- data/lib/picky-statistics/application/images/background.png +0 -0
- data/lib/picky-statistics/application/stylesheets/statistics.css +6 -0
- data/lib/picky-statistics/application/views/index.haml +0 -1
- data/lib/picky-statistics/statistics/logfile_reader.rb +6 -2
- data/spec/lib/picky-statistics/statistics/logfile_reader_spec.rb +44 -0
- metadata +6 -3
Binary file
|
@@ -1,5 +1,6 @@
|
|
1
1
|
body {
|
2
2
|
font-family: Futura, 'Century Gothic', 'URW Gothic L', Helvetica, sans-serif;
|
3
|
+
background-image: url('../images/background.png');
|
3
4
|
}
|
4
5
|
|
5
6
|
h1, h2, h3, h4 {
|
@@ -15,10 +16,15 @@ h4 { font-size: 1.1em; }
|
|
15
16
|
overflow: hidden;
|
16
17
|
}
|
17
18
|
|
19
|
+
.actions {
|
20
|
+
padding: 5px;
|
21
|
+
}
|
22
|
+
|
18
23
|
.stats {
|
19
24
|
float: left;
|
20
25
|
padding: 10px;
|
21
26
|
width: 200px;
|
27
|
+
height: 270px;
|
22
28
|
}
|
23
29
|
|
24
30
|
.legend {
|
@@ -47,7 +47,6 @@
|
|
47
47
|
.inlinesparkline
|
48
48
|
= haml :legend, {}, :color => :black, :type => :with_offset, :text => 'with offset'
|
49
49
|
= haml :legend, {}, :color => :grey, :type => :without_offset, :text => 'without offset'
|
50
|
-
Disclaimer: "Designed" by myself. If anyone wants to contribute a better design, please do! :)
|
51
50
|
:javascript
|
52
51
|
updateStatistics();
|
53
52
|
|
@@ -1,7 +1,11 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'json'
|
3
|
+
|
1
4
|
module Statistics
|
2
5
|
|
3
6
|
class LogfileReader
|
4
|
-
|
7
|
+
|
8
|
+
attr_reader :last_offset
|
5
9
|
attr_writer :path
|
6
10
|
|
7
11
|
#
|
@@ -63,7 +67,7 @@ module Statistics
|
|
63
67
|
#
|
64
68
|
#
|
65
69
|
def since_last
|
66
|
-
@last_offset ||=
|
70
|
+
@last_offset ||= 1
|
67
71
|
|
68
72
|
log_offset = @last_offset
|
69
73
|
start_time = Time.now
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Statistics::LogfileReader do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@reader = Statistics::LogfileReader.new 'spec/data/search.log'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'full' do
|
10
|
+
it 'is set to have the right keys' do
|
11
|
+
@reader.full.should have_key(:total)
|
12
|
+
@reader.full.should have_key(:quick)
|
13
|
+
@reader.full.should have_key(:long_running)
|
14
|
+
@reader.full.should have_key(:very_long_running)
|
15
|
+
@reader.full.should have_key(:offset)
|
16
|
+
|
17
|
+
@reader.full[:totals].should have_key(0)
|
18
|
+
@reader.full[:totals].should have_key(1)
|
19
|
+
@reader.full[:totals].should have_key(2)
|
20
|
+
@reader.full[:totals].should have_key(3)
|
21
|
+
@reader.full[:totals].should have_key(:'4+')
|
22
|
+
@reader.full[:totals].should have_key(:'100+')
|
23
|
+
@reader.full[:totals].should have_key(:'1000+')
|
24
|
+
@reader.full[:totals].should have_key(:cloud)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
describe 'live' do
|
28
|
+
it 'is set to a specific Hash at first' do
|
29
|
+
@reader.live.should have_key(:total)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'since_last' do
|
34
|
+
it 'returns a specific JSON result' do
|
35
|
+
@reader.since_last.to_json.should == '{"full":{"total":"22","totals":{"0":"1","1":"1","2":"1","3":"1","4+":"6","100+":"2","1000+":"10","cloud":"3"},"quick":"16","long_running":"2","very_long_running":"2","offset":"5"},"live":{"total":"1"}}'
|
36
|
+
end
|
37
|
+
it 'is at a specific line after reading the log file' do
|
38
|
+
@reader.since_last
|
39
|
+
|
40
|
+
@reader.last_offset.should == 23
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 1.2.
|
8
|
+
- 4
|
9
|
+
version: 1.2.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Florian Hanke
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-12-
|
17
|
+
date: 2010-12-30 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -56,6 +56,7 @@ extra_rdoc_files: []
|
|
56
56
|
|
57
57
|
files:
|
58
58
|
- lib/picky-statistics/application/app.rb
|
59
|
+
- lib/picky-statistics/application/images/background.png
|
59
60
|
- lib/picky-statistics/application/javascripts/jquery-1.4.4.min.js
|
60
61
|
- lib/picky-statistics/application/javascripts/jquery.sparkline-1.6.min.js
|
61
62
|
- lib/picky-statistics/application/javascripts/statistics.js
|
@@ -66,6 +67,7 @@ files:
|
|
66
67
|
- lib/picky-statistics/statistics/logfile_reader.rb
|
67
68
|
- lib/picky-statistics.rb
|
68
69
|
- spec/lib/picky-statistics/statistics/count_spec.rb
|
70
|
+
- spec/lib/picky-statistics/statistics/logfile_reader_spec.rb
|
69
71
|
has_rdoc: true
|
70
72
|
homepage: http://floere.github.com/picky
|
71
73
|
licenses: []
|
@@ -100,3 +102,4 @@ specification_version: 3
|
|
100
102
|
summary: Displays search statistics for Picky.
|
101
103
|
test_files:
|
102
104
|
- spec/lib/picky-statistics/statistics/count_spec.rb
|
105
|
+
- spec/lib/picky-statistics/statistics/logfile_reader_spec.rb
|