lono 3.2.1 → 3.3.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/CHANGELOG.md +4 -0
- data/lib/lono/inspector.rb +7 -8
- data/lib/lono/inspector/summary.rb +52 -0
- data/lib/lono/version.rb +1 -1
- data/spec/fixtures/my_project/config/templates/base/stacks.rb +2 -0
- data/spec/lib/lono/inspect_spec.rb +3 -3
- metadata +3 -3
- data/lib/lono/inspector/params.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b2d67a85fee4daded65c65028dbd094486a0101
|
4
|
+
data.tar.gz: e33e494d68616a33ec6f784bf661f1f339a3f6f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbc8ef84810384771bb86715934b8acdbffa4f4705ffbb1efda5e3c543e16c9d68e5b71d2dc97009e29f2c6f50fbbb7cf1984258d9ac557b1f35f4b73b6e54f8
|
7
|
+
data.tar.gz: ac729217bb028c95417e42beb3009d12ee807a07b3f49da4e0468328bcdf08262b8f84652da78069d3e35b5c79a1103f06610770abd834c2127f20b168491ab6
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [3.3.0]
|
7
|
+
- add lono inspect summary
|
8
|
+
- remove lono inspect params
|
9
|
+
|
6
10
|
## [3.2.1]
|
7
11
|
- fix lono inspect params
|
8
12
|
|
data/lib/lono/inspector.rb
CHANGED
@@ -3,24 +3,23 @@ require "thor"
|
|
3
3
|
class Lono::Inspector < Lono::Command
|
4
4
|
autoload :Help, 'lono/inspector/help'
|
5
5
|
autoload :Base, 'lono/inspector/base'
|
6
|
-
autoload :Params, 'lono/inspector/params'
|
7
6
|
autoload :Depends, 'lono/inspector/depends'
|
7
|
+
autoload :Summary, 'lono/inspector/summary'
|
8
8
|
|
9
9
|
class_option :verbose, type: :boolean
|
10
10
|
class_option :noop, type: :boolean
|
11
11
|
class_option :project_root, desc: "Project folder. Defaults to current directory", default: "."
|
12
12
|
|
13
|
-
desc "params STACK", "Prints report of CloudFormation template parameters"
|
14
|
-
option :type, type: :string, desc: "type can be: all, required, optional", default: "all"
|
15
|
-
long_desc Help.params
|
16
|
-
def params(name)
|
17
|
-
Params.new(name, options).run
|
18
|
-
end
|
19
|
-
|
20
13
|
desc "depends STACK", "Prints dependencies tree of CloudFormation template resources"
|
21
14
|
long_desc Help.depends
|
22
15
|
option :display, type: :string, desc: "graph or text", default: "graph"
|
23
16
|
def depends(name)
|
24
17
|
Depends.new(name, options).run
|
25
18
|
end
|
19
|
+
|
20
|
+
desc "summary STACK", "Prints summary of CloudFormation template"
|
21
|
+
long_desc Help.params
|
22
|
+
def summary(name)
|
23
|
+
Summary.new(name, options).run
|
24
|
+
end
|
26
25
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
class Lono::Inspector::Summary < Lono::Inspector::Base
|
2
|
+
def perform
|
3
|
+
puts "CloudFormation Template Summary:".colorize(:green)
|
4
|
+
return if @options[:noop]
|
5
|
+
|
6
|
+
puts "Parameters:"
|
7
|
+
print_parameters("Required", required_parameters)
|
8
|
+
print_parameters("Optional", optional_parameters)
|
9
|
+
|
10
|
+
puts "Resources:"
|
11
|
+
print_resource_types
|
12
|
+
end
|
13
|
+
|
14
|
+
def print_parameters(label, parameters)
|
15
|
+
puts "#{label}:"
|
16
|
+
if parameters.empty?
|
17
|
+
puts " There are no #{label.downcase} parameters"
|
18
|
+
else
|
19
|
+
parameters.each do |logical_id, p|
|
20
|
+
output = " #{logical_id} (#{p["Type"]})"
|
21
|
+
if p["Default"]
|
22
|
+
output << " Default: #{p["Default"]}"
|
23
|
+
end
|
24
|
+
puts output
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def required_parameters
|
30
|
+
data["Parameters"].reject { |logical_id, p| p["Default"] }
|
31
|
+
end
|
32
|
+
|
33
|
+
def optional_parameters
|
34
|
+
data["Parameters"].select { |logical_id, p| p["Default"] }
|
35
|
+
end
|
36
|
+
|
37
|
+
def resource_types
|
38
|
+
types = Hash.new(0)
|
39
|
+
data["Resources"].each do |logical_id, resource|
|
40
|
+
types[resource["Type"]] += 1
|
41
|
+
end
|
42
|
+
types
|
43
|
+
end
|
44
|
+
|
45
|
+
def print_resource_types
|
46
|
+
types = resource_types.sort_by {|r| r[1] * -1} # Hash -> 2D Array
|
47
|
+
types.each do |a|
|
48
|
+
type, count = a
|
49
|
+
printf "%3s %s\n", count, type
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/lono/version.rb
CHANGED
@@ -11,9 +11,9 @@ describe Lono::Inspector do
|
|
11
11
|
expect(out).to include("Generating dependencies tree")
|
12
12
|
end
|
13
13
|
|
14
|
-
it "
|
15
|
-
out = execute("bin/lono inspect
|
16
|
-
expect(out).to include("
|
14
|
+
it "summary" do
|
15
|
+
out = execute("bin/lono inspect summary my-stack #{@args}")
|
16
|
+
expect(out).to include("Summary")
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lono
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -280,7 +280,7 @@ files:
|
|
280
280
|
- lib/lono/inspector/base.rb
|
281
281
|
- lib/lono/inspector/depends.rb
|
282
282
|
- lib/lono/inspector/help.rb
|
283
|
-
- lib/lono/inspector/
|
283
|
+
- lib/lono/inspector/summary.rb
|
284
284
|
- lib/lono/new.rb
|
285
285
|
- lib/lono/param.rb
|
286
286
|
- lib/lono/param/generator.rb
|
@@ -1,28 +0,0 @@
|
|
1
|
-
class Lono::Inspector::Params < Lono::Inspector::Base
|
2
|
-
def perform
|
3
|
-
puts "Parameters Summary:".colorize(:green)
|
4
|
-
return if @options[:noop]
|
5
|
-
|
6
|
-
print_parameters("Required", required_parameters)
|
7
|
-
print_parameters("Optional", optional_parameters)
|
8
|
-
end
|
9
|
-
|
10
|
-
def print_parameters(label, parameters)
|
11
|
-
puts "#{label}:"
|
12
|
-
if parameters.empty?
|
13
|
-
puts " There are no #{label.downcase} parameters"
|
14
|
-
else
|
15
|
-
parameters.each do |logical_id, p|
|
16
|
-
puts " #{logical_id}"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def required_parameters
|
22
|
-
data["Parameters"].reject { |logical_id, p| p["Default"] }
|
23
|
-
end
|
24
|
-
|
25
|
-
def optional_parameters
|
26
|
-
data["Parameters"].select { |logical_id, p| p["Default"] }
|
27
|
-
end
|
28
|
-
end
|