gem_dependencies_visualizer 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/CHANGELOG.md +5 -0
- data/README.md +2 -1
- data/lib/gem_dependencies_visualizer.rb +30 -0
- data/lib/gem_dependencies_visualizer/version.rb +1 -1
- data/sample_images/graph_sample.png +0 -0
- 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: 50b6ebe9df3e9a5f6c6e22bd5ead97322ee48a58
|
4
|
+
data.tar.gz: d96a8db942e132292b75ff3768f5f8b353117360
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20a0346dfb78a963d5e33d498a0e52f003f3a934f1db4ef4904642d2434ee0b75e8dc26a0cb04425991b60425e9b9635ccd017d74de7c0944f3831a7be78253c
|
7
|
+
data.tar.gz: bad3bc75f350ee196d40d89d6193de27bebeee787aa40c7ece37b5c046e6a7421561d2c9cfd1d338a9c02d1314bccac016b59fd3a890417e0f0a772a59e7a541
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -18,12 +18,13 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
To produce a graph of your gem dependencies, pass the content of a Gemfile.lock and, if available, the content of the Gemfile as is as an input to the visualizer. You can (optionaly) pass a graph name you might want to give to the .png file to be produced.
|
21
|
+
To produce a graph of your gem dependencies, pass the content of a Gemfile.lock and, if available, the content of the Gemfile as is as an input to the visualizer. For gems, you can also use a different method to pass the gemspec and your Gemfile.lock content. You can (optionaly) pass a graph name you might want to give to the .png file to be produced.
|
22
22
|
|
23
23
|
To use it just run the following in your code:
|
24
24
|
|
25
25
|
```ruby
|
26
26
|
GemDependenciesVisualizer.produce_gems_graph(gemfile_content, gemfile_lock_content, graph_name, options = {})
|
27
|
+
GemDependenciesVisualizer.produce_gems_graph_from_gemspec(gemspec_file_content, gemfile_lock_content, graph_name, options = {})
|
27
28
|
```
|
28
29
|
|
29
30
|
Available options you could use are:
|
@@ -13,6 +13,18 @@ module GemDependenciesVisualizer
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
def self.produce_gems_graph_from_gemspec(gemspec_content, gem_file_lock_content, graph_name = nil, options = {})
|
17
|
+
if gem_file_lock_content.nil?
|
18
|
+
puts 'Please insert both gemspec and Gemfile.lock contents to proceed or just Gemfile.lock content.'
|
19
|
+
else
|
20
|
+
g = GraphViz::new( :G, :type => :digraph )
|
21
|
+
g[:rankdir] = rankdir(options)
|
22
|
+
|
23
|
+
data = populate_gem_data_from_gemspec gemspec_content, gem_file_lock_content, options
|
24
|
+
populate_gem_graph g, data, graph_name, options
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
16
28
|
#########
|
17
29
|
protected
|
18
30
|
#########
|
@@ -32,6 +44,12 @@ module GemDependenciesVisualizer
|
|
32
44
|
end
|
33
45
|
end
|
34
46
|
|
47
|
+
def self.collect_gems_from_gemspec_file(gemspec_file_content, options = {})
|
48
|
+
unless gemspec_file_content.nil?
|
49
|
+
(gemspec_file_content.scan /.*spec\.(add.*dependency|name.*=) ['"](?<attribute>\S*)['"]/).flatten.uniq.sort
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
35
53
|
def self.collect_gems_from_gemfile_lock(gem_file_lock_content, options = {})
|
36
54
|
string_array = gem_file_lock_content.gsub("\r\n", "\n").split("\n")
|
37
55
|
gem_list_index = 0
|
@@ -84,6 +102,16 @@ module GemDependenciesVisualizer
|
|
84
102
|
gem_list
|
85
103
|
end
|
86
104
|
|
105
|
+
def self.populate_gem_data_from_gemspec(gemspec_file_content, gemfile_lock_content, options = {})
|
106
|
+
gem_dependencies = collect_gems_from_gemfile_lock gemfile_lock_content, options
|
107
|
+
gems = collect_gems_from_gemspec_file gemspec_file_content, options
|
108
|
+
|
109
|
+
{
|
110
|
+
:gems => gems,
|
111
|
+
:gem_dependencies => gem_dependencies
|
112
|
+
}
|
113
|
+
end
|
114
|
+
|
87
115
|
def self.populate_gem_data(gem_file_content, gemfile_lock_content, options = {})
|
88
116
|
gem_dependencies = collect_gems_from_gemfile_lock gemfile_lock_content, options
|
89
117
|
gems = collect_gems_from_gemfile gem_file_content, options
|
@@ -135,8 +163,10 @@ module GemDependenciesVisualizer
|
|
135
163
|
|
136
164
|
private_class_method :populate_gem_graph
|
137
165
|
private_class_method :populate_gem_data
|
166
|
+
private_class_method :populate_gem_data_from_gemspec
|
138
167
|
private_class_method :clear_gem_name_from_version
|
139
168
|
private_class_method :rankdir
|
140
169
|
private_class_method :collect_gems_from_gemfile
|
141
170
|
private_class_method :collect_gems_from_gemfile_lock
|
171
|
+
private_class_method :collect_gems_from_gemspec_file
|
142
172
|
end
|
Binary file
|
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.6
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|