repo_dependency_graph 0.1.0 → 0.1.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bin/repo-dependency-graph +1 -1
- data/lib/repo_dependency_graph/version.rb +1 -1
- data/lib/repo_dependency_graph.rb +20 -4
- data.tar.gz.sig +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f1a26045d0b94cabc0caeb7415be53c913fafa4
|
4
|
+
data.tar.gz: 244ea25f2123ab0ec616ddddf8218b831f0b72e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0e1e081ced8f8840fe666be5fc9564a03367488eaa2ba9e551ca98f79818fc38458b116329477d90fce06e90ecbaa75654c902fb2dcb6262c528728d8b2723a
|
7
|
+
data.tar.gz: d98badb12c110eac67a196000cd8ad0162365e87a0ee149778282fe087431e8a41fb00f4a037fb88422847ba2ef882093c34c18f659dcb8f6fa831f2d228c479
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bin/repo-dependency-graph
CHANGED
@@ -24,7 +24,7 @@ Options:
|
|
24
24
|
BANNER
|
25
25
|
opts.on("--token TOKEN", "Use token") { |token| options[:token] = token }
|
26
26
|
opts.on("--user USER", "Use user") { |user| options[:user] = user }
|
27
|
-
opts.on("--organization ORGANIZATION", "Use
|
27
|
+
opts.on("--organization ORGANIZATION", "Use organization") { |organization| options[:organization] = organization }
|
28
28
|
opts.on("--private", "Only show private repos") { options[:private] = true }
|
29
29
|
opts.on("--external", "Also include external projects in graph (can get super-messy)") { options[:external] = true }
|
30
30
|
opts.on("--map SEARCH=REPLACE", "Replace in project name to find them as internal: 'foo=bar' -> replace foo in repo names to bar") do |map|
|
@@ -4,6 +4,8 @@ require "bundler" # get all dependency for lockfile_parser
|
|
4
4
|
|
5
5
|
module RepoDependencyGraph
|
6
6
|
class << self
|
7
|
+
MAX_SATURATION = 255
|
8
|
+
|
7
9
|
def run(options)
|
8
10
|
draw(dependencies(options))
|
9
11
|
0
|
@@ -17,7 +19,13 @@ module RepoDependencyGraph
|
|
17
19
|
g = GraphViz.new(:G, :type => :digraph)
|
18
20
|
|
19
21
|
all = (dependencies.keys + dependencies.values.flatten).uniq
|
20
|
-
|
22
|
+
counts = Hash[all.map { |k| [k, dependencies.values.count { |v| v.include?(k) }] }]
|
23
|
+
puts counts.inspect
|
24
|
+
max = counts.values.max
|
25
|
+
|
26
|
+
nodes = Hash[all.map do |k|
|
27
|
+
[k, g.add_node(k, :color => color(counts[k] - 1, max), :style => "filled")]
|
28
|
+
end]
|
21
29
|
|
22
30
|
dependencies.each do |project,dependencies|
|
23
31
|
dependencies.each do |dependency|
|
@@ -32,9 +40,9 @@ module RepoDependencyGraph
|
|
32
40
|
raise ArgumentError, "Map only makes sense when searching for internal repos" if options[:map] && options[:external]
|
33
41
|
|
34
42
|
all = Bundler::OrganizationAudit::Repo.all(options).sort_by(&:project)
|
35
|
-
all.select
|
36
|
-
all.select
|
37
|
-
all.reject
|
43
|
+
all = all.select(&:private?) if options[:private]
|
44
|
+
all = all.select { |r| r.project =~ options[:select] } if options[:select]
|
45
|
+
all = all.reject { |r| r.project =~ options[:reject] } if options[:reject]
|
38
46
|
|
39
47
|
possible = all.map(&:project)
|
40
48
|
possible.map! { |p| p.sub(options[:map][0], options[:map][1].to_s) } if options[:map]
|
@@ -72,5 +80,13 @@ module RepoDependencyGraph
|
|
72
80
|
gsub(/^\s*\$(:|LOAD_PATH).*/, "").
|
73
81
|
gsub(/(File|IO)\.read\(.*?\)/, '"1.2.3"')
|
74
82
|
end
|
83
|
+
|
84
|
+
def color(value, max)
|
85
|
+
value *= 0.6 # change green to green to green to blue
|
86
|
+
i = (value * MAX_SATURATION / max);
|
87
|
+
a,b = MAX_SATURATION / 2, MAX_SATURATION - MAX_SATURATION / 2
|
88
|
+
values = [0,2,4].map { |v| (Math.sin(0.024 * i + v) * a + b).round.to_s(16).rjust(2,"0") }
|
89
|
+
"##{values.join}"
|
90
|
+
end
|
75
91
|
end
|
76
92
|
end
|
data.tar.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
9��<Ӂ�7e=.:8�����M����s�4#!������� �2�2�axgq%P<5�+�W����5��}�
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repo_dependency_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
y0kCSWmK6D+x/SbfS6r7Ke07MRqziJdB9GuE1+0cIRuFh8EQ+LN6HXCKM5pon/GU
|
30
30
|
ycwMXfl0
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2013-08-
|
32
|
+
date: 2013-08-18 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: bundler-organization_audit
|
metadata.gz.sig
CHANGED
Binary file
|