trace_location 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/exe/trace_location +6 -0
- data/lib/trace_location/cli.rb +59 -0
- data/lib/trace_location/collector.rb +1 -1
- data/lib/trace_location/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 010e65cd3a2447cb0816fd31bb62eec1acb6546a0cc2d8667df523027d24abd4
|
4
|
+
data.tar.gz: 9bce85eda13a6836c0195d05265dcaf9794d4f2356d6a0b5ad5cf25d915db5b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 274ae1e802b7eb65e81cabd20fc66bd7b8ba2c7427e6eb2e5e6dee0a9415350a26cad2827f670151b9e94329b4702bca8086432b94179c20b15e48fca3a5265e
|
7
|
+
data.tar.gz: 367ae84388dd7a5b331ed780b99e6539a9f895aa5be06acdde803501a1bef8f24c155b7334031d4dc6314272332511773dfe4139ac825c63c53df5dc346c6c91
|
data/Gemfile.lock
CHANGED
data/exe/trace_location
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module TraceLocation
|
4
|
+
class CLI
|
5
|
+
attr_reader :argv
|
6
|
+
|
7
|
+
def initialize(argv)
|
8
|
+
@argv = argv
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
opt = OptionParser.new
|
13
|
+
opt.on('-f FORMAT', '--format=FORMAT', 'Report format (default: :md)', &:to_sym)
|
14
|
+
opt.on('-m REGEXP', '--match=REGEXP') { |str| Regexp.new(str) }
|
15
|
+
opt.on('-i REGEXP', '--ignore=REGEXP') { |str| Regexp.new(str) }
|
16
|
+
opt.on('-d DIR', '--dest-dir=DIR')
|
17
|
+
opt.on('-e code')
|
18
|
+
|
19
|
+
params = {}
|
20
|
+
opt.order!(argv, into: params)
|
21
|
+
params.transform_keys! { |k| k.to_s.gsub('-', '_').to_sym }
|
22
|
+
|
23
|
+
if code = params.delete(:e)
|
24
|
+
exec_code code, params
|
25
|
+
else
|
26
|
+
file = argv.shift
|
27
|
+
unless file
|
28
|
+
puts opt.help
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
|
32
|
+
exec_command file, params
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def exec_command(cmd, params)
|
39
|
+
path =
|
40
|
+
if File.exist?(cmd)
|
41
|
+
cmd
|
42
|
+
else
|
43
|
+
`which #{cmd}`.chomp
|
44
|
+
end
|
45
|
+
|
46
|
+
$PROGRAM_NAME = cmd
|
47
|
+
|
48
|
+
TraceLocation.trace(params) do
|
49
|
+
load path
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def exec_code(code, params)
|
54
|
+
TraceLocation.trace(params) do
|
55
|
+
eval code
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -26,7 +26,7 @@ module TraceLocation
|
|
26
26
|
location_cache_key = "#{caller_path}:#{caller_lineno}"
|
27
27
|
|
28
28
|
mes = extract_method_from(trace_point)
|
29
|
-
next if mes.source_location[0]
|
29
|
+
next if mes.source_location[0].match?(/\A(?:<internal:.+>|\(eval\))\z/)
|
30
30
|
|
31
31
|
method_source = method_source_cache[mes] ||= remove_indent(mes.source)
|
32
32
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trace_location
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshiyuki Hirano
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: method_source
|
@@ -72,7 +72,8 @@ description: TraceLocation helps you get tracing the source location of codes, a
|
|
72
72
|
email:
|
73
73
|
- yhirano@me.com
|
74
74
|
- shioi.mm@gmail.com
|
75
|
-
executables:
|
75
|
+
executables:
|
76
|
+
- trace_location
|
76
77
|
extensions: []
|
77
78
|
extra_rdoc_files: []
|
78
79
|
files:
|
@@ -102,7 +103,9 @@ files:
|
|
102
103
|
- examples/rendering_process/result.csv
|
103
104
|
- examples/rendering_process/result.log
|
104
105
|
- examples/rendering_process/result.md
|
106
|
+
- exe/trace_location
|
105
107
|
- lib/trace_location.rb
|
108
|
+
- lib/trace_location/cli.rb
|
106
109
|
- lib/trace_location/collector.rb
|
107
110
|
- lib/trace_location/config.rb
|
108
111
|
- lib/trace_location/event.rb
|