logmerge 1.0.0 → 1.0.2

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/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
- All original code copyright 2005 Eric Hodel, The Robot Co-op. All rights
2
- reserved.
1
+ All original code copyright 2005 Eric Hodel, The Robot Co-op, Klaas Jan Wierenga.
2
+ All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
5
5
  modification, are permitted provided that the following conditions
data/README CHANGED
@@ -1,6 +1,10 @@
1
1
  = logmerge
2
2
 
3
- Rubyforge Project:
3
+ Logmerge is hosted on RubyGems.org starting with version 1.0.1
4
+
5
+ http://rubygems.org/gems/logmerge
6
+
7
+ (Original) Rubyforge Project:
4
8
 
5
9
  http://rubyforge.org/projects/rctools/
6
10
 
data/Rakefile CHANGED
@@ -7,10 +7,16 @@ $VERBOSE = nil
7
7
 
8
8
  spec = Gem::Specification.new do |s|
9
9
  s.name = 'logmerge'
10
- s.version = '1.0.0'
10
+ s.version = '1.0.2'
11
11
  s.summary = 'Resolves IP addresses and merges Apache access logs.'
12
- s.author = 'Eric Hodel'
13
- s.email = 'eric@robotcoop.com'
12
+ s.authors = [ 'Eric Hodel', 'Klaas Jan Wierenga' ]
13
+ s.email = [ 'eric@robotcoop.com', 'k.j.wierenga@gmail.com' ]
14
+ s.homepage = 'http://github.com/kjwierenga/logmerge'
15
+ s.description = "
16
+ Logmerge contains two utilities logmerge and ip2name. logmerge merges Apache
17
+ access logs into one log ordered by date. ip2name performs DNS lookups on
18
+ Apache access logs using multiple threads and Ruby's DNS resolver library to
19
+ speed through log files."
14
20
 
15
21
  s.files = File.read('Manifest.txt').split($/)
16
22
  s.require_path = 'lib'
data/bin/ip2name CHANGED
@@ -1,4 +1,5 @@
1
- #!/usr/local/bin/ruby -w
1
+ #!/usr/bin/env ruby -w
2
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
3
 
3
4
  require 'logmerge'
4
5
 
data/bin/logmerge CHANGED
@@ -1,4 +1,5 @@
1
- #!/usr/local/bin/ruby -w
1
+ #!/usr/bin/env ruby -w
2
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
3
 
3
4
  require 'logmerge'
4
5
 
@@ -23,8 +23,22 @@ class LogMerge::Merger
23
23
  def initialize(streams)
24
24
  @streams = streams
25
25
  @buf = []
26
-
27
- @streams.each_index { |slot| buf_fill slot }
26
+
27
+ # The next line causes failure when a stream is empty in the
28
+ # initial call to buf_fill. When @streams[slot].eof? == true buf_fill
29
+ # removes the element from from @streams and @buf causing the each_index
30
+ # iterator to terminate early.
31
+ #
32
+ # @streams.each_index { |slot| buf_fill slot }
33
+ #
34
+ # Replace by
35
+ #
36
+ # @streams.size.downto(1) { |slot| buf_fill slot-1 }
37
+ #
38
+ # which removes empty streams from the end of the @streams and @buf arrays
39
+ # making sure we iterate over all elements of @streams and @buf.
40
+
41
+ @streams.size.downto(1) { |slot| buf_fill slot-1 }
28
42
 
29
43
  @all_closed = @streams.empty?
30
44
  end
data/resolv_test CHANGED
File without changes
data/test/test_merger.rb CHANGED
@@ -77,6 +77,27 @@ class TestMerger < Test::Unit::TestCase
77
77
  [17/Jan/2006:00:00:01 -0800]
78
78
  [17/Jan/2006:00:00:02 -0800]
79
79
  EOF
80
+
81
+ assert_equal true, merger.all_closed?
82
+ assert_equal expected, output.string
83
+ end
84
+
85
+ def test_empty_files
86
+ require 'tempfile'
87
+ tf = Tempfile.new('test_empty_file')
88
+ tf.flush
89
+
90
+ stream1 = File.open(tf.path) # empty file1
91
+ stream2 = File.open(tf.path) # empty file2
92
+ stream3 = File.open(tf.path) # empty file3
93
+
94
+ merger = LogMerge::Merger.new [stream1, stream2, stream3]
95
+
96
+ output = StringIO.new
97
+
98
+ merger.merge output
99
+
100
+ expected = ""
80
101
 
81
102
  assert_equal true, merger.all_closed?
82
103
  assert_equal expected, output.string
metadata CHANGED
@@ -1,32 +1,40 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11.6
3
- specification_version: 1
4
2
  name: logmerge
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.0.0
7
- date: 2006-01-20 00:00:00 -08:00
8
- summary: Resolves IP addresses and merges Apache access logs.
9
- require_paths:
10
- - lib
11
- email: eric@robotcoop.com
12
- homepage:
13
- rubyforge_project:
14
- description:
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: false
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 2
9
+ version: 1.0.2
25
10
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
11
  authors:
29
12
  - Eric Hodel
13
+ - Klaas Jan Wierenga
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-05-04 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: |-
23
+
24
+ Logmerge contains two utilities logmerge and ip2name. logmerge merges Apache
25
+ access logs into one log ordered by date. ip2name performs DNS lookups on
26
+ Apache access logs using multiple threads and Ruby's DNS resolver library to
27
+ speed through log files.
28
+ email:
29
+ - eric@robotcoop.com
30
+ - k.j.wierenga@gmail.com
31
+ executables:
32
+ - ip2name
33
+ - logmerge
34
+ extensions: []
35
+
36
+ extra_rdoc_files: []
37
+
30
38
  files:
31
39
  - LICENSE
32
40
  - Manifest.txt
@@ -42,18 +50,35 @@ files:
42
50
  - test/access.log
43
51
  - test/test_merger.rb
44
52
  - test/test_resolver.rb
45
- test_files: []
53
+ has_rdoc: true
54
+ homepage: http://github.com/kjwierenga/logmerge
55
+ licenses: []
46
56
 
57
+ post_install_message:
47
58
  rdoc_options: []
48
59
 
49
- extra_rdoc_files: []
50
-
51
- executables:
52
- - ip2name
53
- - logmerge
54
- extensions: []
55
-
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 0
75
+ version: "0"
56
76
  requirements: []
57
77
 
58
- dependencies: []
78
+ rubyforge_project:
79
+ rubygems_version: 1.3.6
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Resolves IP addresses and merges Apache access logs.
83
+ test_files: []
59
84