http-log-parser 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +1 -1
  2. data/Rakefile +16 -18
  3. data/lib/http/parser.rb +4 -3
  4. metadata +22 -38
@@ -18,7 +18,7 @@ That should take care of it.
18
18
 
19
19
  parser = HttpLogParser.new
20
20
 
21
- File.open('/path/to.log', 'r') do |file|
21
+ File.open('/path/to.log', 'r:ascii-8bit') do |file|
22
22
  while(line = file.gets)
23
23
  parsed_data = parser.parse_line(line)
24
24
  p parsed_data
data/Rakefile CHANGED
@@ -1,27 +1,26 @@
1
1
  require 'rubygems'
2
+ # require 'rubygems/package_task'
2
3
  require 'rake/gempackagetask'
3
- require 'rake/rdoctask'
4
+ require 'rdoc/task'
4
5
  require 'rake/testtask'
5
6
 
6
7
  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/**/*")
8
+ s.summary = "A package for parsing web server logs."
9
+ s.description = "HTTP log file parser"
10
+ s.platform = Gem::Platform::RUBY
11
+ s.name = "http-log-parser"
12
+ s.version = "0.0.3"
13
+ s.author = "Torsten Curdt"
14
+ s.email = "tcurdt at vafer.org"
15
+ s.homepage = "http://github.com/tcurdt/http-log-parser"
16
+ s.has_rdoc = true
17
+ s.extra_rdoc_files = [ "README.rdoc" ]
18
+ s.require_path = "lib"
19
+ s.files = %w(README.rdoc Rakefile) + Dir.glob("lib/**/*")
21
20
  end
22
21
 
23
22
  Rake::GemPackageTask.new(spec) do |pkg|
24
- pkg.need_tar = true
23
+ pkg.need_tar = true
25
24
  end
26
25
 
27
26
  Rake::RDocTask.new(:rdoc) do |rdoc|
@@ -34,11 +33,10 @@ end
34
33
 
35
34
  Rake::TestTask.new do |t|
36
35
  t.libs << 'test'
37
- t.test_files = FileList["test/**/*_test.rb"]
36
+ t.test_files = FileList[ "test/**/*_test.rb" ]
38
37
  t.verbose = true
39
38
  end
40
39
 
41
40
  task :default => "pkg/#{spec.name}-#{spec.version}.gem" do
42
41
  puts "generated latest version"
43
42
  end
44
-
@@ -82,12 +82,13 @@ class HttpLogParser
82
82
  end
83
83
 
84
84
  def parse_line(line)
85
-
85
+
86
86
  if @format.nil?
87
87
  @format = format_from_line(line)
88
+ raise "Failed to detect format" if @format.nil?
88
89
  end
89
-
90
- raise ArgumentError if @format.nil? or line !~ @format.format_regex
90
+
91
+ raise "Line does not match format" if line !~ @format.format_regex
91
92
 
92
93
  data = line.scan(@format.format_regex).flatten
93
94
  parsed_data = {}
metadata CHANGED
@@ -1,65 +1,49 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: http-log-parser
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 2
9
- version: 0.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Torsten Curdt
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2010-04-23 00:00:00 +02:00
18
- default_executable:
12
+ date: 2012-07-08 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description: HTTP log file parser
22
15
  email: tcurdt at vafer.org
23
16
  executables: []
24
-
25
17
  extensions: []
26
-
27
- extra_rdoc_files:
18
+ extra_rdoc_files:
28
19
  - README.rdoc
29
- files:
20
+ files:
30
21
  - README.rdoc
31
22
  - Rakefile
32
23
  - lib/http/parser.rb
33
24
  - lib/http_log_parser.rb
34
- has_rdoc: true
35
25
  homepage: http://github.com/tcurdt/http-log-parser
36
26
  licenses: []
37
-
38
27
  post_install_message:
39
28
  rdoc_options: []
40
-
41
- require_paths:
29
+ require_paths:
42
30
  - lib
43
- required_ruby_version: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- segments:
48
- - 0
49
- version: "0"
50
- required_rubygems_version: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- segments:
55
- - 0
56
- version: "0"
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
57
43
  requirements: []
58
-
59
44
  rubyforge_project:
60
- rubygems_version: 1.3.6
45
+ rubygems_version: 1.8.24
61
46
  signing_key:
62
47
  specification_version: 3
63
48
  summary: A package for parsing web server logs.
64
49
  test_files: []
65
-