rails_tracepoint_stack 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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: eeb97f7192b4379bdebd15da84477298535c897236b3a3acb2735f89db5ebd7b
4
- data.tar.gz: 809557f925e2fd9e85302eef08497792ccc525b3f5b25662266fc4f6cc76e770
3
+ metadata.gz: 8fcdfb6d987f930a294785da2decd147c1f9f7c1e95ca5815f5f4aba38b0d81b
4
+ data.tar.gz: f02ced7d9f7413d101f16945737c0a3b8dabc3028859c787ccb63c2922d88da4
5
5
  SHA512:
6
- metadata.gz: a903d86229c926bbfcbcbeb75971c3aa2891b35327fe6608ce29c6b88f2c7f3e97c135d66c9783f0632fd9286a88df558be187389b9332f0407431878ff65cdc
7
- data.tar.gz: d65ba8f3c6fb40c9c2a505dd8cc771f8de357dc0dc5de724ba7a118f8f772dd66773c4dd6cf087d8c3c3bce4c05d75bc35fa0cf7d52c98cb874213204b8b70ac
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
- tracer.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.3
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
  - - ">="