bullet_log_parser 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +8 -2
- data/lib/bullet_log_parser.rb +16 -9
- data/lib/bullet_log_parser/parser.rb +8 -1
- data/lib/bullet_log_parser/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8db8d410f8bec07c6e097981787585a6c1e4ff2be0d3c13f22f4fb573c771514
|
4
|
+
data.tar.gz: 036afc6d764a855572429ff3dab10d494da823f87af4340cc4e7b4205f4c0a66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ab35e4516ea3269e8cd5824095794a04ec76efdd93cea8bc9d9c48d52a039bb4ef1b8723835b85dbf9140dfc6de21cef6ed01633102e275948eabb19306284a
|
7
|
+
data.tar.gz: baad9b1e9775d92e6a39e808f01322387121e0f14d48cf2b96012f9076f909375e57fac4e0e2430cce59278e82f6df90059bc1306f5428133439f828e453fba9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [1.0.1](https://github.com/satoruk/bullet_log_parser/compare/v1.0.0...v1.0.1) (2020-08-03)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* fix to parse last boundary log ([37b54d5](https://github.com/satoruk/bullet_log_parser/commit/37b54d52ef50a61f2cc6f1e699584d57ac6bbf6b))
|
7
|
+
|
1
8
|
# 1.0.0 (2020-07-31)
|
2
9
|
|
3
10
|
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
<h1 align="center">bullet log parser</h2>
|
2
2
|
|
3
3
|
<p align="center">
|
4
|
-
<a href="https://github.com/satoruk/bullet_log_parser/actions?query=workflow%3ACI"><img src="https://github.com/satoruk/bullet_log_parser/workflows/CI/badge.svg" /></a>
|
4
|
+
<a href="https://github.com/satoruk/bullet_log_parser/actions?query=workflow%3ACI"><img src="https://github.com/satoruk/bullet_log_parser/workflows/CI/badge.svg" height="20"/></a>
|
5
|
+
<a href="https://badge.fury.io/rb/bullet_log_parser"><img src="https://badge.fury.io/rb/bullet_log_parser.svg" alt="Gem Version" height="20"></a>
|
5
6
|
</p>
|
6
7
|
|
7
8
|
This parser can help to convert the Bullet logs to prefer format you want.
|
@@ -26,7 +27,12 @@ cat log/bullet.log | bullet_log_filter.rb
|
|
26
27
|
#!/usr/bin/env ruby
|
27
28
|
# frozen_string_literal: true
|
28
29
|
|
29
|
-
|
30
|
+
begin
|
31
|
+
require 'bullet_log_parser'
|
32
|
+
rescue LoadError => _e
|
33
|
+
require 'bundler/setup'
|
34
|
+
require 'bullet_log_parser'
|
35
|
+
end
|
30
36
|
|
31
37
|
if __FILE__ == $PROGRAM_NAME
|
32
38
|
results = BulletLogParser.uniq_log($stdin) do |ast|
|
data/lib/bullet_log_parser.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'bullet_log_parser/version'
|
4
4
|
require 'bullet_log_parser/parser'
|
5
|
+
require 'set'
|
5
6
|
|
6
7
|
module BulletLogParser # :nodoc:
|
7
8
|
def self.generate_bare_ast(ast)
|
@@ -11,7 +12,7 @@ module BulletLogParser # :nodoc:
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def self.uniq_log(io)
|
14
|
-
memo = Hash.new { |h, k| h[k] =
|
15
|
+
memo = Hash.new { |h, k| h[k] = Set.new }
|
15
16
|
parse(io) do |ast|
|
16
17
|
bare_ast = generate_bare_ast(ast)
|
17
18
|
detection = memo[bare_ast[:detection]]
|
@@ -23,18 +24,24 @@ module BulletLogParser # :nodoc:
|
|
23
24
|
memo
|
24
25
|
end
|
25
26
|
|
26
|
-
def self.parse(io)
|
27
|
+
def self.parse(io, &block)
|
27
28
|
parser = Parser.new
|
28
29
|
loop do
|
29
|
-
|
30
|
-
|
30
|
+
line = io.gets
|
31
|
+
unless line
|
32
|
+
parse_line(parser, '', &block)
|
33
|
+
break
|
34
|
+
end
|
31
35
|
|
32
|
-
parser.
|
33
|
-
|
36
|
+
parser = Parser.new if parse_line(parser, line.chomp, &block)
|
37
|
+
end
|
38
|
+
end
|
34
39
|
|
35
|
-
|
40
|
+
def self.parse_line(parser, line)
|
41
|
+
parser.puts(line)
|
42
|
+
return false unless parser.completed?
|
36
43
|
|
37
|
-
|
38
|
-
|
44
|
+
yield parser.ast
|
45
|
+
true
|
39
46
|
end
|
40
47
|
end
|
@@ -9,7 +9,10 @@ module BulletLogParser # :nodoc:
|
|
9
9
|
|
10
10
|
def initialize
|
11
11
|
@parse_method = :parse_line1
|
12
|
-
@ast = {
|
12
|
+
@ast = {
|
13
|
+
details: [],
|
14
|
+
stack: []
|
15
|
+
}
|
13
16
|
@terminated = false
|
14
17
|
@failed = false
|
15
18
|
end
|
@@ -32,6 +35,10 @@ module BulletLogParser # :nodoc:
|
|
32
35
|
@terminated || @failed
|
33
36
|
end
|
34
37
|
|
38
|
+
def completed?
|
39
|
+
@terminated && @failed == false
|
40
|
+
end
|
41
|
+
|
35
42
|
def puts(str)
|
36
43
|
perse_proc = method(@parse_method).curry
|
37
44
|
perse_proc.call(str)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_log_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- satoruk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Bullet log perser.
|
14
14
|
email:
|