ntail 0.0.6 → 0.0.7
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/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/ntail.rb +24 -1
- data/lib/ntail/application.rb +60 -28
- data/lib/ntail/body_bytes_sent.rb +14 -0
- data/lib/ntail/http_method.rb +34 -0
- data/lib/ntail/http_referer.rb +81 -0
- data/lib/ntail/http_user_agent.rb +122 -0
- data/lib/ntail/http_version.rb +22 -0
- data/lib/ntail/known_ip_addresses.rb +44 -0
- data/lib/ntail/local_ip_addresses.rb +44 -0
- data/lib/ntail/log_line.rb +75 -222
- data/lib/ntail/proxy_addresses.rb +14 -0
- data/lib/ntail/remote_addr.rb +56 -0
- data/lib/ntail/remote_user.rb +63 -0
- data/lib/ntail/request.rb +33 -0
- data/lib/ntail/status.rb +68 -0
- data/lib/ntail/time_local.rb +38 -0
- data/lib/ntail/uri.rb +22 -0
- data/ntail.gemspec +41 -2
- data/test/helper.rb +73 -0
- data/test/ntail/test_http_method.rb +50 -0
- data/test/ntail/test_http_referer.rb +77 -0
- data/test/ntail/test_http_user_agent.rb +29 -0
- data/test/ntail/test_known_ip_addresses.rb +45 -0
- data/test/ntail/test_local_ip_addresses.rb +45 -0
- data/test/ntail/test_log_line.rb +51 -0
- data/test/ntail/test_remote_addr.rb +38 -0
- data/test/ntail/test_remote_user.rb +65 -0
- data/test/ntail/test_request.rb +26 -0
- data/test/ntail/test_status.rb +26 -0
- data/test/ntail/test_time_local.rb +30 -0
- data/test/test_ntail.rb +9 -2
- metadata +59 -9
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestTimeLocal < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context "ntail" do
|
6
|
+
|
7
|
+
setup do
|
8
|
+
@time_local = "13/Apr/2010:04:45:51 +0100"
|
9
|
+
@log_line = random_log_line(:time_local => @time_local)
|
10
|
+
end
|
11
|
+
|
12
|
+
should "parse local time (in the common log format) into a date object" do
|
13
|
+
# directly via the helper function
|
14
|
+
to_date = NginxTail::LogLine.to_date(@time_local)
|
15
|
+
assert_equal "2010-04-13T04:45:51+01:00", to_date.to_s
|
16
|
+
# parsed from a raw log line
|
17
|
+
assert_equal "2010-04-13T04:45:51+01:00", @log_line.to_date.to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
should "parse and format local time (in the common log format) into a date string" do
|
21
|
+
# directly via the helper function
|
22
|
+
to_date_s = NginxTail::LogLine.to_date_s(@time_local)
|
23
|
+
assert_equal "2010-04-13 04:45:51", to_date_s
|
24
|
+
# parsed from a raw log line
|
25
|
+
assert_equal "2010-04-13 04:45:51", @log_line.to_date_s
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/test/test_ntail.rb
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
class TestNtail < Test::Unit::TestCase
|
4
|
-
should "
|
5
|
-
|
4
|
+
should "have namespaced classes" do
|
5
|
+
assert_equal "constant", defined? NginxTail
|
6
|
+
assert NginxTail.is_a? Module
|
7
|
+
|
8
|
+
assert_equal "constant", defined? NginxTail::LogLine
|
9
|
+
assert NginxTail::LogLine.is_a? Class
|
10
|
+
|
11
|
+
assert_equal "constant", defined? NginxTail::Application
|
12
|
+
assert NginxTail::Application.is_a? Class
|
6
13
|
end
|
7
14
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ntail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Peter Vandenberk
|
@@ -15,10 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-06 00:00:00 +00:00
|
19
19
|
default_executable: ntail
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
+
type: :runtime
|
22
23
|
prerelease: false
|
23
24
|
name: rainbow
|
24
25
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -31,8 +32,8 @@ dependencies:
|
|
31
32
|
- 0
|
32
33
|
version: "0"
|
33
34
|
requirement: *id001
|
34
|
-
type: :runtime
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
+
type: :runtime
|
36
37
|
prerelease: false
|
37
38
|
name: user-agent
|
38
39
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
@@ -45,8 +46,8 @@ dependencies:
|
|
45
46
|
- 0
|
46
47
|
version: "0"
|
47
48
|
requirement: *id002
|
48
|
-
type: :runtime
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
|
+
type: :development
|
50
51
|
prerelease: false
|
51
52
|
name: shoulda
|
52
53
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
@@ -59,8 +60,8 @@ dependencies:
|
|
59
60
|
- 0
|
60
61
|
version: "0"
|
61
62
|
requirement: *id003
|
62
|
-
type: :development
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
|
+
type: :development
|
64
65
|
prerelease: false
|
65
66
|
name: bundler
|
66
67
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
@@ -75,8 +76,8 @@ dependencies:
|
|
75
76
|
- 0
|
76
77
|
version: 1.0.0
|
77
78
|
requirement: *id004
|
78
|
-
type: :development
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
|
+
type: :development
|
80
81
|
prerelease: false
|
81
82
|
name: jeweler
|
82
83
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
@@ -91,8 +92,8 @@ dependencies:
|
|
91
92
|
- 1
|
92
93
|
version: 1.5.1
|
93
94
|
requirement: *id005
|
94
|
-
type: :development
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
|
+
type: :development
|
96
97
|
prerelease: false
|
97
98
|
name: rcov
|
98
99
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
@@ -105,7 +106,20 @@ dependencies:
|
|
105
106
|
- 0
|
106
107
|
version: "0"
|
107
108
|
requirement: *id006
|
109
|
+
- !ruby/object:Gem::Dependency
|
108
110
|
type: :development
|
111
|
+
prerelease: false
|
112
|
+
name: geoip
|
113
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
hash: 3
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
version: "0"
|
122
|
+
requirement: *id007
|
109
123
|
description: A tail(1)-like utility for nginx log files. It supports parsing, filtering and formatting individual log lines.
|
110
124
|
email: pvandenberk@mac.com
|
111
125
|
executables:
|
@@ -126,9 +140,34 @@ files:
|
|
126
140
|
- bin/ntail
|
127
141
|
- lib/ntail.rb
|
128
142
|
- lib/ntail/application.rb
|
143
|
+
- lib/ntail/body_bytes_sent.rb
|
144
|
+
- lib/ntail/http_method.rb
|
145
|
+
- lib/ntail/http_referer.rb
|
146
|
+
- lib/ntail/http_user_agent.rb
|
147
|
+
- lib/ntail/http_version.rb
|
148
|
+
- lib/ntail/known_ip_addresses.rb
|
149
|
+
- lib/ntail/local_ip_addresses.rb
|
129
150
|
- lib/ntail/log_line.rb
|
151
|
+
- lib/ntail/proxy_addresses.rb
|
152
|
+
- lib/ntail/remote_addr.rb
|
153
|
+
- lib/ntail/remote_user.rb
|
154
|
+
- lib/ntail/request.rb
|
155
|
+
- lib/ntail/status.rb
|
156
|
+
- lib/ntail/time_local.rb
|
157
|
+
- lib/ntail/uri.rb
|
130
158
|
- ntail.gemspec
|
131
159
|
- test/helper.rb
|
160
|
+
- test/ntail/test_http_method.rb
|
161
|
+
- test/ntail/test_http_referer.rb
|
162
|
+
- test/ntail/test_http_user_agent.rb
|
163
|
+
- test/ntail/test_known_ip_addresses.rb
|
164
|
+
- test/ntail/test_local_ip_addresses.rb
|
165
|
+
- test/ntail/test_log_line.rb
|
166
|
+
- test/ntail/test_remote_addr.rb
|
167
|
+
- test/ntail/test_remote_user.rb
|
168
|
+
- test/ntail/test_request.rb
|
169
|
+
- test/ntail/test_status.rb
|
170
|
+
- test/ntail/test_time_local.rb
|
132
171
|
- test/test_ntail.rb
|
133
172
|
has_rdoc: true
|
134
173
|
homepage: http://github.com/pvdb/ntail
|
@@ -166,4 +205,15 @@ specification_version: 3
|
|
166
205
|
summary: A tail(1)-like utility for nginx log files
|
167
206
|
test_files:
|
168
207
|
- test/helper.rb
|
208
|
+
- test/ntail/test_http_method.rb
|
209
|
+
- test/ntail/test_http_referer.rb
|
210
|
+
- test/ntail/test_http_user_agent.rb
|
211
|
+
- test/ntail/test_known_ip_addresses.rb
|
212
|
+
- test/ntail/test_local_ip_addresses.rb
|
213
|
+
- test/ntail/test_log_line.rb
|
214
|
+
- test/ntail/test_remote_addr.rb
|
215
|
+
- test/ntail/test_remote_user.rb
|
216
|
+
- test/ntail/test_request.rb
|
217
|
+
- test/ntail/test_status.rb
|
218
|
+
- test/ntail/test_time_local.rb
|
169
219
|
- test/test_ntail.rb
|