rails_tracepoint_stack 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rails_tracepoint_stack.rb +12 -7
  3. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf771ac87351c7b8d15333adc88f0c0aa083b249d9522d2ddcf0ded1e979a8a8
4
- data.tar.gz: '092993f140a76382f146b2afe8c5602d0160d63098b908e089bbc04a5b0e5b53'
3
+ metadata.gz: 8fcdfb6d987f930a294785da2decd147c1f9f7c1e95ca5815f5f4aba38b0d81b
4
+ data.tar.gz: f02ced7d9f7413d101f16945737c0a3b8dabc3028859c787ccb63c2922d88da4
5
5
  SHA512:
6
- metadata.gz: daa4d9cfeed7f91e7207c553468ab8bdd31a58a2a57428a3a26bf5deb5c7902b3c8ac44ce2364fe2097eeb3bc242663c8c2564378e063e61c023f27d10204781
7
- data.tar.gz: fba92e74f76914217347a89eb308f371ccc543c5b69271be363f90585801826787dbf0ba9898d40a5510681502f86598537158e4ba4ae89555b00b59ae1c1a70
6
+ metadata.gz: 8adede1acb4f3391aa435070d2b0f1a8447c282bf85f35236ce25459401074e3b5d99beb66b3d6053d86b0d14a03060dcc209b30e0e5a0fca3b5a793432037e0
7
+ data.tar.gz: ba27381d62e176251babd86041f7362e44552987359dd66950a82b47b24a88d8026a0aa191b582c04076df05c6eefc650748766425ceaba4b6d1e70ccb746a0d
@@ -1,9 +1,10 @@
1
+ $rails_tracer_rtps = nil
1
2
 
2
- class TracepointStack
3
+ class RailsTracepointStack
3
4
  def initialize
4
5
  @gem_paths = Bundler.load.specs.map(&:full_gem_path)
5
6
  @ruby_lib_path = RbConfig::CONFIG['rubylibdir']
6
- end
7
+ end
7
8
 
8
9
  def tracer
9
10
  @trace ||= TracePoint.new(:call) do |tp|
@@ -29,13 +30,17 @@ class TracepointStack
29
30
  end
30
31
 
31
32
  def from_gempath_or_lib_path?(tp)
32
- gem_paths.any? { |path| tp.path.start_with?(path) } || tp.path.start_with?(ruby_lib_path)
33
+ gem_paths.any? { |path| tp.path.start_with?(path) } ||
34
+ tp.path.start_with?(ruby_lib_path) ||
35
+ tp.path.include?("gems/bundler")
33
36
  end
34
37
  end
35
38
 
36
- tracer = TracepointStack.new.tracer
37
- tracer.enable
39
+ if ENV.fetch('RAILS_TRACEPOINT_STACK', 'false') == 'true'
40
+ $rails_tracer_rtps = RailsTracepointStack.new.tracer
41
+ $rails_tracer_rtps.enable
38
42
 
39
- at_exit do
40
- trace.disable
43
+ at_exit do
44
+ $rails_tracer_rtps.disable
45
+ end
41
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_tracepoint_stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Daniel Pohlod
@@ -22,7 +22,8 @@ files:
22
22
  homepage: https://github.com/carlosdanielpohlod/rails_tracepoint_stack/
23
23
  licenses:
24
24
  - MIT
25
- metadata: {}
25
+ metadata:
26
+ documentation_uri: https://github.com/carlosdanielpohlod/rails_tracepoint_stack/
26
27
  post_install_message:
27
28
  rdoc_options: []
28
29
  require_paths:
@@ -31,7 +32,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
31
32
  requirements:
32
33
  - - ">="
33
34
  - !ruby/object:Gem::Version
34
- version: '0'
35
+ version: '3.0'
35
36
  required_rubygems_version: !ruby/object:Gem::Requirement
36
37
  requirements:
37
38
  - - ">="