log_weaver 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZTUxZmMwMjA5ZWY3ZGMwOGIyYmUwMzEyZDVhZWM4MjFkMzUwODAwYw==
5
+ data.tar.gz: !binary |-
6
+ M2QzN2Y3OWNmM2ZiMjAwNTFjNzQ4NmM0NzFjMTM3MDA4YWNiZWY1Yg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MDQ2NzQ3Y2U2NDAwODk2NmRmMmU3MWUzNDMzNDVjYzQ3MmVhNTQ0NzllOGUz
10
+ MTg5ZjdiNmE0YjYxMTFmYmVlYmFlZjE3MmQ4ZWM2ZTk2NDA2NjIyZDQ1Zjkw
11
+ ODJkMDU1NDAxODBmYjViMDg5OTc2OWJhYzk0MGUzMzVjYTM5NTA=
12
+ data.tar.gz: !binary |-
13
+ NzRmMmUyZTA0OTY1YzdjZTJmNTAxZDNjYWE2YjcyNWQ4ZGI5MGFjNjFjYTlm
14
+ YWMzMGExNDU4ZDQwYzAxODJlMTNjMjk2NGVlOTE1ZWIyNDUyMTg3NzE2ODhh
15
+ NzI4NDBiOWUwY2Y4MzZlMTc3MzM0MDgwMzMyNjNjMTViYmFmNjk=
data/.hgignore ADDED
@@ -0,0 +1,9 @@
1
+ .DS_Store
2
+ results.html
3
+ pkg
4
+ html
5
+ .idea
6
+
7
+ tmp
8
+ test.rb
9
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in log_weaver.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,62 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ log_weaver (0.0.1)
5
+ methadone (~> 1.2)
6
+ require_all (~> 1.2)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (3.2.13)
12
+ i18n (= 0.6.1)
13
+ multi_json (~> 1.0)
14
+ aruba (0.5.2)
15
+ childprocess (~> 0.3.6)
16
+ cucumber (>= 1.1.1)
17
+ rspec-expectations (>= 2.7.0)
18
+ builder (3.2.0)
19
+ childprocess (0.3.9)
20
+ ffi (~> 1.0, >= 1.0.11)
21
+ cucumber (1.3.1)
22
+ builder (>= 2.1.2)
23
+ diff-lcs (>= 1.1.3)
24
+ gherkin (~> 2.12.0)
25
+ multi_json (~> 1.3)
26
+ diff-lcs (1.2.4)
27
+ factory_girl (4.2.0)
28
+ activesupport (>= 3.0.0)
29
+ ffi (1.7.0-x86-mingw32)
30
+ gherkin (2.12.0-x86-mingw32)
31
+ multi_json (~> 1.3)
32
+ i18n (0.6.1)
33
+ methadone (1.2.6)
34
+ bundler
35
+ multi_json (1.7.2)
36
+ rake (0.9.6)
37
+ readme (0.1.0)
38
+ require_all (1.2.1)
39
+ rspec (2.13.0)
40
+ rspec-core (~> 2.13.0)
41
+ rspec-expectations (~> 2.13.0)
42
+ rspec-mocks (~> 2.13.0)
43
+ rspec-core (2.13.1)
44
+ rspec-expectations (2.13.0)
45
+ diff-lcs (>= 1.1.3, < 2.0)
46
+ rspec-mocks (2.13.1)
47
+ unindent (1.0)
48
+ yard (0.8.6.1)
49
+
50
+ PLATFORMS
51
+ x86-mingw32
52
+
53
+ DEPENDENCIES
54
+ aruba (~> 0.5)
55
+ cucumber (~> 1.2)
56
+ factory_girl (~> 4.2)
57
+ log_weaver!
58
+ rake (~> 0.9)
59
+ readme (~> 0.1)
60
+ rspec (~> 2.13)
61
+ unindent (~> 1.0)
62
+ yard (~> 0.8)
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 raphael
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # LogWeaver
2
+
3
+ [Website](http://fakeleft.github.com/log_weaver) /
4
+ [Development](http://github.com/fakeleft/log_weaver) /
5
+ [Issue Tracker](http://github.com/fakeleft/log_weaver/issues) /
6
+
7
+
8
+ ##Description
9
+
10
+ Weaves multiple log files into a single one using the timestamp in log entries.
11
+ Precedes each line with a portion of the source log file name so you can tell
12
+ which file a line came from.
13
+
14
+ ## Installation
15
+
16
+ gem install log_weaver
17
+
18
+ ## Usage
19
+
20
+ log_weaver --help
21
+
22
+ ## Copyright
23
+
24
+ Copyright (c) 2012 Raphael Borowiecki. All rights reserved.
25
+
26
+ ## License
27
+
28
+ MIT
29
+
30
+
31
+
data/Rakefile ADDED
@@ -0,0 +1,56 @@
1
+ require 'bundler'
2
+ require 'rake/clean'
3
+
4
+ require 'rspec/core/rake_task'
5
+
6
+ require 'cucumber'
7
+ require 'cucumber/rake/task'
8
+
9
+ include Rake::DSL
10
+
11
+ Bundler::GemHelper.install_tasks
12
+
13
+
14
+ RSpec::Core::RakeTask.new do |t|
15
+ # Put spec opts in a file named .rspec in root
16
+ end
17
+
18
+
19
+ CUKE_RESULTS = 'results.html'
20
+ CLEAN << CUKE_RESULTS
21
+ Cucumber::Rake::Task.new(:features) do |t|
22
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
23
+ t.fork = false
24
+ end
25
+
26
+ desc "Generate RDoc"
27
+ task :doc => ['doc:generate']
28
+
29
+ namespace :doc do
30
+ project_root = File.expand_path(File.join(File.dirname(__FILE__), '.'))
31
+ doc_destination = File.join(project_root, 'doc', 'rdoc')
32
+
33
+ begin
34
+ require 'yard'
35
+ require 'yard/rake/yardoc_task'
36
+
37
+ YARD::Rake::YardocTask.new(:generate) do |yt|
38
+ yt.files = Dir.glob(File.join(project_root, 'lib', '**', '*.rb'))
39
+ yt.options = ['--output-dir', doc_destination, '--readme', 'README.md']
40
+ end
41
+ rescue LoadError
42
+ desc "Generate YARD Documentation"
43
+ task :generate do
44
+ abort "Please install the YARD gem to generate rdoc."
45
+ end
46
+ end
47
+
48
+ desc "Remove generated documenation"
49
+ task :clean do
50
+ rm_r doc_destination if File.exists?(doc_destination)
51
+ end
52
+
53
+ end
54
+
55
+ task :default => [:spec,:features]
56
+
data/bin/log_weaver ADDED
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'methadone'
5
+
6
+ require 'log_weaver'
7
+
8
+ include LogWeaver::PrefixGenerator
9
+
10
+
11
+ module Methadone
12
+ module Main
13
+ include LogWeaver
14
+
15
+
16
+ def do_main(file1, file2, additional_files)
17
+ files = [file1, file2, *additional_files ]
18
+ files.each{ |f| exit_now!("File '#{f}' does not exist!") unless File.exists? f }
19
+
20
+ begin
21
+ file_prefixes = get_file_prefixes(files)
22
+ rescue ArgumentError => e
23
+ exit_now!(e.message)
24
+ end
25
+
26
+ parsed_logs = files.map{ |f| ParsedLog.new(file_prefixes[f], StringIO.new(File.open(f).read)) }
27
+ overall_log = CombinedLog.new(parsed_logs)
28
+ puts overall_log
29
+ end
30
+
31
+
32
+ end
33
+ end
34
+
35
+
36
+ class App
37
+ include Methadone::Main
38
+ include Methadone::CLILogging
39
+
40
+ main do |file1, file2, additional_files|
41
+ do_main file1, file2, additional_files
42
+ end
43
+
44
+ description "Weaves logs by timestamp."
45
+
46
+ arg :file1, "Path to first log file."
47
+ arg :file2, "Path to second log file."
48
+ #TODO: how do you capture variable number of optional args?
49
+ arg :additional_files, :optional, "Paths to subsequent log files."
50
+
51
+ version LogWeaver::VERSION
52
+
53
+ use_log_level_option
54
+
55
+ go!
56
+
57
+ end
data/cucumber.yml ADDED
@@ -0,0 +1,2 @@
1
+ default: FAILFAST=true
2
+
@@ -0,0 +1,430 @@
1
+ Feature: run command line app; weave log files by timestamp
2
+ As a log weaver user
3
+ I want to weave log files together into a single file
4
+ So troubleshooting doesn't drive me insane
5
+
6
+ Scenario: app has banner stating options and required arguments
7
+ When I get help for "log_weaver"
8
+ Then the exit status should be 0
9
+ And the banner should be present
10
+ And the banner should document that this app takes options
11
+ And the following options should be documented:
12
+ |--version|
13
+ And the banner should document that this app's arguments are:
14
+ | file1 | which is required |
15
+ | file2 | which is required |
16
+ | additional_files | which is optional |
17
+
18
+
19
+ Scenario: First file does not exist
20
+ Given no file named "file1"
21
+ And an empty file named "file2"
22
+ When I run `log_weaver file1 file2`
23
+ Then the exit status should not be 0
24
+ And the stderr should contain "File 'file1' does not exist!"
25
+
26
+ Scenario: Second file does not exist
27
+ Given an empty file named "file1"
28
+ And no file named "file2"
29
+ When I run `log_weaver file1 file2`
30
+ Then the exit status should not be 0
31
+ And the stderr should contain "File 'file2' does not exist!"
32
+
33
+ Scenario: Third file does not exist
34
+ Given an empty file named "file1"
35
+ And an empty file named "file2"
36
+ When I run `log_weaver file1 file2 file3`
37
+ Then the exit status should not be 0
38
+ And the stderr should contain "File 'file3' does not exist!"
39
+
40
+ #TODO: test (file2 file1 file1), (file1, file2, file1), etc
41
+ Scenario: file1 given twice
42
+ Given a file named "file1" with:
43
+ """
44
+ 2012-01-01 00:00:00.001 - line1
45
+ """
46
+ When I run `log_weaver file1 file1`
47
+ Then the exit status should not be 0
48
+ And the stderr should contain "File list is not unique."
49
+
50
+
51
+ # TODO: replace with scenarios
52
+ # each line in the output should be prefixed by a portion of its file name so it's clear
53
+ # which file it came from; use at least 4 characters, less if file name is shorter
54
+ # than 4, more if resulting prefixes match; pad things so lines start in the same column
55
+ # scenarios below use lines with no timestamp - output is in the same order as the file
56
+ # arguments
57
+ Scenario: first file has name shorter than 4
58
+ Given a file named "fil" with:
59
+ """
60
+ 2012-01-01 00:00:00.001 - line1
61
+ """
62
+ And a file named "file2" with:
63
+ """
64
+ 2012-01-01 00:00:00.002 - line2
65
+ """
66
+ When I successfully run `log_weaver fil file2`
67
+ Then the output should match:
68
+ """
69
+ fil: 2012-01-01 00:00:00.001 - line1
70
+ file: 2012-01-01 00:00:00.002 - line2
71
+ """
72
+
73
+ Scenario: 2 files with first 4 chars of file name match
74
+ Given a file named "file1" with:
75
+ """
76
+ 2012-01-01 00:00:00.001 - line1
77
+ """
78
+ And a file named "file2" with:
79
+ """
80
+ 2012-01-01 00:00:00.002 - line2
81
+ """
82
+ When I successfully run `log_weaver file1 file2`
83
+ Then the output should match:
84
+ """
85
+ file1: 2012-01-01 00:00:00.001 - line1
86
+ file2: 2012-01-01 00:00:00.002 - line2
87
+ """
88
+
89
+ Scenario: same file name, diff directory
90
+ Given a file named "a/file" with:
91
+ """
92
+ 2012-01-01 00:00:00.001 - line1
93
+ """
94
+ And a file named "b/file" with:
95
+ """
96
+ 2012-01-01 00:00:00.002 - line2
97
+ """
98
+ When I successfully run `log_weaver a/file b/file`
99
+ Then the output should match:
100
+ """
101
+ a/file: 2012-01-01 00:00:00.001 - line1
102
+ b/file: 2012-01-01 00:00:00.002 - line2
103
+ """
104
+
105
+ Scenario: 2 files where timestamps in file1 come before timestamps in file2
106
+ Given a file named "file1" with:
107
+ """
108
+ 2012-01-01 00:00:00.001 - line1
109
+ 2012-01-01 00:00:00.002 - line2
110
+ """
111
+ And a file named "file2" with:
112
+ """
113
+ 2012-01-01 00:00:00.003 - line3
114
+ 2012-01-01 00:00:00.004 - line4
115
+ """
116
+ When I successfully run `log_weaver file1 file2`
117
+ Then the output should match:
118
+ """
119
+ file1: 2012-01-01 00:00:00.001 - line1
120
+ file1: 2012-01-01 00:00:00.002 - line2
121
+ file2: 2012-01-01 00:00:00.003 - line3
122
+ file2: 2012-01-01 00:00:00.004 - line4
123
+ """
124
+
125
+ Scenario: timestamp repeats within file
126
+ Given a file named "file1" with:
127
+ """
128
+ 2012-01-01 00:00:00.001 - line1
129
+ 2012-01-01 00:00:00.001 - line1 again
130
+ """
131
+ And a file named "file2" with:
132
+ """
133
+ 2012-01-01 00:00:00.002 - line2
134
+ """
135
+ When I successfully run `log_weaver file1 file2`
136
+ Then the output should match:
137
+ """
138
+ file1: 2012-01-01 00:00:00.001 - line1
139
+ file1: 2012-01-01 00:00:00.001 - line1 again
140
+ file2: 2012-01-01 00:00:00.002 - line2
141
+ """
142
+
143
+ Scenario: 2 files, same timestamps
144
+ Given a file named "file1" with:
145
+ """
146
+ 2012-01-01 00:00:00.001 - line1
147
+ 2012-01-01 00:00:00.002 - line2 from file1
148
+ """
149
+ And a file named "file2" with:
150
+ """
151
+ 2012-01-01 00:00:00.002 - line2 from file2
152
+ 2012-01-01 00:00:00.003 - line3
153
+ """
154
+ When I successfully run `log_weaver file1 file2`
155
+ Then the output should match:
156
+ """
157
+ file1: 2012-01-01 00:00:00.001 - line1
158
+ file1: 2012-01-01 00:00:00.002 - line2 from file1
159
+ file2: 2012-01-01 00:00:00.002 - line2 from file2
160
+ file2: 2012-01-01 00:00:00.003 - line3
161
+ """
162
+
163
+ Scenario: 2 files, timestamp repeats within file and across files
164
+ Given a file named "file1" with:
165
+ """
166
+ 2012-01-01 00:00:00.001 - line1
167
+ 2012-01-01 00:00:00.001 - line1b
168
+ """
169
+ And a file named "file2" with:
170
+ """
171
+ 2012-01-01 00:00:00.001 - line1c
172
+ 2012-01-01 00:00:00.001 - line1d
173
+ """
174
+ When I successfully run `log_weaver file1 file2`
175
+ Then the output should match:
176
+ #NOTE: pushing the file2 line to the bottom here (by sorting on prefix) while preserving the timestamp
177
+ # sort order seems to require quite a bit of rework of the data structure used to store and sort the lines;
178
+ # I think the sort order below actually works fine (because it makes all the interacting logs show up
179
+ # immediately
180
+ """
181
+ file1: 2012-01-01 00:00:00.001 - line1
182
+ file1: 2012-01-01 00:00:00.001 - line1b
183
+ file2: 2012-01-01 00:00:00.001 - line1c
184
+ file2: 2012-01-01 00:00:00.001 - line1d
185
+ """
186
+
187
+ Scenario: 2 files where timestamps in file1 come after timestamps in file2
188
+ Given a file named "file1" with:
189
+ """
190
+ 2012-01-01 00:00:00.003 - line3
191
+ 2012-01-01 00:00:00.004 - line4
192
+ """
193
+ And a file named "file2" with:
194
+ """
195
+ 2012-01-01 00:00:00.001 - line1
196
+ 2012-01-01 00:00:00.002 - line2
197
+ """
198
+ When I successfully run `log_weaver file1 file2`
199
+ Then the output should match:
200
+ """
201
+ file2: 2012-01-01 00:00:00.001 - line1
202
+ file2: 2012-01-01 00:00:00.002 - line2
203
+ file1: 2012-01-01 00:00:00.003 - line3
204
+ file1: 2012-01-01 00:00:00.004 - line4
205
+ """
206
+
207
+ Scenario: 2 files, mixed timestamps
208
+ Given a file named "file1" with:
209
+ """
210
+ 2012-01-01 00:00:00.001 - line1
211
+ 2012-01-01 00:00:00.003 - line3
212
+ """
213
+ And a file named "file2" with:
214
+ """
215
+ 2012-01-01 00:00:00.002 - line2
216
+ 2012-01-01 00:00:00.004 - line4
217
+ """
218
+ When I successfully run `log_weaver file1 file2`
219
+ Then the output should match:
220
+ """
221
+ file1: 2012-01-01 00:00:00.001 - line1
222
+ file2: 2012-01-01 00:00:00.002 - line2
223
+ file1: 2012-01-01 00:00:00.003 - line3
224
+ file2: 2012-01-01 00:00:00.004 - line4
225
+ """
226
+
227
+ Scenario: 2 files, timestamps out of order within a file (NOTE: having a log file with unordered timestamps is weird, but oh well)
228
+ Given a file named "file1" with:
229
+ """
230
+ 2012-01-01 00:00:00.002 - line2
231
+ 2012-01-01 00:00:00.001 - line1
232
+ """
233
+ And a file named "file2" with:
234
+ """
235
+ 2012-01-01 00:00:00.003 - line3
236
+ """
237
+ When I successfully run `log_weaver file1 file2`
238
+ Then the output should match:
239
+ """
240
+ file1: 2012-01-01 00:00:00.001 - line1
241
+ file1: 2012-01-01 00:00:00.002 - line2
242
+ file2: 2012-01-01 00:00:00.003 - line3
243
+ """
244
+
245
+ # ---------------------------------------------------------------
246
+ # lines with no timestamp stick to preceding timestamp
247
+ # ---------------------------------------------------------------
248
+ Scenario: 2 files, ordered timestamps, lines with no timestamp
249
+ Given a file named "file1" with:
250
+ """
251
+ 2012-01-01 00:00:00.001 - line1
252
+ line1 with no timestamp
253
+ line2 with no timestamp
254
+ 2012-01-01 00:00:00.002 - line2
255
+ """
256
+ And a file named "file2" with:
257
+ """
258
+ 2012-01-01 00:00:00.003 - line3
259
+ line3 with no timestamp
260
+ 2012-01-01 00:00:00.004 - line4
261
+ """
262
+ When I successfully run `log_weaver file1 file2`
263
+ Then the output should match:
264
+ """
265
+ file1: 2012-01-01 00:00:00.001 - line1
266
+ file1: line1 with no timestamp
267
+ file1: line2 with no timestamp
268
+ file1: 2012-01-01 00:00:00.002 - line2
269
+ file2: 2012-01-01 00:00:00.003 - line3
270
+ file2: line3 with no timestamp
271
+ file2: 2012-01-01 00:00:00.004 - line4
272
+ """
273
+
274
+ Scenario: 2 files, timestamps in file1 come after timestamps in file2, lines with no timestamp
275
+ Given a file named "file1" with:
276
+ """
277
+ 2012-01-01 00:00:00.003 - line3
278
+ line3 with no timestamp
279
+ 2012-01-01 00:00:00.004 - line4
280
+ line4 with no timestamp
281
+ """
282
+ And a file named "file2" with:
283
+ """
284
+ 2012-01-01 00:00:00.001 - line1
285
+ line1 with no timestamp
286
+ 2012-01-01 00:00:00.002 - line2
287
+ line2 with no timestamp
288
+ """
289
+ When I successfully run `log_weaver file1 file2`
290
+ Then the output should match:
291
+ """
292
+ file2: 2012-01-01 00:00:00.001 - line1
293
+ file2: line1 with no timestamp
294
+ file2: 2012-01-01 00:00:00.002 - line2
295
+ file2: line2 with no timestamp
296
+ file1: 2012-01-01 00:00:00.003 - line3
297
+ file1: line3 with no timestamp
298
+ file1: 2012-01-01 00:00:00.004 - line4
299
+ file1: line4 with no timestamp
300
+ """
301
+
302
+ Scenario: 2 files, mixed timestamps, lines with no timestamp
303
+ Given a file named "file1" with:
304
+ """
305
+ 2012-01-01 00:00:00.001 - line1
306
+ line1 with no timestamp
307
+ 2012-01-01 00:00:00.003 - line3
308
+ line3 with no timestamp
309
+ """
310
+ And a file named "file2" with:
311
+ """
312
+ 2012-01-01 00:00:00.002 - line2
313
+ line2 with no timestamp
314
+ 2012-01-01 00:00:00.004 - line4
315
+ line4 with no timestamp
316
+ """
317
+ When I successfully run `log_weaver file1 file2`
318
+ Then the output should match:
319
+ """
320
+ file1: 2012-01-01 00:00:00.001 - line1
321
+ file1: line1 with no timestamp
322
+ file2: 2012-01-01 00:00:00.002 - line2
323
+ file2: line2 with no timestamp
324
+ file1: 2012-01-01 00:00:00.003 - line3
325
+ file1: line3 with no timestamp
326
+ file2: 2012-01-01 00:00:00.004 - line4
327
+ file2: line4 with no timestamp
328
+ """
329
+
330
+ Scenario: 2 files, timestamps out of order within a file (NOTE: having a log file with unordered timestamps is weird, but oh well)
331
+ Given a file named "file1" with:
332
+ """
333
+ 2012-01-01 00:00:00.002 - line2
334
+ line2 with no timestamp
335
+ 2012-01-01 00:00:00.001 - line1
336
+ line1 with no timestamp
337
+ """
338
+ And a file named "file2" with:
339
+ """
340
+ 2012-01-01 00:00:00.003 - line3
341
+ line3 with no timestamp
342
+ """
343
+ When I successfully run `log_weaver file1 file2`
344
+ Then the output should match:
345
+ """
346
+ file1: 2012-01-01 00:00:00.001 - line1
347
+ file1: line1 with no timestamp
348
+ file1: 2012-01-01 00:00:00.002 - line2
349
+ file1: line2 with no timestamp
350
+ file2: 2012-01-01 00:00:00.003 - line3
351
+ file2: line3 with no timestamp
352
+ """
353
+
354
+ # ---------------------------------------------------------------
355
+ # 3 files
356
+ # ---------------------------------------------------------------
357
+ Scenario: 3 files, ordered timestamps, lines with no timestamp
358
+ Given a file named "file1" with:
359
+ """
360
+ 2012-01-01 00:00:00.001 - line1
361
+ line1 with no timestamp
362
+ line2 with no timestamp
363
+ 2012-01-01 00:00:00.002 - line2
364
+ """
365
+ And a file named "file2" with:
366
+ """
367
+ 2012-01-01 00:00:00.003 - line3
368
+ line3 with no timestamp
369
+ 2012-01-01 00:00:00.004 - line4
370
+ """
371
+ And a file named "file3" with:
372
+ """
373
+ 2012-01-01 00:00:00.005 - line5
374
+ 2012-01-01 00:00:00.006 - line6
375
+ line6 with no timestamp
376
+ """
377
+ When I successfully run `log_weaver file1 file2 file3`
378
+ Then the output should match:
379
+ """
380
+ file1: 2012-01-01 00:00:00.001 - line1
381
+ file1: line1 with no timestamp
382
+ file1: line2 with no timestamp
383
+ file1: 2012-01-01 00:00:00.002 - line2
384
+ file2: 2012-01-01 00:00:00.003 - line3
385
+ file2: line3 with no timestamp
386
+ file2: 2012-01-01 00:00:00.004 - line4
387
+ file3: 2012-01-01 00:00:00.005 - line5
388
+ file3: 2012-01-01 00:00:00.006 - line6
389
+ file3: line6 with no timestamp
390
+ """
391
+
392
+ Scenario: 3 files, mixed timestamps, lines with no timestamp
393
+ Given a file named "file1" with:
394
+ """
395
+ 2012-01-01 00:00:00.001 - line1
396
+ line1 with no timestamp
397
+ 2012-01-01 00:00:00.006 - line6
398
+ line6 with no timestamp
399
+ """
400
+ And a file named "file2" with:
401
+ """
402
+ 2012-01-01 00:00:00.002 - line2
403
+ line2 with no timestamp
404
+ 2012-01-01 00:00:00.005 - line5
405
+ line5 with no timestamp
406
+ """
407
+ And a file named "file3" with:
408
+ """
409
+ 2012-01-01 00:00:00.003 - line3
410
+ line3 with no timestamp
411
+ 2012-01-01 00:00:00.004 - line4
412
+ line4 with no timestamp
413
+ """
414
+ When I successfully run `log_weaver file1 file2 file3`
415
+ Then the output should match:
416
+ """
417
+ file1: 2012-01-01 00:00:00.001 - line1
418
+ file1: line1 with no timestamp
419
+ file2: 2012-01-01 00:00:00.002 - line2
420
+ file2: line2 with no timestamp
421
+ file3: 2012-01-01 00:00:00.003 - line3
422
+ file3: line3 with no timestamp
423
+ file3: 2012-01-01 00:00:00.004 - line4
424
+ file3: line4 with no timestamp
425
+ file2: 2012-01-01 00:00:00.005 - line5
426
+ file2: line5 with no timestamp
427
+ file1: 2012-01-01 00:00:00.006 - line6
428
+ file1: line6 with no timestamp
429
+ """
430
+