vizi_translator 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +44 -0
- data/build_gem1.bat +1 -0
- data/build_gem2.bat +1 -0
- data/build_gem3.bat +1 -0
- data/build_gem4.bat +1 -0
- data/data/index.md +17 -0
- data/data/testfile.txt +4 -0
- data/doc/Object.html +200 -0
- data/doc/ParserTest.html +268 -0
- data/doc/README_rdoc.html +128 -0
- data/doc/Rakefile.html +148 -0
- data/doc/Visit.html +487 -0
- data/doc/VisitList.html +385 -0
- data/doc/Vizi/LogFormat.html +377 -0
- data/doc/Vizi/LogParser.html +551 -0
- data/doc/Vizi/Translator.html +302 -0
- data/doc/Vizi/UnSupportedLanguage.html +212 -0
- data/doc/Vizi/Visit.html +487 -0
- data/doc/Vizi/VisitList.html +386 -0
- data/doc/Vizi.html +159 -0
- data/doc/ViziLogFormat.html +382 -0
- data/doc/ViziLogParser.html +551 -0
- data/doc/created.rid +4 -0
- data/doc/docs/Whois_Documentation.doc +0 -0
- data/doc/formats/apache-custom-log.pdf +0 -0
- data/doc/formats/apache.rtf +238 -0
- data/doc/formats/format-descriptions.xls +0 -0
- data/doc/formats/w3c-extended.pdf +0 -0
- data/doc/formats/w3c-extended.rtf +135 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +68 -0
- data/doc/js/darkfish.js +116 -0
- data/doc/js/jquery.js +32 -0
- data/doc/js/quicksearch.js +114 -0
- data/doc/js/thickbox-compressed.js +10 -0
- data/doc/lib/vizi/parser_rb.html +63 -0
- data/doc/lib/vizi/vizi_tracker_rb.html +63 -0
- data/doc/lib/vizi/vizi_translator.html +104 -0
- data/doc/lib/vizi/vizi_translator_rb.html +69 -0
- data/doc/lib/vizi_log_parser_rb.html +56 -0
- data/doc/lib/vizi_tracker_rb.html +56 -0
- data/doc/lib/vizi_translator_rb.html +54 -0
- data/doc/rdoc.css +759 -0
- data/doc/test/parser_test_rb.html +54 -0
- data/doc/test/test_helper_rb.html +56 -0
- data/doc/testit_rb.html +63 -0
- data/geany_run_script.bat +6 -0
- data/lib/vizi/vizi_translator +11 -0
- data/lib/vizi/vizi_translator.rb +68 -0
- data/lib/vizi_translator.rb +5 -0
- data/log/system.log +1 -0
- data/testit.rb +51 -0
- data/vizi_translator.gemspec +17 -0
- metadata +122 -0
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
require 'rake/testtask'
|
5
|
+
|
6
|
+
spec = Gem::Specification.new do |s|
|
7
|
+
s.name = "http-log-parser"
|
8
|
+
s.version = "0.0.2"
|
9
|
+
s.author = "Torsten Curdt"
|
10
|
+
s.email = "tcurdt at vafer.org"
|
11
|
+
s.homepage = "http://github.com/tcurdt/http-log-parser"
|
12
|
+
s.description = "HTTP log file parser"
|
13
|
+
s.summary = "A package for parsing web server logs."
|
14
|
+
|
15
|
+
s.platform = Gem::Platform::RUBY
|
16
|
+
s.has_rdoc = true
|
17
|
+
s.extra_rdoc_files = ["README.rdoc"]
|
18
|
+
|
19
|
+
s.require_path = "lib"
|
20
|
+
s.files = %w(README.rdoc Rakefile) + Dir.glob("lib/**/*")
|
21
|
+
end
|
22
|
+
|
23
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
24
|
+
pkg.need_tar = true
|
25
|
+
end
|
26
|
+
|
27
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
28
|
+
rdoc.rdoc_dir = 'rdoc'
|
29
|
+
rdoc.title = 'HttpLogParser'
|
30
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
31
|
+
rdoc.rdoc_files.include('README')
|
32
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
33
|
+
end
|
34
|
+
|
35
|
+
Rake::TestTask.new do |t|
|
36
|
+
t.libs << 'test'
|
37
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
38
|
+
t.verbose = true
|
39
|
+
end
|
40
|
+
|
41
|
+
task :default => "pkg/#{spec.name}-#{spec.version}.gem" do
|
42
|
+
puts "generated latest version"
|
43
|
+
end
|
44
|
+
|
data/build_gem1.bat
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gem uninstall vizi_translator
|
data/build_gem2.bat
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gem build vizi_translator.gemspec
|
data/build_gem3.bat
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gem install -l vizi_translator-0.1.0.gem
|
data/build_gem4.bat
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rake rdoc
|
data/data/index.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
![Visitor tracking](/images/visitors.jpg)
|
2
|
+
# Welcome to our new website
|
3
|
+
If you are a returning visit to our site, you will see many changes.
|
4
|
+
|
5
|
+
The first change you will see is a new layout that is a result of the move to Ramaze language.
|
6
|
+
|
7
|
+
If you are not familiar with Ramaze, you can find more information at [Ramaze web site](http://ramaze.net).
|
8
|
+
|
9
|
+
Another change that you will discover is the use of Google docs spreadsheets to store the results of the weekly production analysis.
|
10
|
+
|
11
|
+
The Google spreadsheets provide more capabilities including visitor mapping and additional pivot analysis.
|
12
|
+
|
13
|
+
Here is a sample map that is available with the Google tool.
|
14
|
+
|
15
|
+
![Sample world map](/images/world_map.jpg)
|
16
|
+
|
17
|
+
...
|
data/data/testfile.txt
ADDED
data/doc/Object.html
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
<?xml version="1.0" encoding="IBM437"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=IBM437" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Class: Object</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
<script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body id="top" class="class">
|
19
|
+
|
20
|
+
<div id="metadata">
|
21
|
+
<div id="home-metadata">
|
22
|
+
<div id="home-section" class="section">
|
23
|
+
<h3 class="section-header">
|
24
|
+
<a href="./index.html">Home</a>
|
25
|
+
<a href="./index.html#classes">Classes</a>
|
26
|
+
<a href="./index.html#methods">Methods</a>
|
27
|
+
</h3>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="file-metadata">
|
32
|
+
<div id="file-list-section" class="section">
|
33
|
+
<h3 class="section-header">In Files</h3>
|
34
|
+
<div class="section-body">
|
35
|
+
<ul>
|
36
|
+
|
37
|
+
<li><a href="./testit_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="testit.rb">testit.rb</a></li>
|
39
|
+
|
40
|
+
</ul>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div id="class-metadata">
|
48
|
+
|
49
|
+
<!-- Parent Class -->
|
50
|
+
<div id="parent-class-section" class="section">
|
51
|
+
<h3 class="section-header">Parent</h3>
|
52
|
+
|
53
|
+
<p class="link"></p>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
<!-- Method Quickref -->
|
64
|
+
<div id="method-list-section" class="section">
|
65
|
+
<h3 class="section-header">Methods</h3>
|
66
|
+
<ul class="link-list">
|
67
|
+
|
68
|
+
<li><a href="#method-i-find_visit_in_list">#find_visit_in_list</a></li>
|
69
|
+
|
70
|
+
</ul>
|
71
|
+
</div>
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
</div>
|
76
|
+
|
77
|
+
<div id="project-metadata">
|
78
|
+
|
79
|
+
|
80
|
+
<div id="fileindex-section" class="section project-section">
|
81
|
+
<h3 class="section-header">Files</h3>
|
82
|
+
<ul>
|
83
|
+
|
84
|
+
<li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
|
85
|
+
|
86
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a></li>
|
87
|
+
|
88
|
+
</ul>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
<div id="classindex-section" class="section project-section">
|
93
|
+
<h3 class="section-header">Class/Module Index
|
94
|
+
<span class="search-toggle"><img src="./images/find.png"
|
95
|
+
height="16" width="16" alt="[+]"
|
96
|
+
title="show/hide quicksearch" /></span></h3>
|
97
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
98
|
+
<fieldset>
|
99
|
+
<legend>Quicksearch</legend>
|
100
|
+
<input type="text" name="quicksearch" value=""
|
101
|
+
class="quicksearch-field" />
|
102
|
+
</fieldset>
|
103
|
+
</form>
|
104
|
+
|
105
|
+
<ul class="link-list">
|
106
|
+
|
107
|
+
<li><a href="./Vizi.html">Vizi</a></li>
|
108
|
+
|
109
|
+
<li><a href="./Vizi/LogFormat.html">Vizi::LogFormat</a></li>
|
110
|
+
|
111
|
+
<li><a href="./Vizi/LogParser.html">Vizi::LogParser</a></li>
|
112
|
+
|
113
|
+
<li><a href="./Vizi/Visit.html">Vizi::Visit</a></li>
|
114
|
+
|
115
|
+
<li><a href="./Vizi/VisitList.html">Vizi::VisitList</a></li>
|
116
|
+
|
117
|
+
<li><a href="./Object.html">Object</a></li>
|
118
|
+
|
119
|
+
<li><a href="./ParserTest.html">ParserTest</a></li>
|
120
|
+
|
121
|
+
</ul>
|
122
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
|
126
|
+
</div>
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<div id="documentation">
|
130
|
+
<h1 class="class">Object</h1>
|
131
|
+
|
132
|
+
<div id="description" class="description">
|
133
|
+
|
134
|
+
</div><!-- description -->
|
135
|
+
|
136
|
+
|
137
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
<!-- Methods -->
|
147
|
+
|
148
|
+
<div id="public-instance-method-details" class="method-section section">
|
149
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
150
|
+
|
151
|
+
|
152
|
+
<div id="find_visit_in_list-method" class="method-detail ">
|
153
|
+
<a name="method-i-find_visit_in_list"></a>
|
154
|
+
|
155
|
+
|
156
|
+
<div class="method-heading">
|
157
|
+
<span class="method-name">find_visit_in_list</span><span
|
158
|
+
class="method-args">(ip)</span>
|
159
|
+
<span class="method-click-advice">click to toggle source</span>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
|
163
|
+
<div class="method-description">
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<div class="method-source-code" id="find_visit_in_list-source">
|
170
|
+
<pre>
|
171
|
+
<span class="ruby-comment"># File testit.rb, line 18</span>
|
172
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find_visit_in_list</span>(<span class="ruby-identifier">ip</span>)
|
173
|
+
<span class="ruby-ivar">@visits</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">visit</span><span class="ruby-operator">|</span> <span class="ruby-identifier">visit</span>.<span class="ruby-identifier">ip</span> = <span class="ruby-identifier">ip</span> }
|
174
|
+
<span class="ruby-keyword">end</span></pre>
|
175
|
+
</div><!-- find_visit_in_list-source -->
|
176
|
+
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
</div><!-- find_visit_in_list-method -->
|
183
|
+
|
184
|
+
|
185
|
+
</div><!-- public-instance-method-details -->
|
186
|
+
|
187
|
+
</div><!-- 5Buntitled-5D -->
|
188
|
+
|
189
|
+
|
190
|
+
</div><!-- documentation -->
|
191
|
+
|
192
|
+
<div id="validator-badges">
|
193
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
194
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
195
|
+
Rdoc Generator</a> 2</small>.</p>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
</body>
|
199
|
+
</html>
|
200
|
+
|
data/doc/ParserTest.html
ADDED
@@ -0,0 +1,268 @@
|
|
1
|
+
<?xml version="1.0" encoding="IBM437"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=IBM437" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Class: ParserTest</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
<script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body id="top" class="class">
|
19
|
+
|
20
|
+
<div id="metadata">
|
21
|
+
<div id="home-metadata">
|
22
|
+
<div id="home-section" class="section">
|
23
|
+
<h3 class="section-header">
|
24
|
+
<a href="./index.html">Home</a>
|
25
|
+
<a href="./index.html#classes">Classes</a>
|
26
|
+
<a href="./index.html#methods">Methods</a>
|
27
|
+
</h3>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="file-metadata">
|
32
|
+
<div id="file-list-section" class="section">
|
33
|
+
<h3 class="section-header">In Files</h3>
|
34
|
+
<div class="section-body">
|
35
|
+
<ul>
|
36
|
+
|
37
|
+
<li><a href="./test/parser_test_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="test/parser_test.rb">test/parser_test.rb</a></li>
|
39
|
+
|
40
|
+
</ul>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div id="class-metadata">
|
48
|
+
|
49
|
+
<!-- Parent Class -->
|
50
|
+
<div id="parent-class-section" class="section">
|
51
|
+
<h3 class="section-header">Parent</h3>
|
52
|
+
|
53
|
+
<p class="link">Test::Unit::TestCase</p>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
<!-- Method Quickref -->
|
64
|
+
<div id="method-list-section" class="section">
|
65
|
+
<h3 class="section-header">Methods</h3>
|
66
|
+
<ul class="link-list">
|
67
|
+
|
68
|
+
<li><a href="#method-i-test_parser_creation">#test_parser_creation</a></li>
|
69
|
+
|
70
|
+
<li><a href="#method-i-test_simple_parsing">#test_simple_parsing</a></li>
|
71
|
+
|
72
|
+
</ul>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="project-metadata">
|
80
|
+
|
81
|
+
|
82
|
+
<div id="fileindex-section" class="section project-section">
|
83
|
+
<h3 class="section-header">Files</h3>
|
84
|
+
<ul>
|
85
|
+
|
86
|
+
<li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
|
87
|
+
|
88
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a></li>
|
89
|
+
|
90
|
+
</ul>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
|
94
|
+
<div id="classindex-section" class="section project-section">
|
95
|
+
<h3 class="section-header">Class/Module Index
|
96
|
+
<span class="search-toggle"><img src="./images/find.png"
|
97
|
+
height="16" width="16" alt="[+]"
|
98
|
+
title="show/hide quicksearch" /></span></h3>
|
99
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
100
|
+
<fieldset>
|
101
|
+
<legend>Quicksearch</legend>
|
102
|
+
<input type="text" name="quicksearch" value=""
|
103
|
+
class="quicksearch-field" />
|
104
|
+
</fieldset>
|
105
|
+
</form>
|
106
|
+
|
107
|
+
<ul class="link-list">
|
108
|
+
|
109
|
+
<li><a href="./Vizi.html">Vizi</a></li>
|
110
|
+
|
111
|
+
<li><a href="./Vizi/LogFormat.html">Vizi::LogFormat</a></li>
|
112
|
+
|
113
|
+
<li><a href="./Vizi/LogParser.html">Vizi::LogParser</a></li>
|
114
|
+
|
115
|
+
<li><a href="./Vizi/Visit.html">Vizi::Visit</a></li>
|
116
|
+
|
117
|
+
<li><a href="./Vizi/VisitList.html">Vizi::VisitList</a></li>
|
118
|
+
|
119
|
+
<li><a href="./Object.html">Object</a></li>
|
120
|
+
|
121
|
+
<li><a href="./ParserTest.html">ParserTest</a></li>
|
122
|
+
|
123
|
+
</ul>
|
124
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
|
131
|
+
<div id="documentation">
|
132
|
+
<h1 class="class">ParserTest</h1>
|
133
|
+
|
134
|
+
<div id="description" class="description">
|
135
|
+
|
136
|
+
</div><!-- description -->
|
137
|
+
|
138
|
+
|
139
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<!-- Methods -->
|
149
|
+
|
150
|
+
<div id="public-instance-method-details" class="method-section section">
|
151
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
152
|
+
|
153
|
+
|
154
|
+
<div id="test_parser_creation-method" class="method-detail ">
|
155
|
+
<a name="method-i-test_parser_creation"></a>
|
156
|
+
|
157
|
+
|
158
|
+
<div class="method-heading">
|
159
|
+
<span class="method-name">test_parser_creation</span><span
|
160
|
+
class="method-args">()</span>
|
161
|
+
<span class="method-click-advice">click to toggle source</span>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
|
165
|
+
<div class="method-description">
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<div class="method-source-code" id="test_parser_creation-source">
|
172
|
+
<pre>
|
173
|
+
<span class="ruby-comment"># File test/parser_test.rb, line 7</span>
|
174
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">test_parser_creation</span>
|
175
|
+
|
176
|
+
<span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpLogParser</span>.<span class="ruby-identifier">new</span>
|
177
|
+
<span class="ruby-identifier">assert_not_nil</span> <span class="ruby-identifier">parser</span>
|
178
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-value">5</span>, <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">formats</span>.<span class="ruby-identifier">size</span>
|
179
|
+
|
180
|
+
<span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpLogParser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'%h %l %u %t \"%r\" %>s %b'</span>)
|
181
|
+
<span class="ruby-identifier">assert_not_nil</span> <span class="ruby-identifier">parser</span>
|
182
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-value">1</span>, <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">formats</span>.<span class="ruby-identifier">size</span>
|
183
|
+
|
184
|
+
<span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpLogParser</span>.<span class="ruby-identifier">new</span>({
|
185
|
+
<span class="ruby-value">:common</span> =<span class="ruby-operator">></span> <span class="ruby-string">'%h %l %u %t \"%r\" %>s %b'</span>,
|
186
|
+
<span class="ruby-value">:common_with_virtual</span> =<span class="ruby-operator">></span> <span class="ruby-string">'%v %h %l %u %t \"%r\" %>s %b'</span>,
|
187
|
+
})
|
188
|
+
<span class="ruby-identifier">assert_not_nil</span> <span class="ruby-identifier">parser</span>
|
189
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-value">2</span>, <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">formats</span>.<span class="ruby-identifier">size</span>
|
190
|
+
|
191
|
+
<span class="ruby-keyword">end</span></pre>
|
192
|
+
</div><!-- test_parser_creation-source -->
|
193
|
+
|
194
|
+
</div>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
</div><!-- test_parser_creation-method -->
|
200
|
+
|
201
|
+
|
202
|
+
<div id="test_simple_parsing-method" class="method-detail ">
|
203
|
+
<a name="method-i-test_simple_parsing"></a>
|
204
|
+
|
205
|
+
|
206
|
+
<div class="method-heading">
|
207
|
+
<span class="method-name">test_simple_parsing</span><span
|
208
|
+
class="method-args">()</span>
|
209
|
+
<span class="method-click-advice">click to toggle source</span>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
|
213
|
+
<div class="method-description">
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<div class="method-source-code" id="test_simple_parsing-source">
|
220
|
+
<pre>
|
221
|
+
<span class="ruby-comment"># File test/parser_test.rb, line 26</span>
|
222
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">test_simple_parsing</span>
|
223
|
+
|
224
|
+
<span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpLogParser</span>.<span class="ruby-identifier">new</span>
|
225
|
+
<span class="ruby-identifier">assert_not_nil</span> <span class="ruby-identifier">parser</span>
|
226
|
+
|
227
|
+
<span class="ruby-identifier">parsed</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">parse_line</span>(<span class="ruby-string">'111.222.333.444 - - [21/Apr/2010:01:02:03 +0000] "GET /some/url?some=parameter HTTP/1.1" 302 123 "http://somewhere.com" "Browser (Version 1.0)"'</span>)
|
228
|
+
|
229
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-string">'111.222.333.444'</span>, <span class="ruby-identifier">parsed</span>[<span class="ruby-value">:ip</span>]
|
230
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-string">'111.222.333.444'</span>, <span class="ruby-identifier">parsed</span>[<span class="ruby-value">:domain</span>]
|
231
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-string">'-'</span>, <span class="ruby-identifier">parsed</span>[<span class="ruby-value">:auth</span>]
|
232
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-string">'-'</span>, <span class="ruby-identifier">parsed</span>[<span class="ruby-value">:username</span>]
|
233
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-string">'21/Apr/2010:01:02:03 +0000'</span>, <span class="ruby-identifier">parsed</span>[<span class="ruby-value">:datetime</span>]
|
234
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-string">'GET /some/url?some=parameter HTTP/1.1'</span>, <span class="ruby-identifier">parsed</span>[<span class="ruby-value">:request</span>]
|
235
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-string">'302'</span>, <span class="ruby-identifier">parsed</span>[<span class="ruby-value">:status</span>]
|
236
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-string">'123'</span>, <span class="ruby-identifier">parsed</span>[<span class="ruby-value">:bytecount</span>]
|
237
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-string">'http://somewhere.com'</span>, <span class="ruby-identifier">parsed</span>[<span class="ruby-value">:referer</span>]
|
238
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-string">'Browser (Version 1.0)'</span>, <span class="ruby-identifier">parsed</span>[<span class="ruby-value">:user_agent</span>]
|
239
|
+
|
240
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-value">11</span>, <span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">size</span>
|
241
|
+
|
242
|
+
<span class="ruby-keyword">end</span></pre>
|
243
|
+
</div><!-- test_simple_parsing-source -->
|
244
|
+
|
245
|
+
</div>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
</div><!-- test_simple_parsing-method -->
|
251
|
+
|
252
|
+
|
253
|
+
</div><!-- public-instance-method-details -->
|
254
|
+
|
255
|
+
</div><!-- 5Buntitled-5D -->
|
256
|
+
|
257
|
+
|
258
|
+
</div><!-- documentation -->
|
259
|
+
|
260
|
+
<div id="validator-badges">
|
261
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
262
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
263
|
+
Rdoc Generator</a> 2</small>.</p>
|
264
|
+
</div>
|
265
|
+
|
266
|
+
</body>
|
267
|
+
</html>
|
268
|
+
|