callgraphy 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 29225780635c57496566adb69881751e4adbbcdc
4
- data.tar.gz: 18dbbff30817c6990c76bfeb00067c73d39f2e5d
2
+ SHA256:
3
+ metadata.gz: cf290f97bfc414d06c153eefd8833c711aef9935d23be42af909af570657174b
4
+ data.tar.gz: 76835017ac153d8db737e9399c640dd723d80dba99a157a4b55fbdd2f9baf12f
5
5
  SHA512:
6
- metadata.gz: 3f44b0e5c67c16f6a061312e1372d67ea97cbafe60d48a62eaa16c03aba34c19d7d248dde30061c5965e6311c78a8c57391b0f8b0c66d5d2f50951438bd56584
7
- data.tar.gz: 39885e30e554d0b1528d246e928a91b75d75692a28b7152f7a9f9802bcb565828dabc7f3378a5598541fd7b5e68c19c16712e42252fecaaff2d922640b1a40c8
6
+ metadata.gz: f561ab7f16dc7519f8624654dc905211211c5decc266040ca428100f07b42c00abb587613dd54d66fbb2cb0ea8b1ac79fe4658fd5b3d38797f83d3cd8503fada
7
+ data.tar.gz: 19c76f83d8553cc0a400bc64f9401a6f5f1f51a0ecaed5ff17a9440f633c7b12cb6a197ef2a772e331151c56d5a18b3b2f57e3726706edfb01b508f17e558211
data/.rubocop.yml CHANGED
@@ -1,22 +1,41 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.1
2
+ NewCops: enable
3
+ TargetRubyVersion: 2.7
3
4
 
4
5
  Exclude:
5
6
  - "bin/**/*"
7
+ - "sample/*"
8
+
9
+
10
+ # Soon...
11
+ Gemspec/RequireMFA:
12
+ Enabled: false
13
+
14
+ # I'm okay with more complex methods in specs.
15
+ Metrics/AbcSize:
16
+ Max: 25
17
+ Include:
18
+ - "spec/**/*"
19
+
20
+ Metrics/BlockLength:
21
+ Exclude:
22
+ - "spec/**/*"
6
23
 
7
24
  Metrics/LineLength:
8
25
  Max: 120
9
26
 
27
+ Naming/VariableNumber:
28
+ EnforcedStyle: snake_case
29
+
10
30
  # I like to use the hash rocket in rake files and the sample.
11
31
  Style/HashSyntax:
12
32
  Exclude:
13
33
  - "Rakefile"
14
- - "sample/rule_service_graph.rb"
34
+ - "sample/*"
15
35
 
16
- # I like to use a difference alignment for the sample.
17
- Style/AlignParameters:
18
- Exclude:
19
- - "sample/rule_service_graph.rb"
36
+ # I am not going to optimize by freezing strings.
37
+ Style/FrozenStringLiteralComment:
38
+ Enabled: false
20
39
 
21
40
  # I'll just use double quotes everywhere.
22
41
  Style/StringLiterals:
@@ -30,12 +49,10 @@ Style/MutableConstant:
30
49
  Style/SignalException:
31
50
  Enabled: false
32
51
 
52
+ # I'm not so fond of %i for symbol arrays.
53
+ Style/SymbolArray:
54
+ Enabled: false
55
+
33
56
  # I'm not so fond of %w for word arrays.
34
57
  Style/WordArray:
35
58
  Enabled: false
36
-
37
- # I'm okay with more complex methods in specs.
38
- Metrics/AbcSize:
39
- Max: 25
40
- Include:
41
- - "spec/**/*"
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.4
1
+ 2.7.6
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Callgraphy
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/callgraphy.svg)](https://badge.fury.io/rb/callgraphy)
4
+ [![GitHub license](https://img.shields.io/github/license/mashape/apistatus.svg)]()
4
5
 
5
6
  Callgraphy is a simple tool that provides a DSL for creating call tree graphs for a target class.
6
7
 
data/bin/bundle ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1 || ">= 0.a"
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_version
64
+ @bundler_version ||= begin
65
+ env_var_version || cli_arg_version ||
66
+ lockfile_version || "#{Gem::Requirement.default}.a"
67
+ end
68
+ end
69
+
70
+ def load_bundler!
71
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
72
+
73
+ # must dup string for RG < 1.8 compatibility
74
+ activate_bundler(bundler_version.dup)
75
+ end
76
+
77
+ def activate_bundler(bundler_version)
78
+ if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
79
+ bundler_version = "< 2"
80
+ end
81
+ gem_error = activation_error_handling do
82
+ gem "bundler", bundler_version
83
+ end
84
+ return if gem_error.nil?
85
+ require_error = activation_error_handling do
86
+ require "bundler/version"
87
+ end
88
+ return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
89
+ warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
90
+ exit 42
91
+ end
92
+
93
+ def activation_error_handling
94
+ yield
95
+ nil
96
+ rescue StandardError, LoadError => e
97
+ e
98
+ end
99
+ end
100
+
101
+ m.load_bundler!
102
+
103
+ if m.invoked_as_script?
104
+ load Gem.bin_path("bundler", "bundle")
105
+ end
data/bin/bundler CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/dot2ruby CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -10,6 +12,17 @@ require "pathname"
10
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
13
  Pathname.new(__FILE__).realpath)
12
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
13
26
  require "rubygems"
14
27
  require "bundler/setup"
15
28
 
data/bin/gem2gv CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -10,6 +12,17 @@ require "pathname"
10
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
13
  Pathname.new(__FILE__).realpath)
12
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
13
26
  require "rubygems"
14
27
  require "bundler/setup"
15
28
 
data/bin/git2gv CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -10,6 +12,17 @@ require "pathname"
10
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
13
  Pathname.new(__FILE__).realpath)
12
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
13
26
  require "rubygems"
14
27
  require "bundler/setup"
15
28
 
data/bin/htmldiff CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -10,6 +12,17 @@ require "pathname"
10
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
13
  Pathname.new(__FILE__).realpath)
12
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
13
26
  require "rubygems"
14
27
  require "bundler/setup"
15
28
 
data/bin/ldiff CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -10,6 +12,17 @@ require "pathname"
10
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
13
  Pathname.new(__FILE__).realpath)
12
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
13
26
  require "rubygems"
14
27
  require "bundler/setup"
15
28
 
data/bin/mutant CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/rake CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -10,6 +12,17 @@ require "pathname"
10
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
13
  Pathname.new(__FILE__).realpath)
12
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
13
26
  require "rubygems"
14
27
  require "bundler/setup"
15
28
 
data/bin/rspec CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -10,6 +12,17 @@ require "pathname"
10
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
13
  Pathname.new(__FILE__).realpath)
12
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
13
26
  require "rubygems"
14
27
  require "bundler/setup"
15
28
 
data/bin/rubocop CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -10,6 +12,17 @@ require "pathname"
10
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
13
  Pathname.new(__FILE__).realpath)
12
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
13
26
  require "rubygems"
14
27
  require "bundler/setup"
15
28
 
data/bin/ruby-parse CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -10,6 +12,17 @@ require "pathname"
10
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
13
  Pathname.new(__FILE__).realpath)
12
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
13
26
  require "rubygems"
14
27
  require "bundler/setup"
15
28
 
data/bin/ruby-rewrite CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -10,6 +12,17 @@ require "pathname"
10
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
13
  Pathname.new(__FILE__).realpath)
12
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
13
26
  require "rubygems"
14
27
  require "bundler/setup"
15
28
 
data/bin/ruby2gv CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -10,6 +12,17 @@ require "pathname"
10
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
13
  Pathname.new(__FILE__).realpath)
12
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
13
26
  require "rubygems"
14
27
  require "bundler/setup"
15
28
 
data/bin/unparser CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # This file was generated by Bundler.
4
5
  #
data/bin/xml2gv CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -10,6 +12,17 @@ require "pathname"
10
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
13
  Pathname.new(__FILE__).realpath)
12
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
13
26
  require "rubygems"
14
27
  require "bundler/setup"
15
28
 
data/callgraphy.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require "callgraphy/version"
4
4
 
@@ -17,14 +17,12 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.required_ruby_version = "~> 2.1"
20
+ spec.required_ruby_version = ">= 2.7", "< 3.0"
21
21
 
22
- spec.add_runtime_dependency "ruby-graphviz", "~> 1.2", ">= 1.2.0"
22
+ spec.add_runtime_dependency "ruby-graphviz", "~> 1.2"
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.11", ">= 1.11.0"
25
- spec.add_development_dependency "mutant-rspec", "~> 0.8.0"
26
- spec.add_development_dependency "rake", "~> 11.1", ">= 11.1.0"
27
- spec.add_development_dependency "rspec", "~> 3.4", ">= 3.4.0"
28
- spec.add_development_dependency "rubocop", "~> 0.38"
29
- spec.add_development_dependency "simplecov", "~> 0.11"
24
+ spec.add_development_dependency "rake", "~> 13.0"
25
+ spec.add_development_dependency "rspec", "~> 3.11"
26
+ spec.add_development_dependency "rubocop", "~> 1.32"
27
+ spec.add_development_dependency "simplecov", "~> 0.21"
30
28
  end
@@ -14,7 +14,7 @@ module Callgraphy
14
14
  attr_reader :registry
15
15
 
16
16
  def self.draw(target, output_directory, registry)
17
- new(target, output_directory, registry).graph
17
+ new(target, output_directory, registry).draw
18
18
  end
19
19
 
20
20
  def initialize(target, output_directory, registry)
@@ -25,7 +25,7 @@ module Callgraphy
25
25
  @nodes = {}
26
26
  end
27
27
 
28
- def graph
28
+ def draw
29
29
  add_methods
30
30
  add_constants
31
31
  add_calls
@@ -36,21 +36,25 @@ module Callgraphy
36
36
  private
37
37
 
38
38
  def add_methods
39
- registry.all_public_methods.each { |name| add_node(name, NODE_OPTIONS[:public]) }
40
- registry.all_private_methods.each { |name| add_node(name, NODE_OPTIONS[:private]) }
39
+ registry.all_public_methods.each { |name| add_method(name, :public) }
40
+ registry.all_private_methods.each { |name| add_method(name, :private) }
41
41
  end
42
42
 
43
43
  def add_constants
44
- registry.all_callers.each { |name| add_node(name, add_constant_label(name, NODE_OPTIONS[:callers])) }
45
- registry.all_dependencies.each { |name| add_node(name, add_constant_label(name, NODE_OPTIONS[:dependencies])) }
44
+ registry.all_callers.each { |name| add_constant(name, :callers) }
45
+ registry.all_dependencies.each { |name| add_constant(name, :dependencies) }
46
46
  end
47
47
 
48
- def add_node(node_name, node_opts)
49
- @nodes[node_name] = graphviz.add_nodes(node_name, node_opts.dup)
48
+ def add_method(method_name, node_type)
49
+ add_node(method_name, NODE_OPTIONS[node_type])
50
50
  end
51
51
 
52
- def add_constant_label(constant_name, node_opts)
53
- node_opts.merge(label: Utils.pascal_case(constant_name))
52
+ def add_constant(constant_name, node_type)
53
+ add_node(constant_name, NODE_OPTIONS[node_type].merge(label: Utils.pascal_case(constant_name)))
54
+ end
55
+
56
+ def add_node(node_name, options)
57
+ @nodes[node_name] = graphviz.add_nodes(node_name, options.dup)
54
58
  end
55
59
 
56
60
  def add_calls
@@ -14,12 +14,12 @@ module Callgraphy
14
14
  @registry = registry
15
15
  end
16
16
 
17
- def methods_to_graph(method_scope, calls)
17
+ def methods_to_graph(method_scope, calls = {})
18
18
  validate_scope(method_scope, :public, :private)
19
19
  register_methods_to_graph(method_scope, calls)
20
20
  end
21
21
 
22
- def constants_to_graph(constant_scope, calls)
22
+ def constants_to_graph(constant_scope, calls = {})
23
23
  validate_scope(constant_scope, :callers, :dependencies)
24
24
  register_constants_to_graph(constant_scope, calls)
25
25
  end
@@ -1,3 +1,3 @@
1
1
  module Callgraphy
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: callgraphy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alistair McKinnell
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-24 00:00:00.000000000 Z
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-graphviz
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.2'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 1.2.0
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,112 +24,63 @@ dependencies:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.2'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 1.2.0
33
- - !ruby/object:Gem::Dependency
34
- name: bundler
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1.11'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 1.11.0
43
- type: :development
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '1.11'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 1.11.0
53
- - !ruby/object:Gem::Dependency
54
- name: mutant-rspec
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: 0.8.0
60
- type: :development
61
- prerelease: false
62
- version_requirements: !ruby/object:Gem::Requirement
63
- requirements:
64
- - - "~>"
65
- - !ruby/object:Gem::Version
66
- version: 0.8.0
67
27
  - !ruby/object:Gem::Dependency
68
28
  name: rake
69
29
  requirement: !ruby/object:Gem::Requirement
70
30
  requirements:
71
31
  - - "~>"
72
32
  - !ruby/object:Gem::Version
73
- version: '11.1'
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: 11.1.0
33
+ version: '13.0'
77
34
  type: :development
78
35
  prerelease: false
79
36
  version_requirements: !ruby/object:Gem::Requirement
80
37
  requirements:
81
38
  - - "~>"
82
39
  - !ruby/object:Gem::Version
83
- version: '11.1'
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- version: 11.1.0
40
+ version: '13.0'
87
41
  - !ruby/object:Gem::Dependency
88
42
  name: rspec
89
43
  requirement: !ruby/object:Gem::Requirement
90
44
  requirements:
91
45
  - - "~>"
92
46
  - !ruby/object:Gem::Version
93
- version: '3.4'
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: 3.4.0
47
+ version: '3.11'
97
48
  type: :development
98
49
  prerelease: false
99
50
  version_requirements: !ruby/object:Gem::Requirement
100
51
  requirements:
101
52
  - - "~>"
102
53
  - !ruby/object:Gem::Version
103
- version: '3.4'
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- version: 3.4.0
54
+ version: '3.11'
107
55
  - !ruby/object:Gem::Dependency
108
56
  name: rubocop
109
57
  requirement: !ruby/object:Gem::Requirement
110
58
  requirements:
111
59
  - - "~>"
112
60
  - !ruby/object:Gem::Version
113
- version: '0.38'
61
+ version: '1.32'
114
62
  type: :development
115
63
  prerelease: false
116
64
  version_requirements: !ruby/object:Gem::Requirement
117
65
  requirements:
118
66
  - - "~>"
119
67
  - !ruby/object:Gem::Version
120
- version: '0.38'
68
+ version: '1.32'
121
69
  - !ruby/object:Gem::Dependency
122
70
  name: simplecov
123
71
  requirement: !ruby/object:Gem::Requirement
124
72
  requirements:
125
73
  - - "~>"
126
74
  - !ruby/object:Gem::Version
127
- version: '0.11'
75
+ version: '0.21'
128
76
  type: :development
129
77
  prerelease: false
130
78
  version_requirements: !ruby/object:Gem::Requirement
131
79
  requirements:
132
80
  - - "~>"
133
81
  - !ruby/object:Gem::Version
134
- version: '0.11'
135
- description:
82
+ version: '0.21'
83
+ description:
136
84
  email:
137
85
  - alistair.mckinnell@gmail.com
138
86
  executables: []
@@ -149,6 +97,7 @@ files:
149
97
  - LICENSE.txt
150
98
  - README.md
151
99
  - Rakefile
100
+ - bin/bundle
152
101
  - bin/bundler
153
102
  - bin/console
154
103
  - bin/dot2ruby
@@ -179,24 +128,26 @@ homepage: https://github.com/amckinnell/callgraphy
179
128
  licenses:
180
129
  - MIT
181
130
  metadata: {}
182
- post_install_message:
131
+ post_install_message:
183
132
  rdoc_options: []
184
133
  require_paths:
185
134
  - lib
186
135
  required_ruby_version: !ruby/object:Gem::Requirement
187
136
  requirements:
188
- - - "~>"
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '2.7'
140
+ - - "<"
189
141
  - !ruby/object:Gem::Version
190
- version: '2.1'
142
+ version: '3.0'
191
143
  required_rubygems_version: !ruby/object:Gem::Requirement
192
144
  requirements:
193
145
  - - ">="
194
146
  - !ruby/object:Gem::Version
195
147
  version: '0'
196
148
  requirements: []
197
- rubyforge_project:
198
- rubygems_version: 2.4.8
199
- signing_key:
149
+ rubygems_version: 3.3.18
150
+ signing_key:
200
151
  specification_version: 4
201
152
  summary: A command line tool for creating a call graph for a target class.
202
153
  test_files: []