visualize_packs 0.5.6 → 0.5.7
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/lib/graph.dot.erb +1 -5
- data/lib/visualize_packs.rb +19 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 698ac9ebae377a99e2b9b5fe62c3646bcaa8b4ce81439feee7354d81d80682c1
|
4
|
+
data.tar.gz: 15335a5ce4cc6eb90926af902da548c268bc6c86caa8ae6fd9df5127cfb7e071
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79f8106bfafe0a7cd9c17ff6f886871b4a24990e562a389b5dab45ff5838a3a0a22fc225d44ea7afcdeb8d8a20ff98e2037b74ed95cd170964027b8b53d40176
|
7
|
+
data.tar.gz: 5e5d466148f46ee4876baa8ae184187115bc5d77f66d36d8396867c4fb61066f47ac6b32e22781fcbd4d98c7b387f60f271a8b0cc1a89f91ba383462ca48fcec
|
data/lib/graph.dot.erb
CHANGED
@@ -102,11 +102,7 @@ digraph package_diagram {
|
|
102
102
|
<%- elsif todo_type == 'dependency' -%>
|
103
103
|
arrowhead=odot
|
104
104
|
<%- end -%>
|
105
|
-
|
106
|
-
max_edge_width = 10
|
107
|
-
edge_width = (todo_types[todo_type].count / max_todo_count.to_f * max_edge_width).to_i
|
108
|
-
-%>
|
109
|
-
penwidth=<%= edge_width -%>
|
105
|
+
penwidth=<%= todo_edge_width(todo_types[todo_type].count, max_todo_count) -%>
|
110
106
|
]
|
111
107
|
<%- end -%>
|
112
108
|
<%- end -%>
|
data/lib/visualize_packs.rb
CHANGED
@@ -131,6 +131,25 @@ module VisualizePacks
|
|
131
131
|
todo_counts.values.max
|
132
132
|
end
|
133
133
|
|
134
|
+
def self.todo_edge_width(todo_count, max_count)
|
135
|
+
# Limits
|
136
|
+
min_width = 1
|
137
|
+
max_width = 10
|
138
|
+
min_count = 1 # Number of todos equivalent to min_width
|
139
|
+
|
140
|
+
# Ensure safe values
|
141
|
+
return 0 if todo_count < min_count
|
142
|
+
return max_width if todo_count > max_count
|
143
|
+
|
144
|
+
todo_range = max_count - min_count
|
145
|
+
width_range = max_width - min_width
|
146
|
+
count_delta = todo_count - min_count
|
147
|
+
|
148
|
+
width_delta = count_delta / todo_range.to_f * width_range
|
149
|
+
edge_width = min_width + width_delta
|
150
|
+
edge_width.round(2)
|
151
|
+
end
|
152
|
+
|
134
153
|
def self.filtered(packages, filter_package, filter_folder, exclude_packs)
|
135
154
|
return packages unless filter_package || filter_folder || exclude_packs.any?
|
136
155
|
|