gem_dependencies_visualizer 0.1.1 → 0.1.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/CHANGELOG.md +9 -0
- data/lib/gem_dependencies_visualizer/version.rb +1 -1
- data/lib/gem_dependencies_visualizer.rb +48 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e1b5c2e069f8f02090a5c009799d19620d2aad3
|
4
|
+
data.tar.gz: a7db7cbf70c542ea3b7069229d83083e47cdd6c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a3652a5c7d05d52f0e87dda7409abf4ae3c2de794ac4a4c3d6efd46702f7318314927b991b99679dbeac18153c37614c9e2ed304e7e05875d83775cbc294a44
|
7
|
+
data.tar.gz: 116715344d7289cfe57e38ade7b7eb77b0a984129705d79b2a4a4a4189c157faaa2a074420dc2aa01a9b8c08d1295d4155fac9e875a5b8dde416edadd4cdab7b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 0.1.2 (2016-09-04)
|
2
|
+
|
3
|
+
Fixes:
|
4
|
+
* Regex is now updated to support gems without version set
|
5
|
+
|
6
|
+
Features:
|
7
|
+
* Allow clients to set if they want the gem version in the graph
|
8
|
+
* Read through the whole Gemfile.lock content (not just the first)
|
9
|
+
|
1
10
|
## 0.1.1 (2016-09-02)
|
2
11
|
|
3
12
|
Fixes:
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require "gem_dependencies_visualizer/version"
|
2
2
|
|
3
3
|
module GemDependenciesVisualizer
|
4
|
-
def self.produce_gems_graph(string_input, graph_name = nil)
|
4
|
+
def self.produce_gems_graph(string_input, graph_name = nil, options = {})
|
5
5
|
unless string_input.nil?
|
6
6
|
g = GraphViz::new( :G, :type => :digraph )
|
7
|
+
g[:rankdir] ='LR'
|
7
8
|
|
8
|
-
data = populate_gem_data string_input
|
9
|
+
data = populate_gem_data string_input, options
|
9
10
|
populate_gem_graph g, data, graph_name
|
10
11
|
end
|
11
12
|
end
|
@@ -14,35 +15,53 @@ module GemDependenciesVisualizer
|
|
14
15
|
protected
|
15
16
|
#########
|
16
17
|
|
17
|
-
def self.populate_gem_data(gemfile_lock_content)
|
18
|
+
def self.populate_gem_data(gemfile_lock_content, options = {})
|
18
19
|
string_array = gemfile_lock_content.gsub("\r\n", "\n").split("\n")
|
19
20
|
gem_list_index = 0
|
21
|
+
gem_list = {}
|
20
22
|
|
21
23
|
string_array.each_with_index do |x, index|
|
22
|
-
if /.*
|
23
|
-
gem_list_index = index +
|
24
|
-
break
|
25
|
-
end
|
26
|
-
end
|
24
|
+
if /.*specs:.*/.match x
|
25
|
+
gem_list_index = index + 1
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
gem_list[key] = values
|
37
|
-
key = string_array[gem_list_index].gsub(/ \(.*\)/, '').gsub(' ', '')
|
27
|
+
continue = true
|
28
|
+
|
29
|
+
if options[:keep_gem_version]
|
30
|
+
key = string_array[gem_list_index].strip
|
31
|
+
else
|
32
|
+
key = clear_gem_name_from_version string_array[gem_list_index]
|
33
|
+
end
|
34
|
+
|
38
35
|
values = []
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
36
|
+
gem_list_index += 1
|
37
|
+
|
38
|
+
while continue
|
39
|
+
if /^ [\S]*( \(.*\))?$/.match string_array[gem_list_index]
|
40
|
+
gem_list[key] = values
|
44
41
|
|
45
|
-
|
42
|
+
if options[:keep_gem_version]
|
43
|
+
key = string_array[gem_list_index].strip
|
44
|
+
else
|
45
|
+
key = clear_gem_name_from_version string_array[gem_list_index]
|
46
|
+
end
|
47
|
+
|
48
|
+
values = []
|
49
|
+
elsif /^ [\S]*( \(.*\))?$/.match string_array[gem_list_index]
|
50
|
+
if options[:keep_gem_version]
|
51
|
+
value = string_array[gem_list_index].strip
|
52
|
+
else
|
53
|
+
value = clear_gem_name_from_version string_array[gem_list_index]
|
54
|
+
end
|
55
|
+
|
56
|
+
values << value
|
57
|
+
else
|
58
|
+
gem_list[key] = values
|
59
|
+
continue = false
|
60
|
+
end
|
61
|
+
|
62
|
+
gem_list_index += 1
|
63
|
+
end
|
64
|
+
end
|
46
65
|
end
|
47
66
|
|
48
67
|
gem_list
|
@@ -69,6 +88,11 @@ module GemDependenciesVisualizer
|
|
69
88
|
graph.output(:png => "#{directory_name}/#{graph_name.nil? ? "graph_sample" : graph_name }.png" )
|
70
89
|
end
|
71
90
|
|
91
|
+
def self.clear_gem_name_from_version(name)
|
92
|
+
name.gsub(/ \(.*\)/, '').gsub(' ', '')
|
93
|
+
end
|
94
|
+
|
72
95
|
private_class_method :populate_gem_graph
|
73
96
|
private_class_method :populate_gem_data
|
97
|
+
private_class_method :clear_gem_name_from_version
|
74
98
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem_dependencies_visualizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasilis Kalligas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|