call_graph 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +16 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +109 -0
- data/Rakefile +12 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/call_graph.gemspec +24 -0
- data/examples/call-graph.dot +5 -0
- data/examples/call-graph.png +0 -0
- data/examples/call-graph.tmp +3 -0
- data/examples/foobar.rb +39 -0
- data/lib/call_graph/instrument.rb +82 -0
- data/lib/call_graph/printers/dot/line.rb +15 -0
- data/lib/call_graph/printers/dot.rb +34 -0
- data/lib/call_graph/printers/png.rb +25 -0
- data/lib/call_graph/tasks/printer.rake +29 -0
- data/lib/call_graph/version.rb +3 -0
- data/lib/call_graph.rb +32 -0
- metadata +120 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7ec8d09cac62e18130df21d02f0b7eeea51154745075624690130ef86fea98f7
|
4
|
+
data.tar.gz: e838253ebd96b790b94060170479b40aaf332e9cb29a5e6b88f3270ab743dd92
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5963c9694168762faae31960ea239cd93dc4c28660d6ae029485e8d7b9c09ab0cf6f0e350aef3314cc13b53a1f2b1827ac3507e1f06631c663fecbc394482943
|
7
|
+
data.tar.gz: 36724ffefd64a31ff9f06240ee1e6a111158a8202702eae8f94be529a75dc0fa8092eea16f4cb880b45c68cdd235b6cd2d27de9d714c1ea5d333d407856ee080
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
env:
|
4
|
+
global:
|
5
|
+
- CC_TEST_REPORTER_ID=187c1770b00f655d852f632d3a491518c30fd3923674057bbbd03c2d8efb7503
|
6
|
+
rvm:
|
7
|
+
- 2.6.1
|
8
|
+
before_script:
|
9
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
10
|
+
- chmod +x ./cc-test-reporter
|
11
|
+
- ./cc-test-reporter before-build
|
12
|
+
after_script:
|
13
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
14
|
+
matrix:
|
15
|
+
allow_failures:
|
16
|
+
- rvm: jruby
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at james.moriarty@rea-group.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 James Moriarty
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
# CallGraph
|
2
|
+
|
3
|
+
[![Code Climate](https://codeclimate.com/github/jamesmoriarty/call-graph/badges/gpa.svg)](https://codeclimate.com/github/jamesmoriarty/call-graph) [![Test Coverage](https://codeclimate.com/github/jamesmoriarty/call-graph/badges/coverage.svg)](https://codeclimate.com/github/jamesmoriarty/call-graph/coverage) [![Build Status](https://travis-ci.org/jamesmoriarty/call-graph.svg?branch=master)](https://travis-ci.org/jamesmoriarty/call-graph) [![Gem Version](https://badge.fury.io/rb/call_graph.svg)](https://badge.fury.io/rb/call_graph)
|
4
|
+
|
5
|
+
## Why
|
6
|
+
|
7
|
+
> The Law of Demeter (LoD) or principle of least knowledge is a design guideline for developing software, particularly object-oriented programs. In its general form, the LoD is a specific case of loose coupling. The guideline was proposed by Ian Holland at Northeastern University towards the end of 1987, and can be succinctly summarized in each of the following ways:[1]
|
8
|
+
|
9
|
+
> - Each unit should have only limited knowledge about other units: only units "closely" related to the current unit.
|
10
|
+
> - Each unit should only talk to its friends; don't talk to strangers.
|
11
|
+
> - Only talk to your immediate friends.
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Capture the execution you want to graph between `CallGraph.start` and `CallGraph.stop`.
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
class A
|
19
|
+
def self.x
|
20
|
+
B.new.y
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class B
|
25
|
+
def y
|
26
|
+
1 + C.z do
|
27
|
+
1
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class C
|
33
|
+
def self.z
|
34
|
+
yield
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
require 'call_graph'
|
39
|
+
|
40
|
+
CallGraph.config do |config|
|
41
|
+
config.file_path = "examples/call-graph"
|
42
|
+
end
|
43
|
+
|
44
|
+
CallGraph.start
|
45
|
+
A.x
|
46
|
+
CallGraph.stop
|
47
|
+
```
|
48
|
+
|
49
|
+
Print the captured execution with the provided rake tasks.
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
# Rakefile
|
53
|
+
load 'call_graph/tasks/printer.rake'
|
54
|
+
```
|
55
|
+
|
56
|
+
```shell
|
57
|
+
$ rake -T
|
58
|
+
...
|
59
|
+
rake call_graph:printer:dot # write dot file
|
60
|
+
rake call_graph:printer:png # write png file from dot file
|
61
|
+
```
|
62
|
+
|
63
|
+
[![Example Graph](https://github.com/jamesmoriarty/call-graph/raw/master/examples/call-graph.png)](https://github.com/jamesmoriarty/call-graph/blob/master/examples/call-graph.png)
|
64
|
+
|
65
|
+
|
66
|
+
## Configuration
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
CallGraph.config do |config|
|
70
|
+
config.file_path = "examples/call-graph"
|
71
|
+
config.ignore_paths.clear
|
72
|
+
config.ignore_methods << "stop"
|
73
|
+
config.path(:png)
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
77
|
+
## Installation
|
78
|
+
|
79
|
+
Add this line to your application's Gemfile:
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
gem 'call_graph'
|
83
|
+
```
|
84
|
+
|
85
|
+
And then execute:
|
86
|
+
|
87
|
+
```
|
88
|
+
$ bundle
|
89
|
+
```
|
90
|
+
|
91
|
+
Or install it yourself as:
|
92
|
+
|
93
|
+
```
|
94
|
+
$ gem install call_graph
|
95
|
+
```
|
96
|
+
|
97
|
+
## Development
|
98
|
+
|
99
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
100
|
+
|
101
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
102
|
+
|
103
|
+
## Contributing
|
104
|
+
|
105
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/[USERNAME]/call_graph>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
106
|
+
|
107
|
+
## License
|
108
|
+
|
109
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'call_graph'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/call_graph.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'call_graph/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'call_graph'
|
8
|
+
spec.version = CallGraph::VERSION
|
9
|
+
spec.authors = ['James Moriarty']
|
10
|
+
spec.email = ['james.moriarty@rea-group.com']
|
11
|
+
|
12
|
+
spec.summary = 'Capture execution and create dependency graphs.'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = 'exe'
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_dependency 'binding_of_caller'
|
21
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
22
|
+
spec.add_development_dependency 'simplecov'
|
23
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
24
|
+
end
|
Binary file
|
data/examples/foobar.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# require "bundler/setup"
|
2
|
+
# require "call_graph"
|
3
|
+
# require "pry"
|
4
|
+
|
5
|
+
class A
|
6
|
+
def self.x
|
7
|
+
B.new.y
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class B
|
12
|
+
def y
|
13
|
+
1 + C.z do
|
14
|
+
1
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class C
|
20
|
+
def self.z
|
21
|
+
yield
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
CallGraph.config do |config|
|
26
|
+
config.file_path = "examples/call-graph"
|
27
|
+
end
|
28
|
+
|
29
|
+
[
|
30
|
+
CallGraph.config.path(:dot),
|
31
|
+
CallGraph.config.path(:tmp),
|
32
|
+
CallGraph.config.path(:png)
|
33
|
+
].each do |path|
|
34
|
+
`rm -f #{path}`
|
35
|
+
end
|
36
|
+
|
37
|
+
CallGraph.start
|
38
|
+
A.x
|
39
|
+
CallGraph.stop
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'set'
|
2
|
+
require 'binding_of_caller'
|
3
|
+
|
4
|
+
module CallGraph
|
5
|
+
class Instrument
|
6
|
+
attr_accessor :file_path, :ignore_paths, :ignore_methods, :set
|
7
|
+
|
8
|
+
def initialize(file_path: default_file_path, ignore_paths: default_ignore_paths, ignore_methods: default_ignore_methods)
|
9
|
+
@file_path = file_path
|
10
|
+
@ignore_paths = ignore_paths
|
11
|
+
@ignore_methods = ignore_methods
|
12
|
+
@set = Set.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def path(kind)
|
16
|
+
"#{file_path}.#{kind}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_file_path
|
20
|
+
'call_graph'
|
21
|
+
end
|
22
|
+
|
23
|
+
def default_ignore_paths
|
24
|
+
[
|
25
|
+
/#{RUBY_VERSION}/,
|
26
|
+
/\(eval\)/,
|
27
|
+
/bundle\/gems/,
|
28
|
+
/spec/,
|
29
|
+
/test/
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def default_ignore_methods
|
34
|
+
[
|
35
|
+
:require,
|
36
|
+
:set_encoding,
|
37
|
+
:initialize,
|
38
|
+
:new,
|
39
|
+
:attr_reader,
|
40
|
+
:method_added,
|
41
|
+
:private,
|
42
|
+
:inherited,
|
43
|
+
:singleton_method_added,
|
44
|
+
:set_trace_func,
|
45
|
+
:call
|
46
|
+
]
|
47
|
+
end
|
48
|
+
|
49
|
+
# :nocov:
|
50
|
+
# NOTE: - some calls outside the trace proc cause the vm to segvault.
|
51
|
+
# - i've be unable to extract methods because of the above.
|
52
|
+
def start
|
53
|
+
set_trace_func ->(event, file, _line, id, receiver_binding, classname) {
|
54
|
+
return if ignore_paths.any? { |path| file[path] }
|
55
|
+
|
56
|
+
case event
|
57
|
+
when 'call', 'c-call'
|
58
|
+
caller_binding = receiver_binding.of_caller(2)
|
59
|
+
|
60
|
+
caller_class = caller_binding.eval('self.class == Class ? self.name : self.class.name')
|
61
|
+
caller_class = caller_binding.frame_description unless caller_class
|
62
|
+
caller_class = caller_class + ' ' + caller_binding.eval("self.class == Class ? '(Class)' : '(Instance)'")
|
63
|
+
|
64
|
+
|
65
|
+
receiver_class = receiver_binding.eval('self.class == Class ? self.name : self.class.name')
|
66
|
+
receiver_class = caller_binding.frame_description if receiver_class.nil?
|
67
|
+
receiver_class = receiver_class + ' ' + receiver_binding.eval("self.class == Class ? '(Class)' : '(Instance)'")
|
68
|
+
|
69
|
+
return if classname == CallGraph
|
70
|
+
return if caller_class == receiver_class
|
71
|
+
return if ignore_methods.include?(id)
|
72
|
+
|
73
|
+
set.add("#{caller_class},#{receiver_class},#{id}")
|
74
|
+
end
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
def stop
|
79
|
+
File.open(path(:tmp), 'w') { |fd| fd.write set.to_a.compact.join("\n") }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module CallGraph
|
2
|
+
module Printers
|
3
|
+
class Dot
|
4
|
+
class Line
|
5
|
+
attr_reader :caller, :receiver, :attributes
|
6
|
+
|
7
|
+
def initialize(caller, receiver, attributes = {})
|
8
|
+
@caller = caller
|
9
|
+
@receiver = receiver
|
10
|
+
@attributes = attributes
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'call_graph/printers/dot/line'
|
2
|
+
|
3
|
+
module CallGraph
|
4
|
+
module Printers
|
5
|
+
class Dot
|
6
|
+
attr_reader :config
|
7
|
+
|
8
|
+
def initialize(config)
|
9
|
+
@config = config
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
ERB.new(TEMPLATE, trim_mode: '>').result(binding)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def lines
|
19
|
+
IO.read(config.path(:tmp))
|
20
|
+
.split("\n")
|
21
|
+
.uniq
|
22
|
+
.map { |line| line.split(',') }
|
23
|
+
.map { |c, r, id| Line.new(c, r, label: id) }
|
24
|
+
end
|
25
|
+
|
26
|
+
TEMPLATE = <<~EOF.chomp
|
27
|
+
digraph call_graph {
|
28
|
+
<% lines.each do |line| %>
|
29
|
+
"<%= line.caller %>" -> "<%= line.receiver %>" [<% line.attributes.each do |(name, value)| %><%= name %>="<%= value %>"<% end %>];
|
30
|
+
<% end %>}
|
31
|
+
EOF
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module CallGraph
|
2
|
+
module Printers
|
3
|
+
class Png
|
4
|
+
attr_reader :config
|
5
|
+
|
6
|
+
def initialize(config)
|
7
|
+
@config = config
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
unless `which dot`.empty?
|
12
|
+
`dot -Tpng #{src}`
|
13
|
+
else
|
14
|
+
raise 'Error: unable to find dot executable in $PATH'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def src
|
21
|
+
config.path(:dot)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'call_graph'
|
2
|
+
|
3
|
+
namespace :call_graph do
|
4
|
+
namespace :printer do
|
5
|
+
desc 'write dot file'
|
6
|
+
task :dot do
|
7
|
+
content = CallGraph::Printers::Dot.new(CallGraph.config).to_s
|
8
|
+
path = CallGraph.config.path(:dot)
|
9
|
+
|
10
|
+
write_file(path, content)
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'write png file from dot file'
|
14
|
+
task png: :dot do
|
15
|
+
content = CallGraph::Printers::Png.new(CallGraph.config).to_s
|
16
|
+
path = CallGraph.config.path(:png)
|
17
|
+
|
18
|
+
write_file(path, content)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def write_file(path, content)
|
24
|
+
File.open(path, 'w') do |file|
|
25
|
+
file.write content
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/call_graph.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'call_graph/version'
|
2
|
+
require 'call_graph/instrument'
|
3
|
+
require 'call_graph/printers/dot'
|
4
|
+
require 'call_graph/printers/png'
|
5
|
+
|
6
|
+
module CallGraph
|
7
|
+
def self.start
|
8
|
+
instrument.start
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.config
|
12
|
+
if block_given?
|
13
|
+
yield instrument
|
14
|
+
else
|
15
|
+
instrument
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.stop
|
20
|
+
set_trace_func nil
|
21
|
+
|
22
|
+
instrument.stop
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def self.instrument
|
28
|
+
@instrument ||= begin
|
29
|
+
Instrument.new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: call_graph
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Moriarty
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-24 00:00:00.000000000 Z
|
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'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simplecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- james.moriarty@rea-group.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
78
|
+
- CODE_OF_CONDUCT.md
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/console
|
84
|
+
- bin/setup
|
85
|
+
- call_graph.gemspec
|
86
|
+
- examples/call-graph.dot
|
87
|
+
- examples/call-graph.png
|
88
|
+
- examples/call-graph.tmp
|
89
|
+
- examples/foobar.rb
|
90
|
+
- lib/call_graph.rb
|
91
|
+
- lib/call_graph/instrument.rb
|
92
|
+
- lib/call_graph/printers/dot.rb
|
93
|
+
- lib/call_graph/printers/dot/line.rb
|
94
|
+
- lib/call_graph/printers/png.rb
|
95
|
+
- lib/call_graph/tasks/printer.rake
|
96
|
+
- lib/call_graph/version.rb
|
97
|
+
homepage:
|
98
|
+
licenses:
|
99
|
+
- MIT
|
100
|
+
metadata: {}
|
101
|
+
post_install_message:
|
102
|
+
rdoc_options: []
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubygems_version: 3.0.1
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: Capture execution and create dependency graphs.
|
120
|
+
test_files: []
|