repo_dependency_graph 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/repo_dependency_graph/version.rb +1 -1
- data/lib/repo_dependency_graph.rb +25 -14
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: 3b747f1f7904582008138cbceb30e2a2a3806b58
|
4
|
+
data.tar.gz: 53d83c779792695eabc1779a1e92a4abc7683234
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6924b8148a9526cc05989c9a2ec1077a51dd234060949da5fc84db943c85a80c2aad08a7685ad392cbec3bd24d08ed3d5fffcbeda42d03c9d77b042787ca6d29
|
7
|
+
data.tar.gz: 66d0bdcdc628b3ed70289b31e99294062e237e340620380ff7afc9e93ee7e16147bcc109bd0b5dfd682228209f3621653d737354568c28f204b9b853701839ed
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -4,7 +4,7 @@ require "bundler" # get all dependency for lockfile_parser
|
|
4
4
|
|
5
5
|
module RepoDependencyGraph
|
6
6
|
class << self
|
7
|
-
|
7
|
+
MAX_HEX = 255
|
8
8
|
|
9
9
|
def run(options)
|
10
10
|
draw(dependencies(options))
|
@@ -18,16 +18,15 @@ module RepoDependencyGraph
|
|
18
18
|
|
19
19
|
g = GraphViz.new(:G, :type => :digraph)
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
puts counts.inspect
|
24
|
-
max = counts.values.max
|
21
|
+
counts = dependency_counts(dependencies)
|
22
|
+
range = counts.values.min..counts.values.max
|
25
23
|
|
26
|
-
nodes = Hash[
|
27
|
-
|
24
|
+
nodes = Hash[counts.map do |project, count|
|
25
|
+
node = g.add_node(project, :color => color(count, range), :style => "filled")
|
26
|
+
[project, node]
|
28
27
|
end]
|
29
28
|
|
30
|
-
dependencies.each do |project,dependencies|
|
29
|
+
dependencies.each do |project, dependencies|
|
31
30
|
dependencies.each do |dependency|
|
32
31
|
g.add_edge(nodes[project], nodes[dependency])
|
33
32
|
end
|
@@ -37,7 +36,9 @@ module RepoDependencyGraph
|
|
37
36
|
end
|
38
37
|
|
39
38
|
def dependencies(options)
|
40
|
-
|
39
|
+
if options[:map] && options[:external]
|
40
|
+
raise ArgumentError, "Map only makes sense when searching for internal repos"
|
41
|
+
end
|
41
42
|
|
42
43
|
all = Bundler::OrganizationAudit::Repo.all(options).sort_by(&:project)
|
43
44
|
all = all.select(&:private?) if options[:private]
|
@@ -81,12 +82,22 @@ module RepoDependencyGraph
|
|
81
82
|
gsub(/(File|IO)\.read\(.*?\)/, '"1.2.3"')
|
82
83
|
end
|
83
84
|
|
84
|
-
def color(value,
|
85
|
-
value
|
86
|
-
|
87
|
-
|
88
|
-
|
85
|
+
def color(value, range)
|
86
|
+
value -= range.min # lowest -> green
|
87
|
+
max = range.max - range.min
|
88
|
+
|
89
|
+
i = (value * MAX_HEX / max);
|
90
|
+
i *= 0.6 # green-blue gradient instead of green-green
|
91
|
+
half = MAX_HEX * 0.5
|
92
|
+
values = [0,2,4].map { |v| (Math.sin(0.024 * i + v) * half + half).round.to_s(16).rjust(2, "0") }
|
89
93
|
"##{values.join}"
|
90
94
|
end
|
95
|
+
|
96
|
+
def dependency_counts(dependencies)
|
97
|
+
all = (dependencies.keys + dependencies.values.flatten).uniq
|
98
|
+
Hash[all.map do |k|
|
99
|
+
[k, dependencies.values.count { |v| v.include?(k) } ]
|
100
|
+
end]
|
101
|
+
end
|
91
102
|
end
|
92
103
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|