trace_tree 0.3.0 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/README.md +8 -0
- data/lib/trace_tree/gem_paths.rb +1 -6
- data/lib/trace_tree/point.rb +2 -3
- data/lib/trace_tree/version.rb +1 -1
- data/lib/trace_tree.rb +6 -2
- data/trace_tree.gemspec +4 -4
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b4565cbbc8a5df459e5642434e57630d1b46272f47ae299f7160b58c0620043
|
4
|
+
data.tar.gz: 6fac4d967befe782304102938c64ca93d7f1401fd37c97fbc64bf843aeae1646
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39599ff7ef3c18d530c70429143426ddd93f84bccaecb7fd6fbc0083c44f00721423830c15a896f0a9cbc75dd9ce8c362602aca07b583f06bcf5a95350afad92
|
7
|
+
data.tar.gz: 28ac1cd344dfd20ca7df7258c091a954538322ca03019f46de2a2bbbd858ac8f8f3537972f768f5eeac6f473dfa24ebbed522ff61abc17652a4f0fcc7beeaa7e
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -60,6 +60,14 @@ end
|
|
60
60
|
* `:debug => nil` by default. Give it `STDOUT`/`STDERR` or anything responds to `:puts` to output a whole list of TracePoints. Or give it a file name in the default tmp dir of your system.
|
61
61
|
* `transcode => false` by default. Set it true to convert unknown character into `"?"` when you see `Encoding::UndefinedConversionError`.
|
62
62
|
|
63
|
+
### Methods' return values
|
64
|
+
|
65
|
+
By default it stores return values of functions in generated html. If there is any kind of value can not be stringified, you can do something like this to avoid exception:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
TraceTree::ReturnValue.formatted(Mongo::Protocol::Message) { |_| "Mongo::Protocol::Message" }
|
69
|
+
```
|
70
|
+
|
63
71
|
### Example 1: Output to HTML
|
64
72
|
|
65
73
|
Try to remove a non-existing index:
|
data/lib/trace_tree/gem_paths.rb
CHANGED
@@ -3,10 +3,5 @@ require 'yaml'
|
|
3
3
|
class TraceTree
|
4
4
|
GemPaths = {}
|
5
5
|
|
6
|
-
::
|
7
|
-
select{|h| h.has_key?("GEM PATHS")}[0].
|
8
|
-
values[0].
|
9
|
-
each_with_index do |path, i|
|
10
|
-
GemPaths["GemPath#{i}"] = path
|
11
|
-
end
|
6
|
+
::Gem.path.each_with_index { |path, i| GemPaths["GemPath#{i}"] = path }
|
12
7
|
end
|
data/lib/trace_tree/point.rb
CHANGED
@@ -12,6 +12,7 @@ class TraceTree
|
|
12
12
|
|
13
13
|
Interfaces = [:event, :defined_class, :method_id, :path, :lineno]
|
14
14
|
attr_reader(*Interfaces)
|
15
|
+
class_eval 'def assign_trace_point_values(tp);' + Interfaces.map{ |i| "@#{i} = tp.#{i}" }.join(';') + ';end'
|
15
16
|
|
16
17
|
class << self
|
17
18
|
def inherited base
|
@@ -68,9 +69,7 @@ EOM
|
|
68
69
|
end
|
69
70
|
|
70
71
|
def initialize trace_point
|
71
|
-
|
72
|
-
instance_variable_set "@#{i}", trace_point.send(i)
|
73
|
-
end
|
72
|
+
assign_trace_point_values(trace_point)
|
74
73
|
|
75
74
|
@return_value = trace_point.return_value if x_return?
|
76
75
|
@thread = Thread.current
|
data/lib/trace_tree/version.rb
CHANGED
data/lib/trace_tree.rb
CHANGED
@@ -46,7 +46,8 @@ class TraceTree
|
|
46
46
|
enhance_point
|
47
47
|
@build_command = (opt[:html] || opt[:htmp]) ? :tree_html_full : :tree_graph
|
48
48
|
make_filter
|
49
|
-
@__file__, @__line__
|
49
|
+
@__file__, @__line__ = bi.source_location
|
50
|
+
there = bi.eval('self')
|
50
51
|
|
51
52
|
dry_run
|
52
53
|
|
@@ -109,11 +110,14 @@ class TraceTree
|
|
109
110
|
log.puts tree
|
110
111
|
log.puts timer.to_s if opt[:timer]
|
111
112
|
rescue => e
|
112
|
-
log.puts timer.to_s, e.inspect, e.backtrace
|
113
|
+
log.puts timer.to_s, e.inspect, e.backtrace
|
114
|
+
log.puts table_of_points
|
113
115
|
end
|
114
116
|
|
115
117
|
def table_of_points
|
116
118
|
Terminal::Table.from_hashes trace_points_array.map(&:to_h)
|
119
|
+
rescue => e
|
120
|
+
log.puts "#{__method__}", e.inspect, e.backtrace
|
117
121
|
end
|
118
122
|
|
119
123
|
def make_filter
|
data/trace_tree.gemspec
CHANGED
@@ -21,13 +21,13 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "> 1.14"
|
24
|
-
spec.add_development_dependency "rake", "
|
24
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
25
25
|
spec.add_development_dependency "minitest", "~> 5.0"
|
26
26
|
spec.add_development_dependency "pry"
|
27
27
|
|
28
|
-
spec.add_dependency "binding_of_callers", "~> 0.2.
|
29
|
-
spec.add_dependency "tree_graph", "~> 0.2.
|
30
|
-
spec.add_dependency "tree_html", "~> 0.1.
|
28
|
+
spec.add_dependency "binding_of_callers", "~> 0.2.3"
|
29
|
+
spec.add_dependency "tree_graph", "~> 0.2.4"
|
30
|
+
spec.add_dependency "tree_html", "~> 0.1.9"
|
31
31
|
spec.add_dependency "terminal-tableofhashes", "~> 0.1.0"
|
32
32
|
|
33
33
|
end
|
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.3.
|
4
|
+
version: 0.3.3
|
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: 2022-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.3
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,42 +72,42 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.2.
|
75
|
+
version: 0.2.3
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.2.
|
82
|
+
version: 0.2.3
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: tree_graph
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.2.
|
89
|
+
version: 0.2.4
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.2.
|
96
|
+
version: 0.2.4
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: tree_html
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.1.
|
103
|
+
version: 0.1.9
|
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.9
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: terminal-tableofhashes
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
|
-
rubygems_version: 3.
|
193
|
+
rubygems_version: 3.1.6
|
194
194
|
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: Print TracePoint(:b_call, :b_return, :c_call, :c_return, :call, :return,
|