cobradeps 0.3.1 → 0.4.0
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/README.md +5 -1
- data/bin/cobradeps +11 -8
- data/cobradeps.gemspec +1 -1
- data/lib/cobradeps.rb +27 -15
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf2c4837ace66225c6e94b21c8643bf11a64045f
|
4
|
+
data.tar.gz: 580a100ed62e22ad60b55d8450007e2d3d0bc32e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3adaac7210c40843bac63c77126a7e33b490b071818e0b06e0d3d255121ae25819c5051b95a7ce963bf8161406b35b11a8a2f69831d369ed945206f9c9d9b4ef
|
7
|
+
data.tar.gz: 0974dee6bc1ab9019c9c5c1905e74c61b8d9709097c2f2ad036678df91f83579939ab1aa3d0cf8ad8edd0d614f6ae78d6f33a64af8c1032ad67af373132def7d
|
data/README.md
CHANGED
@@ -73,13 +73,17 @@ unclear which gems it really directly depends on. That's why all dependencies of
|
|
73
73
|
|
74
74
|
To include direct dependencies of an application, add an additional option to the `gem` line from the Gemfile like so:
|
75
75
|
|
76
|
-
gem "B", path: "../B",
|
76
|
+
gem "B", path: "../B", group: :direct
|
77
77
|
gem "C", path: "../C"
|
78
78
|
gem "D", path: "../D"
|
79
79
|
gem "E1", path: "../E1"
|
80
80
|
gem "E2", path: "../E2"
|
81
81
|
gem "F", path: "../F"
|
82
82
|
|
83
|
+
Why do I need to add _group: :direct?_? In the first release, cobradeps was checking for direct: true, until some time ago this year, the extraneous option `direct:` worked, but then a check was added to not allow extra options and the feature has been broken ever since. (as stated by @shageman on his [merge commit](https://github.com/shageman/cobradeps/commit/6ccf345ab3a34d5f415bb2f381911a3143bb3fd5)).
|
84
|
+
|
85
|
+
So the hack to allow cobradeps check for direct dependency was use one of the possible options that bundler allows on Gemfile, and as group is used to group gems, normally only used with common values (:production, :development and :test) what makes possible for cobradeps checks for _group: :direct_
|
86
|
+
|
83
87
|
This is the [Gemfile of app A](https://github.com/shageman/cobradeps/blob/master/spec/examples/letters/A/Gemfile)
|
84
88
|
from the letters example of which you see the graph above.
|
85
89
|
|
data/bin/cobradeps
CHANGED
@@ -9,11 +9,13 @@ cobradeps [OPTION] [application path]
|
|
9
9
|
Component-based Ruby/Rails dependency grapher.
|
10
10
|
|
11
11
|
Options are...
|
12
|
-
-t, --text
|
13
|
-
-g, --graph
|
14
|
-
-d, --dot
|
12
|
+
-t, --text DEFAULT Outputs a textual representation of the dependencies
|
13
|
+
-g FILENAME, --graph FILENAME Outputs FILENAME.png to the current directory
|
14
|
+
-d FILENAME, --dot FILENAME Outputs FILENAME.dot to the current directory
|
15
15
|
|
16
|
-
|
16
|
+
Leave off the extensions of filenames. They will be added for you.
|
17
|
+
|
18
|
+
-h, -H, --help Display this help message.
|
17
19
|
USAGE
|
18
20
|
end
|
19
21
|
|
@@ -28,9 +30,10 @@ case ARGV.size
|
|
28
30
|
else
|
29
31
|
path = ARGV[0]
|
30
32
|
end
|
31
|
-
when
|
33
|
+
when 3
|
32
34
|
option = ARGV[0]
|
33
|
-
|
35
|
+
filename = ARGV[1]
|
36
|
+
path = ARGV[2]
|
34
37
|
else
|
35
38
|
puts "Incorrect invocation. Please see help:\n\n"
|
36
39
|
puts help_text
|
@@ -41,9 +44,9 @@ if option
|
|
41
44
|
if %w(--help -h -H).include? option
|
42
45
|
puts help_text
|
43
46
|
elsif %w(-g --graph).include? option
|
44
|
-
Cbradeps.output_graph path
|
47
|
+
Cbradeps.output_graph path, filename
|
45
48
|
elsif %w(-d --dot).include? option
|
46
|
-
Cbradeps.output_dot path
|
49
|
+
Cbradeps.output_dot path, filename
|
47
50
|
elsif %w(-t --text).include? option
|
48
51
|
Cbradeps.output_text path
|
49
52
|
end
|
data/cobradeps.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'cobradeps'
|
7
|
-
spec.version = '0.
|
7
|
+
spec.version = '0.4.0'
|
8
8
|
spec.authors = ['Stephan Hagemann']
|
9
9
|
spec.email = ['stephan.hagemann@gmail.com']
|
10
10
|
spec.summary = %q{Prints and exports the dependencies within component-based Ruby/Rails applications}
|
data/lib/cobradeps.rb
CHANGED
@@ -30,14 +30,14 @@ module Cbradeps
|
|
30
30
|
outputs cobra_deps.to_a
|
31
31
|
end
|
32
32
|
|
33
|
-
def self.output_graph(root_path = nil)
|
33
|
+
def self.output_graph(root_path = nil, filename)
|
34
34
|
path = root_path || current_path
|
35
|
-
graph(path).output(:png => "
|
35
|
+
graph(path).output(:png => "#{filename}.png")
|
36
36
|
end
|
37
37
|
|
38
|
-
def self.output_dot(root_path = nil)
|
38
|
+
def self.output_dot(root_path = nil, filename)
|
39
39
|
path = root_path || current_path
|
40
|
-
graph(path).output(:dot => "
|
40
|
+
graph(path).output(:dot => "#{filename}.dot")
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.current_path
|
@@ -52,21 +52,33 @@ module Cbradeps
|
|
52
52
|
|
53
53
|
app = GemfileScraper.new(path)
|
54
54
|
|
55
|
-
app_node = g.add_nodes(app.name)
|
56
|
-
gem_nodes[app.name] = app_node
|
57
|
-
outputs "Added #{app.name} app"
|
58
|
-
|
59
55
|
cobra_deps = app.cobra_dependencies.to_a
|
60
|
-
|
56
|
+
around_g = g.add_graph("cluster0", label: app.name)
|
57
|
+
start_g = around_g.add_graph("cluster1", { label: "", style: "invis", margin: "0,0" })
|
58
|
+
|
59
|
+
i = 0
|
61
60
|
cobra_deps.each do |dep|
|
62
61
|
gem = GemfileScraper.new(dep[:options][:path])
|
63
62
|
gem_nodes[gem.name] = g.add_nodes(gem.name)
|
64
63
|
outputs "Added #{gem.name} node"
|
65
64
|
if dep[:options][:direct]
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
app_node = start_g.add_nodes(app.name + i.to_s)
|
66
|
+
i += 1
|
67
|
+
gem_nodes[app.name] = app_node
|
68
|
+
app_node.set do |node|
|
69
|
+
node.shape = "box"
|
70
|
+
node.fixedsize = true;
|
71
|
+
node.height = 0
|
72
|
+
node.margin = "0,0"
|
73
|
+
node.label = ""
|
74
|
+
node.style = "invis"
|
69
75
|
end
|
76
|
+
outputs "Added #{app.name} app"
|
77
|
+
|
78
|
+
# if !has_edge?(g, app_node, gem_nodes[gem.name])
|
79
|
+
around_g.add_edges(app_node, gem_nodes[gem.name])
|
80
|
+
outputs "Added edge from #{app.name} to #{gem.name}"
|
81
|
+
# end
|
70
82
|
|
71
83
|
end
|
72
84
|
end
|
@@ -76,7 +88,7 @@ module Cbradeps
|
|
76
88
|
dep = cobra_deps[i]
|
77
89
|
gem = GemfileScraper.new(dep[:options][:path])
|
78
90
|
if !gem_nodes.has_key? gem.name
|
79
|
-
gem_nodes[gem.name] =
|
91
|
+
gem_nodes[gem.name] = around_g.add_nodes(gem.name)
|
80
92
|
outputs "Added #{gem.name} node"
|
81
93
|
end
|
82
94
|
|
@@ -84,11 +96,11 @@ module Cbradeps
|
|
84
96
|
gem_cobra_deps.each do |nest_dep|
|
85
97
|
nest_gem = GemfileScraper.new(nest_dep[:options][:path])
|
86
98
|
if !gem_nodes.has_key? nest_gem.name
|
87
|
-
gem_nodes[nest_gem.name] =
|
99
|
+
gem_nodes[nest_gem.name] = around_g.add_nodes(nest_gem.name)
|
88
100
|
outputs "Added to #{nest_gem.name} node"
|
89
101
|
end
|
90
102
|
if !has_edge?(g, gem_nodes[gem.name], gem_nodes[nest_gem.name])
|
91
|
-
|
103
|
+
around_g.add_edges(gem_nodes[gem.name], gem_nodes[nest_gem.name])
|
92
104
|
outputs "Added edge from #{gem.name} to #{nest_gem.name}"
|
93
105
|
end
|
94
106
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cobradeps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephan Hagemann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-graphviz
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.
|
107
|
+
rubygems_version: 2.6.10
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: Prints and exports the dependencies within component-based Ruby/Rails applications
|