akainaa 0.1.0 → 0.1.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/README.md +3 -3
- data/docs/isucon13-baseline.html +14562 -0
- data/lib/akainaa/version.rb +1 -1
- data/lib/akainaa.rb +22 -9
- metadata +3 -2
data/lib/akainaa/version.rb
CHANGED
data/lib/akainaa.rb
CHANGED
@@ -54,7 +54,7 @@ module Akainaa
|
|
54
54
|
|
55
55
|
private def extract_path_from_query(env)
|
56
56
|
matched = env['QUERY_STRING'].match(/path=([^&]+)/)
|
57
|
-
matched ? matched[1] :
|
57
|
+
matched ? matched[1] : nil
|
58
58
|
end
|
59
59
|
|
60
60
|
private def render_line(lineno, code, count, count_top)
|
@@ -74,13 +74,10 @@ module Akainaa
|
|
74
74
|
HTML
|
75
75
|
end
|
76
76
|
|
77
|
-
private def render_filelist(coverage_result, current_path:)
|
77
|
+
private def render_filelist(coverage_result, summary:, current_path:)
|
78
78
|
files = coverage_result.keys
|
79
|
-
max_count_on_proj =
|
80
|
-
|
81
|
-
.map { |cv| cv[:lines].reject(&:nil?).sum }
|
82
|
-
.max + 1
|
83
|
-
max_count_witdh = max_count_on_proj.to_s.size
|
79
|
+
max_count_on_proj = summary.max_count_on_proj
|
80
|
+
max_count_width = max_count_on_proj.to_s.size
|
84
81
|
|
85
82
|
li_elements = files.sort.map do |file|
|
86
83
|
total_count_on_file = coverage_result[file][:lines].reject(&:nil?).sum
|
@@ -89,7 +86,7 @@ module Akainaa
|
|
89
86
|
class_suffix = file == current_path ? ' current' : ''
|
90
87
|
<<~HTML
|
91
88
|
<li class="pure-menu-item">
|
92
|
-
<a href="/akainaa?path=#{file}" class="pure-menu-link filepath#{class_suffix} count-p#{count_top}"">(#{total_count_on_file.to_s.rjust(
|
89
|
+
<a href="/akainaa?path=#{file}" class="pure-menu-link filepath#{class_suffix} count-p#{count_top}"">(#{total_count_on_file.to_s.rjust(max_count_width)}) #{file}</a>
|
93
90
|
</li>
|
94
91
|
HTML
|
95
92
|
end.join
|
@@ -110,9 +107,25 @@ module Akainaa
|
|
110
107
|
HTML
|
111
108
|
end
|
112
109
|
|
110
|
+
CoverageSummary = Data.define(:file_path_has_max_count, :max_count_on_proj)
|
111
|
+
|
112
|
+
private def generate_summary(coverage_result)
|
113
|
+
file_path_has_max_count = coverage_result.max_by { |_, cv| cv[:lines].reject(&:nil?).sum }.first
|
114
|
+
max_count_on_proj = coverage_result
|
115
|
+
.values
|
116
|
+
.map { |cv| cv[:lines].reject(&:nil?).sum }
|
117
|
+
.max + 1
|
118
|
+
|
119
|
+
CoverageSummary.new(file_path_has_max_count:, max_count_on_proj:)
|
120
|
+
end
|
121
|
+
|
113
122
|
private def render_page(path)
|
114
123
|
result = Akainaa.peek_result
|
115
124
|
|
125
|
+
summary = generate_summary(result)
|
126
|
+
|
127
|
+
path = summary.file_path_has_max_count if path.nil?
|
128
|
+
|
116
129
|
path_result = result[path]
|
117
130
|
|
118
131
|
if path_result.nil?
|
@@ -135,7 +148,7 @@ module Akainaa
|
|
135
148
|
lines << line
|
136
149
|
end
|
137
150
|
|
138
|
-
filelist = render_filelist(result, current_path: path)
|
151
|
+
filelist = render_filelist(result, summary:, current_path: path)
|
139
152
|
|
140
153
|
<<~HTML
|
141
154
|
<!DOCTYPE html>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: akainaa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shia
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Minimum rack middleware for coverage
|
14
14
|
email:
|
@@ -22,6 +22,7 @@ files:
|
|
22
22
|
- README.md
|
23
23
|
- Rakefile
|
24
24
|
- akainaa.gemspec
|
25
|
+
- docs/isucon13-baseline.html
|
25
26
|
- img/webui.png
|
26
27
|
- lib/akainaa.rb
|
27
28
|
- lib/akainaa/version.rb
|