source_route 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +5 -9
- data/lib/source_route/core_ext.rb +30 -0
- data/lib/source_route/formats/html.rb +1 -1
- data/lib/source_route/formats/html_template.slim +23 -11
- data/lib/source_route/generate_result.rb +11 -9
- data/lib/source_route/jsonify.rb +11 -0
- data/lib/source_route/rails_plugins/source_track_middleware.rb +15 -0
- data/lib/source_route/tp_result.rb +46 -0
- data/lib/source_route/tp_result_chain.rb +11 -15
- data/lib/source_route/version.rb +1 -1
- data/lib/source_route/wrapper.rb +17 -7
- data/lib/source_route.rb +4 -1
- data/source_route.gemspec +2 -1
- data/test/source_route_test.rb +7 -8
- metadata +35 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b4bfd9535b257febd357416089fee4ff68b38b2
|
4
|
+
data.tar.gz: f2c7a60553434e0a0430f9919764f0d97dcd5780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d551e9a2364336fb6603633b0da2748eb3e27b2f0eba4b51bdaaffcf579af2956e269536a1e4d7cf7f47b3b05c1821fca533fb716d2d7888e1216472e96c436
|
7
|
+
data.tar.gz: d4b009feb8524193ad9d90776b60ff8a37213b45189838e4ce910975e697c720e0f9c9e3e01b6729b5db2130286480e63b437ee325d5972cbd5e2ebfa1adf6da
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -24,15 +24,11 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
#### In irb or pry
|
26
26
|
|
27
|
-
SourceRoute.trace
|
28
|
-
'abc'.upcase
|
29
|
-
end
|
27
|
+
SourceRoute.trace(output_format: :console, event: :c_call) { 'abc'.upcase }
|
30
28
|
|
31
29
|
#### In rails console
|
32
30
|
|
33
|
-
SourceRoute.trace
|
34
|
-
User.new
|
35
|
-
end
|
31
|
+
SourceRoute.trace(defined_class: :ActiveRecord, output_format: :html) { User.new }
|
36
32
|
|
37
33
|
It will generate a html file, open it and you can get the trace of User.new
|
38
34
|
|
@@ -72,14 +68,14 @@ see full usage in examples/study_callback.rb
|
|
72
68
|
|
73
69
|
I always wanna upgrade my ruby(rails) skills. But everytime when I looking for workaround from stack overflow I feel frustration.
|
74
70
|
|
75
|
-
To get solution or workaround from google or stack overflow is suitable when I'm a ruby starter or
|
71
|
+
To get solution or workaround from google or stack overflow is suitable when I'm a ruby starter or task is urgent. But it's not really helpful to levelup my skills.
|
76
72
|
|
77
|
-
The way how I solve problem define my skills border and depth. So if I slove problems by search google and stack overflow with workarounds, I mostly just increase my experiences on ruby(rails). But if I solve problems directly, in most case, I can say my skill border extends.
|
73
|
+
The way how I solve problem define my skills' border and depth. So if I slove problems by search google and stack overflow with workarounds, I mostly just increase my experiences on ruby(rails). But if I solve problems directly, in most case, I can say my skill border extends.
|
78
74
|
|
79
75
|
That's why I create this gem. To solve problems directly, I need to know what happened in call or return traces.
|
80
76
|
Fortunately ruby 2.0 introduce a new feature TracePoint to easily trace inner event. But it's not easily to be used as daily tool. This gem tries to make tracing more readable and easily in our daily work.
|
81
77
|
|
82
|
-
Finally, I expect my working style can
|
78
|
+
Finally, I expect my working style can changes from searching workaround from internet to reading code trace(then more easily check source) directly. I hope it can help you too.
|
83
79
|
|
84
80
|
## Test
|
85
81
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class Object
|
2
|
+
def source_route_display
|
3
|
+
to_s
|
4
|
+
end
|
5
|
+
|
6
|
+
end
|
7
|
+
|
8
|
+
class Numeric
|
9
|
+
def source_route_display
|
10
|
+
self
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class NilClass
|
15
|
+
def source_route_display
|
16
|
+
inspect
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Symbol
|
21
|
+
def source_route_display
|
22
|
+
inspect
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class String
|
27
|
+
def source_route_display
|
28
|
+
eql?('') ? inspect : to_s
|
29
|
+
end
|
30
|
+
end
|
@@ -10,7 +10,7 @@ module SourceRoute
|
|
10
10
|
template_path = File.expand_path "../html_template.slim", __FILE__
|
11
11
|
slim_template = Slim::Template.new(template_path, pretty: true)
|
12
12
|
|
13
|
-
filename = result_config[:filename] || "#{Time.now.strftime('%H
|
13
|
+
filename = result_config[:filename] || "#{Time.now.strftime('%H')}-source-route.html"
|
14
14
|
|
15
15
|
if result_config.import_return_to_call and wrapper.condition.has_call_and_return_event
|
16
16
|
wrapper.import_return_value_to_call_chain
|
@@ -5,11 +5,14 @@ html
|
|
5
5
|
link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"
|
6
6
|
link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/github.min.css"
|
7
7
|
link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"
|
8
|
+
link rel="stylesheet" href="https://cdn.rawgit.com/Urigo/angular-spinkit/master/build/angular-spinkit.min.css"
|
8
9
|
script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"
|
9
10
|
script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"
|
10
11
|
script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"
|
11
12
|
|
12
13
|
css:
|
14
|
+
body { font-size: 24px }
|
15
|
+
pre { font-size: 20px }
|
13
16
|
.call-level-0 {}
|
14
17
|
.call-level-1 { margin-left: 50px }
|
15
18
|
.call-level-2 { margin-left: 100px }
|
@@ -43,7 +46,7 @@ html
|
|
43
46
|
button.btn.btn-default>(ng-click="outlineTrace()")
|
44
47
|
span> OutLine
|
45
48
|
span
|
46
|
-
button.btn.btn-primary(ng-click="
|
49
|
+
button.btn.btn-primary(ng-click="expandAllTrace()") Expand ALL
|
47
50
|
|
48
51
|
.trace-flow
|
49
52
|
.row
|
@@ -55,6 +58,7 @@ html
|
|
55
58
|
.traces.center-info.col-sm-12(ng-class="{{traceFilter.event}}")
|
56
59
|
.trace.well(ng-repeat="trace in traces | filter:traceFilter:true | filter:childParentFilterFn"
|
57
60
|
ng-class="callLevelClass(trace)" ng-controller="TpTraceCtrl")
|
61
|
+
|
58
62
|
.header(ng-init="showMoreDetail = false")
|
59
63
|
.btn-group.pull-right
|
60
64
|
button.btn.btn-info.btn-sm(ng-if="::hasChild()" ng-click="toggleChild()")
|
@@ -69,6 +73,7 @@ html
|
|
69
73
|
| .
|
70
74
|
mark.method-value(ng-bind="trace.method_id")
|
71
75
|
/ workaround for return_value is 'false' and return_value always to be string when existed
|
76
|
+
pulse-spinner(ng-show="togglingChild")
|
72
77
|
div(ng-if="trace.hasOwnProperty('return_value')")
|
73
78
|
span
|
74
79
|
| =>
|
@@ -90,12 +95,13 @@ html
|
|
90
95
|
|
91
96
|
.right-info.col-sm-2
|
92
97
|
|
93
|
-
script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.
|
94
|
-
script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.
|
98
|
+
script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"
|
99
|
+
script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.0/ui-bootstrap-tpls.min.js"
|
95
100
|
script src="http://pc035860.github.io/angular-highlightjs/angular-highlightjs.min.js"
|
101
|
+
script src="https://cdn.rawgit.com/Urigo/angular-spinkit/master/build/angular-spinkit.min.js"
|
96
102
|
|
97
103
|
javascript:
|
98
|
-
sourceRoute = angular.module('SourceRoute', ['ui.bootstrap', 'hljs'])
|
104
|
+
sourceRoute = angular.module('SourceRoute', ['ui.bootstrap', 'hljs', 'angular-spinkit'])
|
99
105
|
sourceRoute.controller('MainCtrl', function($scope, $filter) {
|
100
106
|
|
101
107
|
$scope.trimString = function(str, length) {
|
@@ -122,7 +128,7 @@ html
|
|
122
128
|
return true;
|
123
129
|
}
|
124
130
|
|
125
|
-
$scope.
|
131
|
+
$scope.expandAllTrace = function() {
|
126
132
|
_.each($scope.traces, function(trace) { trace.childClosed = false; });
|
127
133
|
$scope.childParentFilter.hide_trace_ids = [];
|
128
134
|
}
|
@@ -184,13 +190,19 @@ html
|
|
184
190
|
$scope.outlineTrace();
|
185
191
|
})
|
186
192
|
|
187
|
-
sourceRoute.controller('TpTraceCtrl', function($scope) {
|
193
|
+
sourceRoute.controller('TpTraceCtrl', function($scope, $timeout) {
|
194
|
+
|
188
195
|
$scope.toggleChild = function() {
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
196
|
+
$scope.togglingChild = true
|
197
|
+
$timeout(function() {
|
198
|
+
if ($scope.trace.childClosed) {
|
199
|
+
$scope.showChild();
|
200
|
+
$scope.togglingChild = false
|
201
|
+
} else {
|
202
|
+
$scope.hideChild();
|
203
|
+
$scope.togglingChild = false
|
204
|
+
}
|
205
|
+
}, 0)
|
194
206
|
}
|
195
207
|
|
196
208
|
$scope.showChild = function() {
|
@@ -77,6 +77,15 @@ module SourceRoute
|
|
77
77
|
|
78
78
|
private
|
79
79
|
|
80
|
+
def collect_tp_data
|
81
|
+
tp_data = output_attributes(@tp.event).inject({}) do |memo, key|
|
82
|
+
memo[key.to_sym] = @tp.send(key) if @tp.respond_to?(key)
|
83
|
+
memo
|
84
|
+
end
|
85
|
+
@collect_data = TpResult.new(tp_data)
|
86
|
+
puts @collect_data.inspect if @wrapper.condition.is_debug?
|
87
|
+
end
|
88
|
+
|
80
89
|
# include? will evaluate @tp.self, if @tp.self is AR::Relation, it could cause problems
|
81
90
|
# So that's why I use object_id as replace
|
82
91
|
def collect_tp_self
|
@@ -86,19 +95,12 @@ module SourceRoute
|
|
86
95
|
@collect_data[:tp_self] = @wrapper.tp_self_caches.map(&:__id__).index(@tp.self.__id__)
|
87
96
|
end
|
88
97
|
|
89
|
-
def collect_tp_data
|
90
|
-
@collect_data = output_attributes(@tp.event).inject({}) do |memo, key|
|
91
|
-
memo[key.to_sym] = @tp.send(key) if @tp.respond_to?(key)
|
92
|
-
memo
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
98
|
def collect_local_var_data
|
97
99
|
local_var_hash = {}
|
98
100
|
|
99
101
|
# Warn: @tp.binding.eval('local_variables') =! @tp.binding.send('local_variables')
|
100
102
|
@tp.binding.eval('local_variables').each do |v|
|
101
|
-
local_var_hash[v] = @tp.binding.local_variable_get
|
103
|
+
local_var_hash[v] = @tp.binding.local_variable_get(v).source_route_display
|
102
104
|
end
|
103
105
|
if local_var_hash != {}
|
104
106
|
@collect_data.merge!(local_var: local_var_hash)
|
@@ -108,7 +110,7 @@ module SourceRoute
|
|
108
110
|
def collect_instance_var_data
|
109
111
|
instance_var_hash = {}
|
110
112
|
@tp.self.instance_variables.each do |key|
|
111
|
-
instance_var_hash[key] = @tp.self.instance_variable_get(key)
|
113
|
+
instance_var_hash[key] = @tp.self.instance_variable_get(key).source_route_display
|
112
114
|
end
|
113
115
|
if instance_var_hash != {}
|
114
116
|
@collect_data.merge!(instance_var: instance_var_hash)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module SourceRoute
|
2
|
+
# delegate to hash
|
3
|
+
class TpResult
|
4
|
+
attr_accessor :core
|
5
|
+
|
6
|
+
extend Forwardable
|
7
|
+
def_delegators :@core, :[], :merge, :merge!, :reject, :has_key?, :values, :[]=
|
8
|
+
|
9
|
+
def initialize(data)
|
10
|
+
@core = data
|
11
|
+
end
|
12
|
+
|
13
|
+
def return_event?
|
14
|
+
@core[:event] == :return
|
15
|
+
end
|
16
|
+
|
17
|
+
def call_event?
|
18
|
+
@core[:event] == :call
|
19
|
+
end
|
20
|
+
|
21
|
+
def ==(other)
|
22
|
+
@core[:tp_self] == other[:tp_self] and @core[:method_id] == other[:method_id] and
|
23
|
+
@core[:defined_class] == other[:defined_class]
|
24
|
+
end
|
25
|
+
|
26
|
+
def matched?
|
27
|
+
@core[:matched]
|
28
|
+
end
|
29
|
+
|
30
|
+
def return_assign_call(tp)
|
31
|
+
@core[:matched] = true
|
32
|
+
tp[:return_value] = @core[:return_value]
|
33
|
+
tp[:local_var] = @core[:local_var] if has_key? :local_var
|
34
|
+
tp[:instance_var] = @core[:instance_var] if has_key? :instance_var
|
35
|
+
end
|
36
|
+
|
37
|
+
def stringify
|
38
|
+
dup_core = @core.dup
|
39
|
+
# to_s is safer than inspect
|
40
|
+
# ex: inspect on ActiveRecord_Relation may crash
|
41
|
+
dup_core[:defined_class] = dup_core[:defined_class].to_s if dup_core.has_key?(:defined_class)
|
42
|
+
dup_core[:return_value] = dup_core[:return_value].source_route_display if dup_core.has_key?(:return_value)
|
43
|
+
dup_core
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module SourceRoute
|
2
|
-
|
2
|
+
# delegate to Array
|
3
3
|
class TpResultChain
|
4
4
|
attr_reader :chain
|
5
5
|
|
@@ -13,25 +13,19 @@ module SourceRoute
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def call_chain
|
16
|
-
select
|
16
|
+
select(&:call_event?)
|
17
17
|
end
|
18
18
|
|
19
19
|
def return_chain
|
20
|
-
select
|
20
|
+
select(&:return_event?)
|
21
21
|
end
|
22
22
|
|
23
23
|
def import_return_value_to_call_chain
|
24
24
|
call_chain.each do |ctp|
|
25
|
-
matched_return_tp = return_chain.
|
26
|
-
|
27
|
-
detect do |rtp|
|
28
|
-
rtp[:tp_self] == ctp[:tp_self] and rtp[:method_id] == ctp[:method_id] and rtp[:defined_class] == ctp[:defined_class]
|
29
|
-
end
|
25
|
+
matched_return_tp = return_chain.reject(&:matched?).detect {|rtp| rtp == ctp}
|
26
|
+
|
30
27
|
unless matched_return_tp.nil?
|
31
|
-
matched_return_tp
|
32
|
-
ctp[:return_value] = matched_return_tp[:return_value]
|
33
|
-
ctp[:local_var] = matched_return_tp[:local_var] if matched_return_tp.key? :local_var
|
34
|
-
ctp[:instance_var] = matched_return_tp[:instance_var] if matched_return_tp.key? :instance_var
|
28
|
+
matched_return_tp.return_assign_call(ctp)
|
35
29
|
end
|
36
30
|
end
|
37
31
|
end
|
@@ -68,9 +62,11 @@ module SourceRoute
|
|
68
62
|
deep_cloned.map do |tr|
|
69
63
|
# to_s is safer than inspect
|
70
64
|
# ex: inspect on ActiveRecord_Relation may crash
|
71
|
-
tr[:defined_class] = tr[:defined_class].to_s if tr.
|
72
|
-
if tr.
|
73
|
-
if tr[:return_value].nil? or tr[:return_value]
|
65
|
+
tr[:defined_class] = tr[:defined_class].to_s if tr.has_key?(:defined_class)
|
66
|
+
if tr.has_key?(:return_value)
|
67
|
+
if tr[:return_value].nil? or tr[:return_value].is_a? Symbol or
|
68
|
+
# ActiveRecord::ConnectionAdapters::Column override method ==
|
69
|
+
(tr[:return_value].is_a? String and tr[:return_value] == '')
|
74
70
|
tr[:return_value] = tr[:return_value].inspect
|
75
71
|
else
|
76
72
|
tr[:return_value] = tr[:return_value].to_s
|
data/lib/source_route/version.rb
CHANGED
data/lib/source_route/wrapper.rb
CHANGED
@@ -21,7 +21,7 @@ module SourceRoute
|
|
21
21
|
|
22
22
|
TRACE_POINT_METHODS.each do |m|
|
23
23
|
define_method m do |*v|
|
24
|
-
positive[m] = v.map(&:to_s).join('|')
|
24
|
+
positive[m] = v.flatten.map(&:to_s).join('|')
|
25
25
|
end
|
26
26
|
|
27
27
|
define_method "#{m}_not" do |*v|
|
@@ -56,6 +56,14 @@ module SourceRoute
|
|
56
56
|
result_config.include_local_var = true
|
57
57
|
end
|
58
58
|
end
|
59
|
+
|
60
|
+
def debug(value=false)
|
61
|
+
@debug = value
|
62
|
+
end
|
63
|
+
|
64
|
+
def is_debug?
|
65
|
+
@debug
|
66
|
+
end
|
59
67
|
end
|
60
68
|
|
61
69
|
def initialize
|
@@ -72,7 +80,7 @@ module SourceRoute
|
|
72
80
|
|
73
81
|
def trace
|
74
82
|
# dont wanna init it in tp block, cause tp block could run thousands of times in one cycle trace
|
75
|
-
|
83
|
+
build_result = GenerateResult.new(self)
|
76
84
|
tp_filter = TpFilter.new(condition)
|
77
85
|
|
78
86
|
track = TracePoint.new *condition.events do |tp|
|
@@ -80,26 +88,28 @@ module SourceRoute
|
|
80
88
|
next if tp_filter.block_it?(tp)
|
81
89
|
|
82
90
|
unless condition.result_config.format.is_a? Proc
|
83
|
-
ret_data =
|
91
|
+
ret_data = build_result.build(tp)
|
84
92
|
@tp_result_chain.push(ret_data)
|
85
93
|
end
|
86
94
|
|
87
|
-
|
95
|
+
build_result.output(tp)
|
88
96
|
end
|
89
97
|
track.enable
|
90
98
|
self.tp = track
|
91
99
|
end
|
92
100
|
|
93
101
|
def jsonify_events
|
94
|
-
|
102
|
+
Oj.dump(@condition.events.map(&:to_s))
|
95
103
|
end
|
96
104
|
|
97
105
|
def jsonify_tp_result_chain
|
98
|
-
|
106
|
+
# puts tp_result_chain.stringify
|
107
|
+
json_array = tp_result_chain.map { |result| Jsonify.dump(result) }
|
108
|
+
'[ ' + json_array.join(',') + ' ]'
|
99
109
|
end
|
100
110
|
|
101
111
|
def jsonify_tp_self_caches
|
102
|
-
|
112
|
+
Oj.dump(tp_self_caches.clone.map(&:to_s))
|
103
113
|
end
|
104
114
|
end # END Wrapper
|
105
115
|
|
data/lib/source_route.rb
CHANGED
@@ -2,12 +2,15 @@ require 'ostruct'
|
|
2
2
|
require 'logger'
|
3
3
|
require 'singleton'
|
4
4
|
require 'forwardable'
|
5
|
-
|
5
|
+
require 'oj'
|
6
6
|
require 'awesome_print'
|
7
7
|
|
8
|
+
require "source_route/core_ext"
|
8
9
|
require "source_route/version"
|
9
10
|
require "source_route/wrapper"
|
11
|
+
require "source_route/jsonify"
|
10
12
|
require "source_route/generate_result"
|
13
|
+
require "source_route/tp_result"
|
11
14
|
require "source_route/tp_result_chain"
|
12
15
|
require "source_route/tp_filter"
|
13
16
|
require 'source_route/json_overrides/activerecord_associations_association'
|
data/source_route.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'source_route/version'
|
@@ -21,6 +20,8 @@ Gem::Specification.new do |spec|
|
|
21
20
|
|
22
21
|
spec.add_dependency 'awesome_print'
|
23
22
|
spec.add_dependency 'slim'
|
23
|
+
spec.add_dependency 'multi_json'
|
24
|
+
spec.add_dependency 'oj'
|
24
25
|
|
25
26
|
spec.add_development_dependency "bundler", "~> 1.6"
|
26
27
|
spec.add_development_dependency "rake"
|
data/test/source_route_test.rb
CHANGED
@@ -47,19 +47,21 @@ class SourceRouteTest < Minitest::Test
|
|
47
47
|
|
48
48
|
def test_not_match
|
49
49
|
SourceRoute.enable do
|
50
|
+
defined_class 'SampleApp' # without it, a dead loop will occur
|
50
51
|
method_id_not 'nonsense'
|
51
52
|
end
|
52
53
|
SampleApp.new.nonsense
|
53
54
|
refute_includes @wrapper.tp_result_chain.map(&:values).flatten, 'nonsense'
|
54
55
|
end
|
55
56
|
|
56
|
-
def
|
57
|
+
def test_match_multiple_class_name
|
57
58
|
SourceRoute.enable do
|
58
|
-
defined_class :SampleApp
|
59
|
+
defined_class [:SampleApp, :String]
|
59
60
|
end
|
60
61
|
|
61
62
|
SampleApp.new.nonsense
|
62
63
|
assert @wrapper.tp_result_chain.size > 0
|
64
|
+
assert_equal SampleApp, @wrapper.tp_result_chain.last.core[:defined_class]
|
63
65
|
end
|
64
66
|
|
65
67
|
def test_source_route_with_one_parameter
|
@@ -97,9 +99,7 @@ class SourceRouteTest < Minitest::Test
|
|
97
99
|
end
|
98
100
|
|
99
101
|
def test_trace_with_c_call
|
100
|
-
SourceRoute.trace
|
101
|
-
'abc'.upcase
|
102
|
-
end
|
102
|
+
SourceRoute.trace(event: :c_call) { 'abc'.upcase }
|
103
103
|
|
104
104
|
assert_equal 2, @wrapper.tp_result_chain.size
|
105
105
|
end
|
@@ -157,7 +157,7 @@ class SourceRouteTest < Minitest::Test
|
|
157
157
|
ret_value = @wrapper.tp_result_chain.last
|
158
158
|
|
159
159
|
assert_equal 88, ret_value[:local_var][:param1]
|
160
|
-
assert_equal nil, ret_value[:local_var][:param2]
|
160
|
+
assert_equal 'nil', ret_value[:local_var][:param2]
|
161
161
|
end
|
162
162
|
|
163
163
|
def test_track_local_var_when_event_is_return
|
@@ -196,7 +196,7 @@ class SourceRouteTest < Minitest::Test
|
|
196
196
|
end
|
197
197
|
SampleApp.new.init_cool_app
|
198
198
|
@wrapper.import_return_value_to_call_chain
|
199
|
-
assert @wrapper.call_chain[0].
|
199
|
+
assert @wrapper.call_chain[0].has_key?(:return_value), 'call results should contain return_value'
|
200
200
|
end
|
201
201
|
|
202
202
|
def test_order_call_sequence
|
@@ -205,7 +205,6 @@ class SourceRouteTest < Minitest::Test
|
|
205
205
|
end
|
206
206
|
SampleApp.new.nonsense_with_instance_var
|
207
207
|
@wrapper.treeize_call_chain
|
208
|
-
@wrapper.treeize_call_chain
|
209
208
|
call_results = @wrapper.call_chain
|
210
209
|
|
211
210
|
nonsense_call_tp = call_results.find { |tp| tp[:method_id] == :nonsense }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: source_route
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- raykin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: multi_json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: oj
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: bundler
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,11 +153,15 @@ files:
|
|
125
153
|
- examples/show_task_trace_in_rails.rb
|
126
154
|
- examples/study_callback.rb
|
127
155
|
- lib/source_route.rb
|
156
|
+
- lib/source_route/core_ext.rb
|
128
157
|
- lib/source_route/formats/html.rb
|
129
158
|
- lib/source_route/formats/html_template.slim
|
130
159
|
- lib/source_route/generate_result.rb
|
131
160
|
- lib/source_route/json_overrides/activerecord_associations_association.rb
|
161
|
+
- lib/source_route/jsonify.rb
|
162
|
+
- lib/source_route/rails_plugins/source_track_middleware.rb
|
132
163
|
- lib/source_route/tp_filter.rb
|
164
|
+
- lib/source_route/tp_result.rb
|
133
165
|
- lib/source_route/tp_result_chain.rb
|
134
166
|
- lib/source_route/version.rb
|
135
167
|
- lib/source_route/wrapper.rb
|
@@ -171,3 +203,4 @@ test_files:
|
|
171
203
|
- test/source_route/wrapper_test.rb
|
172
204
|
- test/source_route_test.rb
|
173
205
|
- test/test_helper.rb
|
206
|
+
has_rdoc:
|