load_tracer 0.4.0 → 0.6.0

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
2
  SHA256:
3
- metadata.gz: 8506eef88908cad86610b5a6d6741ff697acc77172067fb41e162939eb6df5b7
4
- data.tar.gz: 03dc7508cecc0b9fa08c1fbf3f4157b88196eb704fbb0664b14ae8e480b384ba
3
+ metadata.gz: 33466ebf443535a99b18c6900738d5e81140c6888e7294d306747d8553f96d67
4
+ data.tar.gz: 6838257481d07c00aeb43d8906fe68929153e6e38d04808787300e035b409b06
5
5
  SHA512:
6
- metadata.gz: 125417a2ee92c559509bcc15e7e0a3229fd1e5b99f96835d3e9aa6b9d32ebcf926825abe1b6316dafca424f1adf6af62e0992366f80b5b96c59b7f0e7ab592e0
7
- data.tar.gz: a6c8d3b5900e8f990ed07e63a38c3f4bcfa0dc879bf169854b2a9f4914c66723264829d92c62a1325d90eee59290d4824a25e46872f0bef4959b634c10bf7784
6
+ metadata.gz: e2607eef2784c1ef9571251bd7e62d293dd2f551bed37a094914645029e055ebfeaf8d42b42d64070efdc0ccfbc12d525322c6b73f3685ea7883b88c8747fad4
7
+ data.tar.gz: e6787328b378f1aac7fbe8c5c9d5a0f1b0954314b0d7a8461383b3722ba52a5dd1935b27d0a2fdd7bedf606865265f4ca96eb9e8c6a98763cc4eaec48bdc9f1b
data/Gemfile.lock CHANGED
@@ -1,15 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- load_tracer (0.4.0)
5
- binding_of_caller (~> 0.8.0)
4
+ load_tracer (0.6.0)
6
5
 
7
6
  GEM
8
7
  remote: https://rubygems.org/
9
8
  specs:
10
- binding_of_caller (0.8.0)
11
- debug_inspector (>= 0.0.1)
12
- debug_inspector (0.0.3)
13
9
  diff-lcs (1.3)
14
10
  rake (12.3.2)
15
11
  rspec (3.8.0)
@@ -30,10 +26,10 @@ PLATFORMS
30
26
  ruby
31
27
 
32
28
  DEPENDENCIES
33
- bundler (~> 1.17.3)
29
+ bundler (~> 2.0)
34
30
  load_tracer!
35
31
  rake (~> 12.3.2)
36
32
  rspec (~> 3.8.0)
37
33
 
38
34
  BUNDLED WITH
39
- 1.17.3
35
+ 2.0.1
data/README.md CHANGED
@@ -27,7 +27,7 @@ bundle exec rake build
27
27
  install gem.
28
28
 
29
29
  ```
30
- gem install pkg/load_tracer-0.3.0.gem
30
+ gem install pkg/load_tracer-0.6.0.gem
31
31
  ```
32
32
 
33
33
 
data/exe/rutrace CHANGED
File without changes
data/lib/load_tracer.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'binding_of_caller'
2
1
  require 'load_tracer/formatter/default'
3
2
  require 'load_tracer/formatter/dot'
4
3
  require 'load_tracer/formatter/json'
@@ -27,7 +26,9 @@ module Kernel
27
26
  end
28
27
 
29
28
  def require_relative(relative_feature)
30
- binding.of_caller(1).eval("__original_require_relative__('#{relative_feature}')")
29
+ bl = caller_locations[0]
30
+ fpath = File.expand_path(relative_feature, File.dirname(bl.absolute_path))
31
+ __original_require__(fpath)
31
32
  end
32
33
 
33
34
  def load(file, priv = false)
@@ -57,6 +58,8 @@ class LoadTracer
57
58
  @reverse_dependencies = Hash.new { |hash, key| hash[key] = [] }
58
59
  @load_checked_features = Hash.new
59
60
  @not_found_features = []
61
+ bl = caller_locations[1]
62
+ @exclude_files << bl.absolute_path
60
63
 
61
64
  tracer.enable { yield }
62
65
 
@@ -76,9 +79,9 @@ class LoadTracer
76
79
  bl = find_caller_of_internal_library(feature)
77
80
  end
78
81
 
79
- next if @exclude_files.include?(File.basename(bl.absolute_path))
82
+ next if @exclude_files.include?(bl.absolute_path)
80
83
 
81
- path = find_path(feature) || find_path(File.expand_path(feature, File.dirname(bl.path)))
84
+ path = find_path(feature) || find_path(File.expand_path(feature, File.dirname(bl.absolute_path)))
82
85
 
83
86
  if path.nil?
84
87
  @not_found_features << feature
@@ -44,20 +44,20 @@ class LoadTracer
44
44
 
45
45
  private
46
46
 
47
- def inspector(ast:, &block)
47
+ def inspect(ast:, &block)
48
48
  ast.children.each do |child|
49
49
  next unless child.instance_of?(RubyVM::AbstractSyntaxTree::Node)
50
50
 
51
51
  yield child
52
52
 
53
- inspector(ast: child, &block)
53
+ inspect(ast: child, &block)
54
54
  end
55
55
  end
56
56
 
57
57
  def search_load_features(ast:)
58
58
  features = []
59
59
 
60
- inspector(ast: ast) do |node|
60
+ inspect(ast: ast) do |node|
61
61
  next if node.type != :FCALL
62
62
 
63
63
  method_id = node.children[0]
@@ -1,3 +1,3 @@
1
1
  class LoadTracer
2
- VERSION = '0.4.0'
2
+ VERSION = '0.6.0'
3
3
  end
data/load_tracer.gemspec CHANGED
@@ -23,9 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.add_runtime_dependency 'binding_of_caller', '~> 0.8.0'
27
-
28
- spec.add_development_dependency 'bundler', '~> 1.17.3'
26
+ spec.add_development_dependency 'bundler', '~> 2.0'
29
27
  spec.add_development_dependency 'rake', '~> 12.3.2'
30
28
  spec.add_development_dependency 'rspec', '~> 3.8.0'
31
29
  end
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: load_tracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shuichi Tamayose
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-06 00:00:00.000000000 Z
11
+ date: 2019-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: binding_of_caller
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 0.8.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 0.8.0
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: 1.17.3
19
+ version: '2.0'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: 1.17.3
26
+ version: '2.0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rake
43
29
  requirement: !ruby/object:Gem::Requirement