trace_tree 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +3 -1
- data/lib/trace_tree/group_by_file.js +22 -0
- data/lib/trace_tree/point.rb +7 -13
- data/lib/trace_tree/return_value.rb +2 -2
- data/lib/trace_tree/tree_htmlable.rb +6 -1
- data/lib/trace_tree/version.rb +1 -1
- data/trace_tree.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a4888f227248272b967eb8e49c8571f03fc7a308b4d1d3e77db133538258ed40
|
4
|
+
data.tar.gz: da4ee9a28804d9036a1e554155683581b739da004ca6a9aa646415633d70abb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94a1676563c16dfaa2734bc0ef83becbc5a9788f8ae02ba74da18c86d00e7f7b294ee431a70f6dbe46f540f494989ad10957fb5fa6348e7f87c32f68e7aabf51
|
7
|
+
data.tar.gz: 6460f66de423f728b36c88887722cdbba5fc68ba57400611112030cb63ad779c333e5a81c7733c5ccb2c21ecbb99795b5845744cb14ff5f3ee3fc0eaa60c19af
|
data/README.md
CHANGED
@@ -48,7 +48,7 @@ end
|
|
48
48
|
|
49
49
|
* `file == STDOUT` by default. You can give it a File object or anything responds to `puts`.
|
50
50
|
* `:color => true` by default. It makes method names have different color than source_location in output. When you print the output to file, you may want to set it false to discard those color ANSI escape sequences.
|
51
|
-
* `:gem => true` by default. Replace the gem paths in source_location with $GemPathN,
|
51
|
+
* `:gem => true` by default. Replace the gem paths in source_location with $GemPathN, which shorten lines. To see what are replaced, inspect `TraceTree::GemPaths`.
|
52
52
|
* `:html => nil` by default. Set it true to generate a html in which a tree constructed with `<ul>`, `<li>`. (No need to set `color`).
|
53
53
|
* `:tmp => nil` by default. Set it true or a string or an array of string to specify a tmp file under the default tmp dir of your system. (No need to provide `file` argument. It makes parent directories as needed)
|
54
54
|
* `:htmp => nil` by default. It is combination of `:html` and `:tmp`.
|
@@ -70,6 +70,8 @@ ArgumentError: Index name 'index_cars_on_online_at' on table 'cars' does not exi
|
|
70
70
|
|
71
71
|
Then find the result HTML in tmp dir. Move your mouse on any method name, and press `f`/`u` to fold/unfold it's callee, press `p`/`n` to jump to it's previous/next sibling call, press `r` to print return value in console.
|
72
72
|
|
73
|
+
You may type `group_by_file()` in console, to group callees defined in same file, under additional `li` tag. Type `group_by_file()` once again to switch back.
|
74
|
+
|
73
75
|
![image](https://user-images.githubusercontent.com/6105214/35904349-bf264ae4-0c1d-11e8-8ab4-0c256e4b014a.png)
|
74
76
|
|
75
77
|
### Example 2: Output to STDOUT
|
@@ -0,0 +1,22 @@
|
|
1
|
+
var group_by_file = (function(){
|
2
|
+
var grouped_by_file = false
|
3
|
+
|
4
|
+
return function(){
|
5
|
+
var sw = TreeHtmlGroup({
|
6
|
+
name: 'by_file',
|
7
|
+
key: function get_path(li) {
|
8
|
+
var p = li.querySelector('a').innerText.replace(/.*\s(.*):\d+/, '$1')
|
9
|
+
if (p === '') {
|
10
|
+
var callees = li.querySelector('ul')
|
11
|
+
if (callees !== null) {
|
12
|
+
return get_path(callees.children[0])
|
13
|
+
}
|
14
|
+
}
|
15
|
+
return '<b>' + p + '</b>'
|
16
|
+
}
|
17
|
+
})
|
18
|
+
|
19
|
+
sw(grouped_by_file ? '' : 'by_file')
|
20
|
+
grouped_by_file = !grouped_by_file
|
21
|
+
}
|
22
|
+
})()
|
data/lib/trace_tree/point.rb
CHANGED
@@ -139,19 +139,13 @@ EOM
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def terminate? point
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
def ending? point
|
150
|
-
(event == :b_return and point.event == :b_call) or
|
151
|
-
(event == :c_return and point.event == :c_call) or
|
152
|
-
(event == :return and point.event == :call) or
|
153
|
-
(event == :end and point.event == :class) or
|
154
|
-
(event == :thread_end and point.event == :thread_begin)
|
142
|
+
(point.defined_class == defined_class && point.method_id == method_id) && (
|
143
|
+
(event == :return && point.event == :call) ||
|
144
|
+
(event == :b_return && point.event == :b_call) ||
|
145
|
+
(event == :c_return && point.event == :c_call) ||
|
146
|
+
(event == :end && point.event == :class) ||
|
147
|
+
(event == :thread_end && point.event == :thread_begin)
|
148
|
+
)
|
155
149
|
end
|
156
150
|
|
157
151
|
def << node
|
@@ -58,7 +58,7 @@ class TraceTree
|
|
58
58
|
JS = File.read File.expand_path('../native_console.js', __FILE__)
|
59
59
|
|
60
60
|
def body_js_for_tree_html
|
61
|
-
super
|
61
|
+
super + [{text: JS}]
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -73,7 +73,7 @@ class TraceTree
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def body_js_for_tree_html
|
76
|
-
super
|
76
|
+
super + [{text: JS}]
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -7,6 +7,11 @@ class TraceTree
|
|
7
7
|
|
8
8
|
include TreeHtml
|
9
9
|
|
10
|
+
DEFAULT_JS = ['group_by_file'].map do |f|
|
11
|
+
text = File.read File.expand_path("../#{f}.js", __FILE__)
|
12
|
+
{text: text}
|
13
|
+
end
|
14
|
+
|
10
15
|
def label_for_tree_html
|
11
16
|
"<span class='highlight'>#{CGI::escapeHTML class_and_method}</span> "\
|
12
17
|
"#{CGI::escapeHTML source_location}"
|
@@ -17,7 +22,7 @@ class TraceTree
|
|
17
22
|
end
|
18
23
|
|
19
24
|
def body_js_for_tree_html
|
20
|
-
|
25
|
+
DEFAULT_JS
|
21
26
|
end
|
22
27
|
|
23
28
|
def children_for_tree_html
|
data/lib/trace_tree/version.rb
CHANGED
data/trace_tree.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
|
28
28
|
spec.add_dependency "binding_of_callers", "~> 0.1.5"
|
29
29
|
spec.add_dependency "tree_graph", "~> 0.2.0"
|
30
|
-
spec.add_dependency "tree_html", "~> 0.1.
|
30
|
+
spec.add_dependency "tree_html", "~> 0.1.7"
|
31
31
|
spec.add_dependency "terminal-tableofhashes", "~> 0.1.0"
|
32
32
|
|
33
33
|
spec.extensions << "ext/mkrf_conf.rb"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trace_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ken
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.1.
|
103
|
+
version: 0.1.7
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.1.
|
110
|
+
version: 0.1.7
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: terminal-tableofhashes
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- lib/trace_tree/console.css
|
148
148
|
- lib/trace_tree/console.js
|
149
149
|
- lib/trace_tree/gem_paths.rb
|
150
|
+
- lib/trace_tree/group_by_file.js
|
150
151
|
- lib/trace_tree/native_console.js
|
151
152
|
- lib/trace_tree/point.rb
|
152
153
|
- lib/trace_tree/point/call_activesupportconcern_appendfeatures.rb
|
@@ -196,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
197
|
version: '0'
|
197
198
|
requirements: []
|
198
199
|
rubyforge_project:
|
199
|
-
rubygems_version: 2.6
|
200
|
+
rubygems_version: 2.7.6
|
200
201
|
signing_key:
|
201
202
|
specification_version: 4
|
202
203
|
summary: Print TracePoint(:b_call, :b_return, :c_call, :c_return, :call, :return,
|