tracy 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 631bc8183b1b43ede424ac04cf23ced46988c526
4
- data.tar.gz: 76b569411afced0e320002a6c9d928ad322f48c8
2
+ SHA256:
3
+ metadata.gz: ecd5eadfc5a70e7a34e3fd0e1e5ebddf1b5b37129317ca82125d26c7fb6a6c4a
4
+ data.tar.gz: d11fb91d028bd722899ec728483494649f821e00d2d0929adad6b026efcc2b4f
5
5
  SHA512:
6
- metadata.gz: 101a39adb260ee6293fa906784300269fbb5c37cceac00970dc13eaaa43b4d54ebc0b4ff654aa4fcaf9bdc726b9546c2469dd132ac71e2d525b052000a2e0543
7
- data.tar.gz: bb8b69174c5682fa3d759428bcfd328ad9055ee86583f8afaff10b3def11077966c112f01636842ab515d92a422949ff53c1a443b7ed955f90acbf0b1e5534be
6
+ metadata.gz: a1e31b4a1079d22dbd87e0505b79888bcc9328c605748a47c49a5fbae578b55feccbfe5107de84155907d270a400ac3617ae510d6123beda7d8496a28f940d07
7
+ data.tar.gz: 9c8963d78f7568744d709655a1b099cf81e71a60e49dc27dc25c136c1ca7c8cd96254731d5e6ae702c3c23939d3ca707813dccf6fe359f329b31b16682c80c01
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
2
4
  gemspec
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
- require 'rake/clean'
2
- require 'bundler/gem_tasks'
3
- require 'cucumber/rake/task'
1
+ # frozen_string_literal: true
2
+
3
+ require "rake/clean"
4
+ require "bundler/gem_tasks"
5
+ require "cucumber/rake/task"
4
6
 
5
7
  Cucumber::Rake::Task.new
data/bin/callsites CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- require 'yaml'
2
+ # frozen_string_literal: true
3
+
4
+ require "yaml"
3
5
 
4
6
  Location = Struct.new(:method_name, :class_name, :line, :file) do
5
7
  def match(other)
@@ -10,37 +12,38 @@ Location = Struct.new(:method_name, :class_name, :line, :file) do
10
12
  end
11
13
 
12
14
  def pretty_print
13
- if method_name
14
- name = "#{class_name}##{method_name}"
15
- else
16
- name = '<main>'
17
- end
15
+ name = if method_name
16
+ "#{class_name}##{method_name}"
17
+ else
18
+ "<main>"
19
+ end
18
20
  "#{name} at #{file}:#{line}"
19
21
  end
20
22
  end
21
23
 
22
24
  location = ARGV[0]
23
25
 
24
- if location =~ /:\d+$/
25
- file, line = location.split ':'
26
+ if /:\d+$/.match?(location)
27
+ file, line = location.split ":"
26
28
  line = line.to_i
27
29
  else
28
- class_name, method_name = location.split '#'
30
+ class_name, method_name = location.split "#"
29
31
  method_name = method_name.to_sym if method_name
30
32
  end
31
33
 
32
34
  target_location = Location.new(method_name, class_name, line, file)
33
35
 
34
- location_data = YAML.load(File.read('callsite-info.yml'))
36
+ location_data = YAML.safe_load(File.read("callsite-info.yml"),
37
+ permitted_classes: [Symbol])
35
38
 
36
- selection = location_data.select do |key, callers|
39
+ selection = location_data.select do |key, _callers|
37
40
  loc = Location.new(*key)
38
41
  loc.match(target_location)
39
42
  end
40
43
 
41
44
  selection.each do |key, callers|
42
45
  puts "#{Location.new(*key).pretty_print} is called by"
43
- callers.keys.each do |call_site|
46
+ callers.each_key do |call_site|
44
47
  puts " #{Location.new(*call_site).pretty_print}"
45
48
  end
46
49
  end
@@ -1 +1,3 @@
1
- require 'aruba/cucumber'
1
+ # frozen_string_literal: true
2
+
3
+ require "aruba/cucumber"
data/lib/tracy.rb CHANGED
@@ -1,4 +1,6 @@
1
- require 'yaml'
1
+ # frozen_string_literal: true
2
+
3
+ require "yaml"
2
4
 
3
5
  class Tracy
4
6
  def initialize
@@ -19,13 +21,13 @@ class Tracy
19
21
 
20
22
  def done
21
23
  @trace.disable
22
- IO.write('callsite-info.yml', YAML.dump(@callers))
24
+ File.write("callsite-info.yml", YAML.dump(@callers))
23
25
  end
24
26
 
25
27
  private
26
28
 
27
29
  def data_array(trace_point)
28
30
  klass = trace_point.defined_class
29
- [trace_point.method_id, klass ? klass.name : '', trace_point.lineno, trace_point.path]
31
+ [trace_point.method_id, klass ? klass.name : "", trace_point.lineno, trace_point.path]
30
32
  end
31
33
  end
metadata CHANGED
@@ -1,58 +1,86 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-24 00:00:00.000000000 Z
11
+ date: 2022-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aruba
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: cucumber
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '7.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '7.0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: rake
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
45
  - - "~>"
18
46
  - !ruby/object:Gem::Version
19
- version: '10.3'
47
+ version: '13.0'
20
48
  type: :development
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
52
  - - "~>"
25
53
  - !ruby/object:Gem::Version
26
- version: '10.3'
54
+ version: '13.0'
27
55
  - !ruby/object:Gem::Dependency
28
- name: aruba
56
+ name: rubocop
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
59
  - - "~>"
32
60
  - !ruby/object:Gem::Version
33
- version: 0.10.2
61
+ version: 1.25.0
34
62
  type: :development
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
66
  - - "~>"
39
67
  - !ruby/object:Gem::Version
40
- version: 0.10.2
68
+ version: 1.25.0
41
69
  - !ruby/object:Gem::Dependency
42
- name: cucumber
70
+ name: rubocop-performance
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
73
  - - "~>"
46
74
  - !ruby/object:Gem::Version
47
- version: '2.0'
75
+ version: 1.13.0
48
76
  type: :development
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
80
  - - "~>"
53
81
  - !ruby/object:Gem::Version
54
- version: '2.0'
55
- description:
82
+ version: 1.13.0
83
+ description:
56
84
  email: matijs@matijs.net
57
85
  executables:
58
86
  - callsites
@@ -68,8 +96,9 @@ files:
68
96
  - lib/tracy.rb
69
97
  homepage: http://www.matijs.net
70
98
  licenses: []
71
- metadata: {}
72
- post_install_message:
99
+ metadata:
100
+ rubygems_mfa_required: 'true'
101
+ post_install_message:
73
102
  rdoc_options: []
74
103
  require_paths:
75
104
  - lib
@@ -78,16 +107,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
107
  requirements:
79
108
  - - ">="
80
109
  - !ruby/object:Gem::Version
81
- version: '0'
110
+ version: 2.7.0
82
111
  required_rubygems_version: !ruby/object:Gem::Requirement
83
112
  requirements:
84
113
  - - ">="
85
114
  - !ruby/object:Gem::Version
86
115
  version: '0'
87
116
  requirements: []
88
- rubyforge_project:
89
- rubygems_version: 2.4.5.1
90
- signing_key:
117
+ rubygems_version: 3.3.3
118
+ signing_key:
91
119
  specification_version: 4
92
120
  summary: Fun with tracing
93
121
  test_files: []