diver_down 0.0.1.alpha7 → 0.0.1.alpha9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/diver_down/trace/session.rb +1 -7
- data/lib/diver_down/version.rb +1 -1
- data/lib/diver_down/web/action.rb +38 -6
- data/lib/diver_down/web/definition_to_dot.rb +7 -6
- data/lib/diver_down/web/module_store.rb +31 -4
- data/lib/diver_down/web.rb +5 -1
- data/web/assets/bundle.js +86 -82
- 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: b7a272e39e974d543ceec5219e3b5505bca70d0a61afae0632107eb3cc5645fe
|
4
|
+
data.tar.gz: c6df48a9145a3d87c6b8816b6a37830bdbab3c6404d0d0347cb43bf3be636ec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a1d631fe52cab90a2c005f96480751007056414accfb50d3aaa59f337614c69cd5082ed77b456f68b4fce5f4ff17404296df2e84f82159b4abdcdf354d2b996
|
7
|
+
data.tar.gz: 3144ca2c364a66e8d20db470887f6d7499d05ffdb39a379b85d4aac093808971963baa76340863dc93f2e2480af4d2dba035a2874c2926f23bd015cff5b39f59
|
@@ -91,13 +91,7 @@ module DiverDown
|
|
91
91
|
|
92
92
|
# Search is a heavy process and should be terminated early.
|
93
93
|
# The position of the most recently found caller or the start of trace is used as the maximum value.
|
94
|
-
|
95
|
-
call_stack.stack_size
|
96
|
-
else
|
97
|
-
call_stack.stack_size - call_stack.context_stack_size[-1]
|
98
|
-
end
|
99
|
-
|
100
|
-
caller_location = find_neast_caller_location(maximum_back_stack_size)
|
94
|
+
caller_location = find_neast_caller_location(call_stack.stack_size)
|
101
95
|
|
102
96
|
# `caller_location` is nil if it is filtered by caller_paths
|
103
97
|
if caller_location
|
data/lib/diver_down/version.rb
CHANGED
@@ -33,12 +33,19 @@ module DiverDown
|
|
33
33
|
end
|
34
34
|
# rubocop:enable Style/HashEachMethods
|
35
35
|
|
36
|
+
classified_sources_count = source_names.count { @module_store.classified?(_1) }
|
37
|
+
|
36
38
|
json(
|
37
39
|
sources: source_names.sort.map do |source_name|
|
38
40
|
{
|
39
41
|
source_name:,
|
42
|
+
memo: @module_store.get_memo(source_name),
|
43
|
+
modules: @module_store.get_modules(source_name).map do |module_name|
|
44
|
+
{ module_name: }
|
45
|
+
end,
|
40
46
|
}
|
41
|
-
end
|
47
|
+
end,
|
48
|
+
classified_sources_count:
|
42
49
|
)
|
43
50
|
end
|
44
51
|
|
@@ -50,7 +57,7 @@ module DiverDown
|
|
50
57
|
# rubocop:disable Style/HashEachMethods
|
51
58
|
@store.each do |_, definition|
|
52
59
|
definition.sources.each do |source|
|
53
|
-
modules = @module_store.
|
60
|
+
modules = @module_store.get_modules(source.source_name)
|
54
61
|
module_set.add(modules) unless modules.empty?
|
55
62
|
end
|
56
63
|
end
|
@@ -77,7 +84,7 @@ module DiverDown
|
|
77
84
|
# rubocop:disable Style/HashEachMethods
|
78
85
|
@store.each do |_, definition|
|
79
86
|
definition.sources.each do |source|
|
80
|
-
source_module_names = @module_store.
|
87
|
+
source_module_names = @module_store.get_modules(source.source_name)
|
81
88
|
|
82
89
|
next unless source_module_names[0..module_names.size - 1] == module_names
|
83
90
|
|
@@ -102,6 +109,7 @@ module DiverDown
|
|
102
109
|
sources: source_names.sort.map do |source_name|
|
103
110
|
{
|
104
111
|
source_name:,
|
112
|
+
memo: @module_store.get_memo(source_name),
|
105
113
|
}
|
106
114
|
end,
|
107
115
|
related_definitions: related_definitions.map do |definition|
|
@@ -131,6 +139,7 @@ module DiverDown
|
|
131
139
|
definition_group: definition.definition_group,
|
132
140
|
title: definition.title,
|
133
141
|
sources_count: definition.sources.size,
|
142
|
+
unclassified_sources_count: definition.sources.reject { @module_store.classified?(_1.source_name) }.size,
|
134
143
|
}
|
135
144
|
end,
|
136
145
|
pagination: pagination.to_h
|
@@ -188,7 +197,8 @@ module DiverDown
|
|
188
197
|
sources: definition.sources.map do
|
189
198
|
{
|
190
199
|
source_name: _1.source_name,
|
191
|
-
|
200
|
+
memo: @module_store.get_memo(_1.source_name),
|
201
|
+
modules: @module_store.get_modules(_1.source_name).map do |module_name|
|
192
202
|
{ module_name: }
|
193
203
|
end,
|
194
204
|
}
|
@@ -239,11 +249,12 @@ module DiverDown
|
|
239
249
|
[]
|
240
250
|
else
|
241
251
|
source = DiverDown::Definition::Source.combine(*found_sources)
|
242
|
-
@module_store.
|
252
|
+
@module_store.get_modules(source.source_name)
|
243
253
|
end
|
244
254
|
|
245
255
|
json(
|
246
256
|
source_name:,
|
257
|
+
memo: @module_store.get_memo(source_name),
|
247
258
|
modules: module_names.map do
|
248
259
|
{ module_name: _1 }
|
249
260
|
end,
|
@@ -280,7 +291,28 @@ module DiverDown
|
|
280
291
|
end
|
281
292
|
|
282
293
|
if found_source
|
283
|
-
@module_store.
|
294
|
+
@module_store.set_modules(source_name, modules)
|
295
|
+
@module_store.flush
|
296
|
+
|
297
|
+
json({})
|
298
|
+
else
|
299
|
+
not_found
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
# POST /api/sources/:source_name/memo.json
|
304
|
+
#
|
305
|
+
# @param source_name [String]
|
306
|
+
# @param memo [String]
|
307
|
+
def set_memo(source_name, memo)
|
308
|
+
found_source = @store.any? do |_, definition|
|
309
|
+
definition.sources.any? do |source|
|
310
|
+
source.source_name == source_name
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
if found_source
|
315
|
+
@module_store.set_memo(source_name, memo)
|
284
316
|
@module_store.flush
|
285
317
|
|
286
318
|
json({})
|
@@ -31,7 +31,7 @@ module DiverDown
|
|
31
31
|
private
|
32
32
|
|
33
33
|
def source_to_h
|
34
|
-
modules = module_store.
|
34
|
+
modules = module_store.get_modules(data.source_name).map do
|
35
35
|
{
|
36
36
|
module_name: _1,
|
37
37
|
}
|
@@ -41,6 +41,7 @@ module DiverDown
|
|
41
41
|
id:,
|
42
42
|
type: 'source',
|
43
43
|
source_name: data.source_name,
|
44
|
+
memo: module_store.get_memo(data.source_name),
|
44
45
|
modules:,
|
45
46
|
}
|
46
47
|
end
|
@@ -185,11 +186,11 @@ module DiverDown
|
|
185
186
|
dependency_map = Hash.new { |h, k| h[k] = Hash.new { |hi, ki| hi[ki] = [] } }
|
186
187
|
|
187
188
|
definition.sources.sort_by(&:source_name).each do |source|
|
188
|
-
source_modules = module_store.
|
189
|
+
source_modules = module_store.get_modules(source.source_name)
|
189
190
|
next if source_modules.empty?
|
190
191
|
|
191
192
|
source.dependencies.each do |dependency|
|
192
|
-
dependency_modules = module_store.
|
193
|
+
dependency_modules = module_store.get_modules(dependency.source_name)
|
193
194
|
next if dependency_modules.empty?
|
194
195
|
|
195
196
|
dependency_map[source_modules][dependency_modules].push(dependency)
|
@@ -268,7 +269,7 @@ module DiverDown
|
|
268
269
|
|
269
270
|
def render_sources
|
270
271
|
by_modules = definition.sources.group_by do |source|
|
271
|
-
module_store.
|
272
|
+
module_store.get_modules(source.source_name)
|
272
273
|
end
|
273
274
|
|
274
275
|
# Remove duplicated prefix modules
|
@@ -326,8 +327,8 @@ module DiverDown
|
|
326
327
|
def insert_dependencies(source)
|
327
328
|
source.dependencies.each do
|
328
329
|
attributes = {}
|
329
|
-
ltail = module_label(*module_store.
|
330
|
-
lhead = module_label(*module_store.
|
330
|
+
ltail = module_label(*module_store.get_modules(source.source_name))
|
331
|
+
lhead = module_label(*module_store.get_modules(_1.source_name))
|
331
332
|
|
332
333
|
if @compound && (ltail || lhead)
|
333
334
|
# Rendering of dependencies between modules is done only once
|
@@ -6,6 +6,7 @@ module DiverDown
|
|
6
6
|
class Web
|
7
7
|
class ModuleStore
|
8
8
|
BLANK_ARRAY = [].freeze
|
9
|
+
BLANK_MEMO = ''
|
9
10
|
BLANK_RE = /\A\s*\z/
|
10
11
|
|
11
12
|
private_constant(:BLANK_RE)
|
@@ -17,16 +18,42 @@ module DiverDown
|
|
17
18
|
|
18
19
|
# @param source_name [String]
|
19
20
|
# @param module_names [Array<String>]
|
20
|
-
def
|
21
|
-
@store[source_name]
|
21
|
+
def set_modules(source_name, module_names)
|
22
|
+
source = (@store[source_name] ||= {})
|
23
|
+
|
24
|
+
source[:modules] = module_names.dup.reject do
|
22
25
|
BLANK_RE.match?(_1)
|
23
26
|
end.freeze
|
24
27
|
end
|
25
28
|
|
26
29
|
# @param source_name [String]
|
27
30
|
# @return [Array<Module>]
|
28
|
-
def
|
29
|
-
@store
|
31
|
+
def get_modules(source_name)
|
32
|
+
return BLANK_ARRAY unless @store.key?(source_name)
|
33
|
+
|
34
|
+
@store[source_name][:modules] || BLANK_ARRAY
|
35
|
+
end
|
36
|
+
|
37
|
+
# @param source_name [String]
|
38
|
+
# @param memo [String]
|
39
|
+
# @return [void]
|
40
|
+
def set_memo(source_name, memo)
|
41
|
+
source = (@store[source_name] ||= {})
|
42
|
+
source[:memo] = memo.strip
|
43
|
+
end
|
44
|
+
|
45
|
+
# @param source_name [String]
|
46
|
+
# @return [String]
|
47
|
+
def get_memo(source_name)
|
48
|
+
return BLANK_MEMO unless @store.key?(source_name)
|
49
|
+
|
50
|
+
@store[source_name][:memo] || BLANK_MEMO
|
51
|
+
end
|
52
|
+
|
53
|
+
# @param source_name [String]
|
54
|
+
# @return [Boolean]
|
55
|
+
def classified?(source_name)
|
56
|
+
get_modules(source_name).any?
|
30
57
|
end
|
31
58
|
|
32
59
|
# @return [Hash]
|
data/lib/diver_down/web.rb
CHANGED
@@ -53,7 +53,7 @@ module DiverDown
|
|
53
53
|
in ['GET', %r{\A/api/modules\.json\z}]
|
54
54
|
action.modules
|
55
55
|
in ['GET', %r{\A/api/modules/(?<module_names>.+)\.json\z}]
|
56
|
-
module_names = Regexp.last_match[:module_names].split('/')
|
56
|
+
module_names = CGI.unescape(Regexp.last_match[:module_names]).split('/')
|
57
57
|
action.module(module_names)
|
58
58
|
in ['GET', %r{\A/api/definitions/(?<bit_id>\d+)\.json\z}]
|
59
59
|
bit_id = Regexp.last_match[:bit_id].to_i
|
@@ -68,6 +68,10 @@ module DiverDown
|
|
68
68
|
source = Regexp.last_match[:source]
|
69
69
|
modules = request.params['modules'] || []
|
70
70
|
action.set_modules(source, modules)
|
71
|
+
in ['POST', %r{\A/api/sources/(?<source>[^/]+)/memo.json\z}]
|
72
|
+
source = Regexp.last_match[:source]
|
73
|
+
memo = request.params['memo'] || ''
|
74
|
+
action.set_memo(source, memo)
|
71
75
|
in ['GET', %r{\A/api/pid\.json\z}]
|
72
76
|
action.pid
|
73
77
|
in ['GET', %r{\A/api/initialization_status\.json\z}]
|