tracy 0.0.2 → 0.0.4

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: b7dcd6a7eca599ef9d741f553822ca529c2f38eff179b08340b53fedff0bbed5
4
+ data.tar.gz: 40c1126a26fcbb0d6da23a29149adce8b4e9c15cdc6b1ce101bec9ce38d9d691
5
5
  SHA512:
6
- metadata.gz: 101a39adb260ee6293fa906784300269fbb5c37cceac00970dc13eaaa43b4d54ebc0b4ff654aa4fcaf9bdc726b9546c2469dd132ac71e2d525b052000a2e0543
7
- data.tar.gz: bb8b69174c5682fa3d759428bcfd328ad9055ee86583f8afaff10b3def11077966c112f01636842ab515d92a422949ff53c1a443b7ed955f90acbf0b1e5534be
6
+ metadata.gz: ba2ef839cc4ec6faa9a28a818ebb2ae07b26a7f8280962f1ff0d169fb86e92e233d2859bb5e7a9ecc23ab2a9fa475631c0278a015c4b8111370d9e828468b3d2
7
+ data.tar.gz: 8ecda946b40b9e5b7aeda7a463280f2b23aa1929d91df51ff8cd92d3f9b5c59221b0a35572e38cfb22d2873a0d8e248fefe5bae40c54c91fca1f78cf218ab17a
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,37 @@ 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("callsite-info.yml", permitted_classes: [Symbol])
35
37
 
36
- selection = location_data.select do |key, callers|
38
+ selection = location_data.select do |key, _callers|
37
39
  loc = Location.new(*key)
38
40
  loc.match(target_location)
39
41
  end
40
42
 
41
43
  selection.each do |key, callers|
42
44
  puts "#{Location.new(*key).pretty_print} is called by"
43
- callers.keys.each do |call_site|
45
+ callers.each_key do |call_site|
44
46
  puts " #{Location.new(*call_site).pretty_print}"
45
47
  end
46
48
  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.4
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: 2024-11-30 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: '9.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '9.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.52'
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.52'
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.18'
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.18'
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: 3.0.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.5.23
118
+ signing_key:
91
119
  specification_version: 4
92
120
  summary: Fun with tracing
93
121
  test_files: []