show_dependency 0.0.1 → 0.0.2
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 +4 -4
- data/bin/show_ffi_inherit.rb +53 -0
- data/lib/show_dependency/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4409e684b7089a4c3e504157bfa39a606d93033
|
4
|
+
data.tar.gz: 015e220c5b4d51ba832f53d0ed16fbd06936e665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0224f312d834b6152c6e8aa39c925f8aa2ab82de8e1c22d81302f72e9791fafcb4af455f6657667a80faac181f7a97ed9a7f898107e6a98939b31491014b573f
|
7
|
+
data.tar.gz: 0abf5e2b4833cc3ce5418c6f3b2ed3ec9805ae0acae484bdfdb80a3bed970fd5d11118a9e999ea81879697c7a84c79770fbe950c7031be34304694075fd5b853
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "ffi"
|
2
|
+
|
3
|
+
unless (ARGV & ['-h', '--help']).empty?
|
4
|
+
abort <<-EOS
|
5
|
+
Syntax:
|
6
|
+
#{__FILE__} [-O]
|
7
|
+
-O auto create png file
|
8
|
+
EOS
|
9
|
+
end
|
10
|
+
|
11
|
+
$auto_create_png = ARGV.delete('-O')
|
12
|
+
|
13
|
+
#---------
|
14
|
+
cls = FFI.constants.uniq.select{ |x| x !~ /Error/i }
|
15
|
+
.map { |x|
|
16
|
+
m=FFI.module_eval(x.to_s)
|
17
|
+
m.class == Class && x.to_s == m.name.split('::')[-1] ? m : nil
|
18
|
+
}.compact.sort_by { |x| x.name }
|
19
|
+
|
20
|
+
cls.sort_by! { |x| [x.ancestors.size, x.ancestors[1..-1].to_s] }
|
21
|
+
|
22
|
+
gr_edges = []
|
23
|
+
cls.each do |m|
|
24
|
+
v = m.ancestors
|
25
|
+
v.each_cons(2) do |x, y|
|
26
|
+
gr_edges << " #{format '%-22s', x.name.split('::')[-1]} -> #{y.name.split('::')[-1]}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
gr_edges.uniq!
|
31
|
+
gr_most_use = %w{MemoryPointer Struct Union Enums Buffer }.map { |x| " #{x} [color=blue]" }
|
32
|
+
#---------
|
33
|
+
|
34
|
+
|
35
|
+
if $auto_create_png
|
36
|
+
dotfn = "ffi_cls.dot"
|
37
|
+
o = File.open(dotfn, 'w')
|
38
|
+
pngfn = dotfn + ".png"
|
39
|
+
else
|
40
|
+
o = $stdout
|
41
|
+
end
|
42
|
+
o.puts "digraph G {"
|
43
|
+
o.puts gr_edges
|
44
|
+
o.puts
|
45
|
+
o.puts gr_most_use
|
46
|
+
o.puts
|
47
|
+
o.puts "}"
|
48
|
+
|
49
|
+
if pngfn
|
50
|
+
o.close
|
51
|
+
system "dot -Tpng -o#{pngfn} #{dotfn}"
|
52
|
+
end
|
53
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: show_dependency
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- windwiny
|
@@ -43,6 +43,7 @@ email:
|
|
43
43
|
- windwiny.ubt@gmail.com
|
44
44
|
executables:
|
45
45
|
- show_brew_depend.rb
|
46
|
+
- show_ffi_inherit.rb
|
46
47
|
- show_gems_depend.rb
|
47
48
|
extensions: []
|
48
49
|
extra_rdoc_files: []
|
@@ -53,6 +54,7 @@ files:
|
|
53
54
|
- README.md
|
54
55
|
- Rakefile
|
55
56
|
- bin/show_brew_depend.rb
|
57
|
+
- bin/show_ffi_inherit.rb
|
56
58
|
- bin/show_gems_depend.rb
|
57
59
|
- lib/show_dependency.rb
|
58
60
|
- lib/show_dependency/version.rb
|