cobra_commander 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/cobra_commander/cli.rb +7 -0
- data/lib/cobra_commander/formatted_output.rb +22 -1
- data/lib/cobra_commander/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb2f9f51193bd4ec022e4f12eae0b43f02d0f4f7adac086ac8c38f2bd7f3bf56
|
4
|
+
data.tar.gz: bb44e1c12845cab98efdcb8cf1da499f67fa335bd781bf14f4c07d11ed3c9eb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd838a67943d9e2ae8cc7038b81ccacaaea719f8cc08cea7704df5147ffc1609ef2a91622549d423954003465d1ec310b0d09bf10ec8f3cf915850e0dbdbe39c
|
7
|
+
data.tar.gz: a4dec3544d6a5fbcd258b759b9ba143955acf054b4ff44af1fb25d0f3391f37741e9c2d9e31221fd192ec08c843f39b62833a6741de6313e17453e37ca82722b
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## Version 0.4.0 - 2018-09-06
|
6
|
+
|
7
|
+
* Add `dependencies_of` command to permit listing or counting the dependencies of a particular component. PR [#24](https://github.com/powerhome/cobra_commander/pull/24)
|
8
|
+
* Fix indentation of tree output. PR [#23](https://github.com/powerhome/cobra_commander/pull/23)
|
9
|
+
|
5
10
|
## Version 0.3.1 - 2018-08-15
|
6
11
|
|
7
12
|
* Resolve Bundler API version issue causing breakage building a ComponentTree. PR [#19](https://github.com/powerhome/cobra_commander/pull/19)
|
data/lib/cobra_commander/cli.rb
CHANGED
@@ -10,6 +10,13 @@ module CobraCommander
|
|
10
10
|
puts FormattedOutput.new(app_path).run!
|
11
11
|
end
|
12
12
|
|
13
|
+
desc "dependencies_of APP_PATH", "Outputs count of components in APP_PATH dependent on COMPONENT"
|
14
|
+
method_option :component, required: true, aliases: "-c", desc: "Name of component. Ex: my_component"
|
15
|
+
method_option :format, default: "count", aliases: "-f", desc: "count or list"
|
16
|
+
def dependencies_of(app_path)
|
17
|
+
puts FormattedOutput.new(app_path).dependencies_of!(@options[:component], @options[:format])
|
18
|
+
end
|
19
|
+
|
13
20
|
desc "version", "Prints version"
|
14
21
|
def version
|
15
22
|
puts CobraCommander::VERSION
|
@@ -22,8 +22,29 @@ module CobraCommander
|
|
22
22
|
nil
|
23
23
|
end
|
24
24
|
|
25
|
+
def dependencies_of!(component_name, format)
|
26
|
+
@component_name = component_name
|
27
|
+
|
28
|
+
results = @tree[:dependencies].map do |component|
|
29
|
+
if @component_name == component[:name]
|
30
|
+
@tree[:name]
|
31
|
+
elsif dependency?(component)
|
32
|
+
component[:name]
|
33
|
+
end
|
34
|
+
end.compact
|
35
|
+
|
36
|
+
"list" == format ? results : results.size
|
37
|
+
end
|
38
|
+
|
25
39
|
private
|
26
40
|
|
41
|
+
def dependency?(deps)
|
42
|
+
deps[:dependencies].each do |dep|
|
43
|
+
return true if @component_name == dep[:name] || dependency?(dep)
|
44
|
+
end
|
45
|
+
false
|
46
|
+
end
|
47
|
+
|
27
48
|
def list_dependencies(deps, outdents = [])
|
28
49
|
deps[:dependencies].each do |dep|
|
29
50
|
decide_on_line(deps, dep, outdents)
|
@@ -40,7 +61,7 @@ module CobraCommander
|
|
40
61
|
|
41
62
|
def add_tee(outdents, dep)
|
42
63
|
puts line(outdents, TEE, dep[:name])
|
43
|
-
list_dependencies(dep, ([BAR]
|
64
|
+
list_dependencies(dep, (outdents + [BAR]))
|
44
65
|
end
|
45
66
|
|
46
67
|
def add_corner(outdents, dep)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cobra_commander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Langfeld
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-09-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
version: '0'
|
194
194
|
requirements: []
|
195
195
|
rubyforge_project:
|
196
|
-
rubygems_version: 2.7.
|
196
|
+
rubygems_version: 2.7.3
|
197
197
|
signing_key:
|
198
198
|
specification_version: 4
|
199
199
|
summary: Tools for working with Component Based Rails Apps
|