xlo 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/xlo.rb +73 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7e52351d89689492655e87f6a477d9df91f9c545
|
4
|
+
data.tar.gz: 8be829ab65292a868b19eb6026fd88753fa0f950
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 603e7e7d121acf83e34f5b658482db37965ea950f59c68ed1ce927f9eeb85f5028fbae1494b4f0d46fdd45b8924d97bb3ed8efe9de4dec56143665d1a8fd1117
|
7
|
+
data.tar.gz: 7eca0e9c62efd6a5eebb2798de5048778bfc50246c0c18cc83213327e27c3a1a16dbb6520c336df86865257afcba3ec0fc107fb0305afa57cf4e5ed8eb82e8d2
|
data/lib/xlo.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
class Xlo
|
2
|
+
|
3
|
+
def fill_list (_dir)
|
4
|
+
list = []
|
5
|
+
Dir[_dir + "/" + "*.log"].each do |file|
|
6
|
+
p file
|
7
|
+
File.open(file, 'r') do |f1|
|
8
|
+
while line = f1.gets
|
9
|
+
if (line.include?("error") && !line.include?("are invalid"))
|
10
|
+
list << line
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
return list
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_error_dict (_list)
|
19
|
+
error = {}
|
20
|
+
_list.each do |el|
|
21
|
+
type = el.split("error")[1].split(" ")[1]
|
22
|
+
key = type + "; " + el[/\^.*/][1..-1]
|
23
|
+
filename = File.basename(el.split("error")[0])
|
24
|
+
filename[filename.length - 2] = ""
|
25
|
+
if (error.has_key?(key))
|
26
|
+
error[key] << " || " + filename
|
27
|
+
else
|
28
|
+
error[key] = filename
|
29
|
+
end
|
30
|
+
end
|
31
|
+
return error
|
32
|
+
end
|
33
|
+
|
34
|
+
def xmllint_error (_file,_error_dict)
|
35
|
+
list = []
|
36
|
+
File.open(_file).each do |line|
|
37
|
+
if (!line.include?("^\n"))
|
38
|
+
list << line.chomp
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
list = list.values_at(* list.each_index.select {|i| i.even?})
|
43
|
+
list.each do |el|
|
44
|
+
split_el = el.split(" ")
|
45
|
+
type = el[/element|attribute/]
|
46
|
+
key = type + ";" + el.split(":")[-1]
|
47
|
+
filename = File.basename(split_el[0])[0..-2]
|
48
|
+
if (_error_dict.has_key?(key))
|
49
|
+
_error_dict[key] << " || " + filename
|
50
|
+
else
|
51
|
+
_error_dict[key] = filename
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.main
|
57
|
+
rnv_arg = ARGV.shift
|
58
|
+
xmllint_arg = ARGV.shift
|
59
|
+
raise "missing argument" unless rnv_arg
|
60
|
+
|
61
|
+
f = File.new("error.csv", "w+")
|
62
|
+
f.write("type; error; freq; files \n")
|
63
|
+
error = create_error_dict(fill_list(rnv_arg))
|
64
|
+
|
65
|
+
if (xmllint_arg != nil)
|
66
|
+
xmllint_error(xmllint_arg, error)
|
67
|
+
end
|
68
|
+
error.each do |entry|
|
69
|
+
freq = entry[1].split("||").length.to_s
|
70
|
+
f.write(entry.insert(1, freq).join("; ")[0..-2] + "\n" )
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xlo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Simon Meoni
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple hello world gem
|
14
|
+
email: simonmeoni@aol.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/xlo.rb
|
20
|
+
homepage: http://rubygems.org/gems/xlo
|
21
|
+
licenses:
|
22
|
+
- apache 2
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.2.2
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: an aggregator of xml log for rnv and xmllint error
|
44
|
+
test_files: []
|