logfile_interval 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14b39f20fbae9202297e5238d0f5b070ff6e74d3
|
4
|
+
data.tar.gz: e68b950bb73692646df7e003548294b29c57217a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4854a00f1ffc8a58dc6608c977a0cf6ed89b8affa9b9e81fc271d14f89a0c53edbeb33188255b0eba01893c8fc7c313d09e097a8b1eddc748a56f81efbe21fc4
|
7
|
+
data.tar.gz: af8d8ba8b2a23cc3d4985763d8f7653c36c1881085107542af2134e5ae4e7488fb345834bd34d06c3406b02671d0e33de2f35b318c60cfac9632e152eaf8f340
|
@@ -6,7 +6,7 @@ module LogfileInterval
|
|
6
6
|
|
7
7
|
def initialize(filenames, parser, order = :desc, &file_time_finder_block)
|
8
8
|
@parser = parser
|
9
|
-
@filenames = filenames
|
9
|
+
@filenames = reject_empty_files(filenames)
|
10
10
|
@order = order
|
11
11
|
@file_time_finder_block = file_time_finder_block if block_given?
|
12
12
|
|
@@ -67,5 +67,11 @@ module LogfileInterval
|
|
67
67
|
h
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
71
|
+
def reject_empty_files(filenames)
|
72
|
+
filenames.reject do |fname|
|
73
|
+
!File.size?(fname)
|
74
|
+
end
|
75
|
+
end
|
70
76
|
end
|
71
77
|
end
|
@@ -6,7 +6,7 @@ module LogfileInterval
|
|
6
6
|
|
7
7
|
describe LogfileSet do
|
8
8
|
before :each do
|
9
|
-
@logfiles = ["#{data_dir}/access.log.2", "#{data_dir}/access.log.1"]
|
9
|
+
@logfiles = ["#{data_dir}/access.log.2", "#{data_dir}/access.log.1", "#{data_dir}/access.log.empty"]
|
10
10
|
@set = LogfileSet.new(@logfiles, ParsedLine::AccessLog)
|
11
11
|
@first_line = '66.249.67.176 - - [23/Jun/2013:17:00:01 -0800] "GET /package/core/raring/universe/proposed/openldap HTTP/1.1" 200 185 "-" "Google"'
|
12
12
|
@second_line = '12.24.48.96 - - [23/Jun/2013:16:59:00 -0800] "GET /package/core/raring/universe/proposed/openldap HTTP/1.1" 200 4555 "-" "Bing)"'
|
@@ -55,6 +55,13 @@ module LogfileInterval
|
|
55
55
|
lines.last.should == @first_line
|
56
56
|
end
|
57
57
|
end
|
58
|
+
|
59
|
+
context 'emoty logfiles' do
|
60
|
+
it 'are ignored' do
|
61
|
+
set = LogfileSet.new(@logfiles, ParsedLine::AccessLog, :asc)
|
62
|
+
expect(set.ordered_filenames).to_not include("#{data_dir}/access.log.empty")
|
63
|
+
end
|
64
|
+
end
|
58
65
|
end
|
59
66
|
|
60
67
|
describe :each_parsed_line do
|
@@ -80,8 +87,12 @@ module LogfileInterval
|
|
80
87
|
end
|
81
88
|
|
82
89
|
describe :ordered_filenames do
|
83
|
-
|
84
|
-
@
|
90
|
+
before :each do
|
91
|
+
@non_empty_logfiles = @logfiles.reject { |f| !File.size?(f) }
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'returns the most recent non empty file first' do
|
95
|
+
@set.ordered_filenames.should == @non_empty_logfiles.reverse
|
85
96
|
end
|
86
97
|
|
87
98
|
context 'with file_time_finder_block' do
|
@@ -91,7 +102,7 @@ module LogfileInterval
|
|
91
102
|
matchdata[:num].to_i
|
92
103
|
end
|
93
104
|
end
|
94
|
-
set.ordered_filenames.should == @
|
105
|
+
set.ordered_filenames.should == @non_empty_logfiles
|
95
106
|
end
|
96
107
|
end
|
97
108
|
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logfile_interval
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philippe Le Rohellec
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,6 +136,7 @@ files:
|
|
136
136
|
- spec/support/logfiles/access.log.1
|
137
137
|
- spec/support/logfiles/access.log.2
|
138
138
|
- spec/support/logfiles/access.log.3
|
139
|
+
- spec/support/logfiles/access.log.empty
|
139
140
|
- spec/support/logfiles/timing.log
|
140
141
|
- spec/support/logfiles/timing.log.1
|
141
142
|
- spec/support/logfiles/timing.log.2
|
@@ -181,6 +182,7 @@ test_files:
|
|
181
182
|
- spec/support/logfiles/access.log.1
|
182
183
|
- spec/support/logfiles/access.log.2
|
183
184
|
- spec/support/logfiles/access.log.3
|
185
|
+
- spec/support/logfiles/access.log.empty
|
184
186
|
- spec/support/logfiles/timing.log
|
185
187
|
- spec/support/logfiles/timing.log.1
|
186
188
|
- spec/support/logfiles/timing.log.2
|